mirror of
https://github.com/docling-project/docling-ibm-models.git
synced 2026-05-17 13:10:52 +00:00
refactor: Use uv as dependencies management (#108)
Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
name: 'Set up Poetry and install'
|
||||
description: 'Set up a specific version of Poetry and install dependencies using caching.'
|
||||
inputs:
|
||||
python-version:
|
||||
description: "Version range or exact version of Python or PyPy to use, using SemVer's version range syntax."
|
||||
default: '3.11'
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Install poetry
|
||||
run: pipx install poetry==1.8.5
|
||||
shell: bash
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
cache: 'poetry'
|
||||
- name: Install dependencies
|
||||
run: poetry install --all-extras
|
||||
shell: bash
|
||||
@@ -0,0 +1,18 @@
|
||||
codecov:
|
||||
# https://docs.codecov.io/docs/comparing-commits
|
||||
allow_coverage_offsets: true
|
||||
coverage:
|
||||
status:
|
||||
project:
|
||||
default:
|
||||
informational: true
|
||||
target: auto # auto compares coverage to the previous base commit
|
||||
if_ci_failed: success
|
||||
flags:
|
||||
- docling-ibm-models
|
||||
comment:
|
||||
layout: "reach, diff, flags, files"
|
||||
behavior: default
|
||||
require_changes: false # if true: only post the comment if coverage changes
|
||||
branches: # branch names that can post comment
|
||||
- "main"
|
||||
@@ -10,11 +10,12 @@ fi
|
||||
CHGLOG_FILE="${CHGLOG_FILE:-CHANGELOG.md}"
|
||||
|
||||
# update package version
|
||||
poetry version "${TARGET_VERSION}"
|
||||
uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version "${TARGET_VERSION}"
|
||||
uv lock --upgrade-package docling-ibm-models
|
||||
|
||||
# collect release notes
|
||||
REL_NOTES=$(mktemp)
|
||||
poetry run semantic-release changelog --unreleased >> "${REL_NOTES}"
|
||||
uv run --no-sync semantic-release changelog --unreleased >> "${REL_NOTES}"
|
||||
|
||||
# update changelog
|
||||
TMP_CHGLOG=$(mktemp)
|
||||
@@ -30,7 +31,7 @@ mv "${TMP_CHGLOG}" "${CHGLOG_FILE}"
|
||||
# push changes
|
||||
git config --global user.name 'github-actions[bot]'
|
||||
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
||||
git add pyproject.toml "${CHGLOG_FILE}"
|
||||
git add pyproject.toml uv.lock "${CHGLOG_FILE}"
|
||||
COMMIT_MSG="chore: bump version to ${TARGET_VERSION} [skip ci]"
|
||||
git commit -m "${COMMIT_MSG}"
|
||||
git push origin main
|
||||
|
||||
+18
-10
@@ -3,13 +3,11 @@ name: "Run CD"
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
# disable keyring (https://github.com/actions/runner-images/issues/6185):
|
||||
PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring
|
||||
|
||||
jobs:
|
||||
code-checks:
|
||||
uses: ./.github/workflows/checks.yml
|
||||
with:
|
||||
push_coverage: false
|
||||
pre-release-check:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
@@ -18,15 +16,20 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # for fetching tags, required for semantic-release
|
||||
- uses: ./.github/actions/setup-poetry
|
||||
- name: Install uv and set the python version
|
||||
uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
enable-cache: true
|
||||
- name: Install dependencies
|
||||
run: uv sync --only-dev
|
||||
- name: Check version of potential release
|
||||
id: version_check
|
||||
run: |
|
||||
TRGT_VERSION=$(poetry run semantic-release print-version)
|
||||
echo "TRGT_VERSION=${TRGT_VERSION}" >> $GITHUB_OUTPUT
|
||||
echo "${TRGT_VERSION}"
|
||||
TRGT_VERSION=$(uv run --no-sync semantic-release print-version)
|
||||
echo "TRGT_VERSION=${TRGT_VERSION}" >> "$GITHUB_OUTPUT"
|
||||
echo "${TRGT_VERSION}"
|
||||
- name: Check notes of potential release
|
||||
run: poetry run semantic-release changelog --unreleased
|
||||
run: uv run --no-sync semantic-release changelog --unreleased
|
||||
release:
|
||||
needs: [code-checks, pre-release-check]
|
||||
if: needs.pre-release-check.outputs.TARGET_TAG_V != ''
|
||||
@@ -43,7 +46,12 @@ jobs:
|
||||
with:
|
||||
token: ${{ steps.app-token.outputs.token }}
|
||||
fetch-depth: 0 # for fetching tags, required for semantic-release
|
||||
- uses: ./.github/actions/setup-poetry
|
||||
- name: Install uv and set the python version
|
||||
uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
enable-cache: true
|
||||
- name: Install dependencies
|
||||
run: uv sync --only-dev
|
||||
- name: Run release script
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
push_coverage:
|
||||
type: boolean
|
||||
description: "If true, the coverage results are pushed to codecov.io."
|
||||
default: true
|
||||
secrets:
|
||||
CODECOV_TOKEN:
|
||||
required: false
|
||||
|
||||
env:
|
||||
HF_HUB_DOWNLOAD_TIMEOUT: "60"
|
||||
HF_HUB_ETAG_TIMEOUT: "60"
|
||||
|
||||
jobs:
|
||||
run-checks:
|
||||
@@ -9,12 +21,76 @@ jobs:
|
||||
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/setup-poetry
|
||||
- name: Cache Hugging Face models
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/huggingface
|
||||
key: huggingface-cache-py${{ matrix.python-version }}
|
||||
- name: Install uv and set the python version
|
||||
uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Run styling check
|
||||
run: poetry run pre-commit run --all-files
|
||||
- name: Install with poetry
|
||||
run: poetry install --all-extras
|
||||
- name: Testing
|
||||
run: poetry run pytest -v tests
|
||||
enable-cache: true
|
||||
- name: pre-commit cache key
|
||||
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> "$GITHUB_ENV"
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/pre-commit
|
||||
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
|
||||
- name: Install dependencies
|
||||
run: uv sync --frozen --all-extras
|
||||
- name: Check style and run tests
|
||||
run: pre-commit run --all-files
|
||||
- name: Upload coverage to Codecov
|
||||
if: inputs.push_coverage
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: ./coverage.xml
|
||||
|
||||
build-package:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.12']
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install uv and set the python version
|
||||
uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
enable-cache: true
|
||||
- name: Install dependencies
|
||||
run: uv sync --all-extras
|
||||
- name: Build package
|
||||
run: uv build
|
||||
- name: Check content of wheel
|
||||
run: unzip -l dist/*.whl
|
||||
- name: Store the distribution packages
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: python-package-distributions
|
||||
path: dist/
|
||||
|
||||
test-package:
|
||||
needs:
|
||||
- build-package
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.12']
|
||||
steps:
|
||||
- name: Download all the dists
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: python-package-distributions
|
||||
path: dist/
|
||||
- name: Install uv and set the python version
|
||||
uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
enable-cache: true
|
||||
- name: Install package
|
||||
run: uv pip install dist/*.whl
|
||||
- name: Test a simple import
|
||||
run: python -c 'from docling_ibm_models.layoutmodel.layout_predictor import LayoutPredictor'
|
||||
|
||||
@@ -2,18 +2,16 @@ name: "Run CI"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize, ready_for_review]
|
||||
types: [opened, reopened, synchronize]
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
- "!main"
|
||||
- "!gh-pages"
|
||||
|
||||
env:
|
||||
# disable keyring (https://github.com/actions/runner-images/issues/6185):
|
||||
PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring
|
||||
|
||||
jobs:
|
||||
code-checks:
|
||||
if: ${{ github.event_name == 'push' || (github.event.pull_request.head.repo.full_name != 'DS4SD/docling-ibm-models' && github.event.pull_request.head.repo.full_name != 'ds4sd/docling-ibm-models') }}
|
||||
if: ${{ github.event_name == 'push' || (github.event.pull_request.head.repo.full_name != 'docling-project/docling-ibm-models' && github.event.pull_request.head.repo.full_name != 'docling-project/docling-ibm-models') }}
|
||||
uses: ./.github/workflows/checks.yml
|
||||
secrets:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
|
||||
@@ -7,15 +7,29 @@ on:
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
# disable keyring (https://github.com/actions/runner-images/issues/6185):
|
||||
PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring
|
||||
|
||||
jobs:
|
||||
build-and-publish:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.12']
|
||||
environment:
|
||||
name: pypi
|
||||
url: https://pypi.org/p/docling-ibm-models
|
||||
permissions:
|
||||
id-token: write # IMPORTANT: mandatory for trusted publishing
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/setup-poetry
|
||||
- name: Build and publish
|
||||
run: poetry publish --build --no-interaction --username=__token__ --password=${{ secrets.PYPI_TOKEN }}
|
||||
- name: Install uv and set the python version
|
||||
uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
enable-cache: true
|
||||
- name: Install dependencies
|
||||
run: uv sync --all-extras
|
||||
- name: Build package
|
||||
run: uv build
|
||||
- name: Publish distribution 📦 to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
attestations: true
|
||||
|
||||
@@ -4,24 +4,23 @@ repos:
|
||||
hooks:
|
||||
- id: black
|
||||
name: Black
|
||||
entry: poetry run black docling_ibm_models
|
||||
entry: uv run --no-sync black docling_ibm_models
|
||||
pass_filenames: false
|
||||
language: system
|
||||
files: '\.py$'
|
||||
- id: isort
|
||||
name: isort
|
||||
entry: poetry run isort docling_ibm_models
|
||||
entry: uv run --no-sync isort docling_ibm_models
|
||||
pass_filenames: false
|
||||
language: system
|
||||
files: '\.py$'
|
||||
- id: poetry
|
||||
name: Poetry check
|
||||
entry: poetry lock --check
|
||||
pass_filenames: false
|
||||
language: system
|
||||
- id: system
|
||||
name: MyPy
|
||||
entry: poetry run mypy docling_ibm_models
|
||||
entry: uv run --no-sync mypy docling_ibm_models
|
||||
pass_filenames: false
|
||||
language: system
|
||||
files: '\.py$'
|
||||
files: '\.py$'
|
||||
- repo: https://github.com/astral-sh/uv-pre-commit
|
||||
rev: 0.7.8
|
||||
hooks:
|
||||
- id: uv-lock
|
||||
|
||||
+28
-124
@@ -2,162 +2,66 @@
|
||||
Our project welcomes external contributions. If you have an itch, please feel
|
||||
free to scratch it.
|
||||
|
||||
To contribute code or documentation, please submit a [pull request](https://github.com/DS4SD/docling/pulls).
|
||||
|
||||
A good way to familiarize yourself with the codebase and contribution process is
|
||||
to look for and tackle low-hanging fruit in the [issue tracker](https://github.com/DS4SD/docling/issues).
|
||||
Before embarking on a more ambitious contribution, please quickly [get in touch](#communication) with us.
|
||||
|
||||
For general questions or support requests, please refer to the [discussion section](https://github.com/DS4SD/docling/discussions).
|
||||
|
||||
**Note: We appreciate your effort, and want to avoid a situation where a contribution
|
||||
requires extensive rework (by you or by us), sits in backlog for a long time, or
|
||||
cannot be accepted at all!**
|
||||
|
||||
### Proposing new features
|
||||
|
||||
If you would like to implement a new feature, please [raise an issue](https://github.com/DS4SD/docling/issues)
|
||||
before sending a pull request so the feature can be discussed. This is to avoid
|
||||
you wasting your valuable time working on a feature that the project developers
|
||||
are not interested in accepting into the code base.
|
||||
|
||||
### Fixing bugs
|
||||
|
||||
If you would like to fix a bug, please [raise an issue](https://github.com/DS4SD/docling/issues) before sending a
|
||||
pull request so it can be tracked.
|
||||
|
||||
### Merge approval
|
||||
|
||||
The project maintainers use LGTM (Looks Good To Me) in comments on the code
|
||||
review to indicate acceptance. A change requires LGTMs from two of the
|
||||
maintainers of each component affected.
|
||||
|
||||
For a list of the maintainers, see the [MAINTAINERS.md](MAINTAINERS.md) page.
|
||||
|
||||
|
||||
## Legal
|
||||
|
||||
Each source file must include a license header for the MIT
|
||||
Software. Using the SPDX format is the simplest approach.
|
||||
e.g.
|
||||
|
||||
```
|
||||
/*
|
||||
Copyright IBM Inc. All rights reserved.
|
||||
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
```
|
||||
|
||||
We have tried to make it as easy as possible to make contributions. This
|
||||
applies to how we handle the legal aspects of contribution. We use the
|
||||
same approach - the [Developer's Certificate of Origin 1.1 (DCO)](https://github.com/hyperledger/fabric/blob/master/docs/source/DCO1.1.txt) - that the Linux® Kernel [community](https://elinux.org/Developer_Certificate_Of_Origin)
|
||||
uses to manage code contributions.
|
||||
|
||||
We simply ask that when submitting a patch for review, the developer
|
||||
must include a sign-off statement in the commit message.
|
||||
|
||||
Here is an example Signed-off-by line, which indicates that the
|
||||
submitter accepts the DCO:
|
||||
|
||||
```
|
||||
Signed-off-by: John Doe <john.doe@example.com>
|
||||
```
|
||||
|
||||
You can include this automatically when you commit a change to your
|
||||
local git repository using the following command:
|
||||
|
||||
```
|
||||
git commit -s
|
||||
```
|
||||
|
||||
|
||||
## Communication
|
||||
|
||||
Please feel free to connect with us using the [discussion section](https://github.com/DS4SD/docling/discussions).
|
||||
|
||||
|
||||
For more details on the contributing guidelines head to the Docling Project [community repository](https://github.com/docling-project/community).
|
||||
|
||||
## Developing
|
||||
|
||||
### Usage of Poetry
|
||||
### Usage of uv
|
||||
|
||||
We use Poetry to manage dependencies.
|
||||
We use [uv](https://docs.astral.sh/uv/) as package and project manager.
|
||||
|
||||
#### Installation
|
||||
|
||||
#### Install
|
||||
To install `uv`, check the documentation on [Installing uv](https://docs.astral.sh/uv/getting-started/installation/).
|
||||
|
||||
To install, see the documentation here: https://python-poetry.org/docs/master/#installing-with-the-official-installer
|
||||
#### Create an environment and sync it
|
||||
|
||||
1. Install the Poetry globally in your machine
|
||||
```bash
|
||||
curl -sSL https://install.python-poetry.org | python3 -
|
||||
```
|
||||
The installation script will print the installation bin folder `POETRY_BIN` which you need in the next steps.
|
||||
|
||||
2. Make sure Poetry is in your `$PATH`
|
||||
- for `zsh`
|
||||
```sh
|
||||
echo 'export PATH="POETRY_BIN:$PATH"' >> ~/.zshrc
|
||||
```
|
||||
- for `bash`
|
||||
```sh
|
||||
echo 'export PATH="POETRY_BIN:$PATH"' >> ~/.bashrc
|
||||
```
|
||||
|
||||
3. The official guidelines linked above include useful details on the configuration of autocomplete for most shell environments, e.g. Bash and Zsh.
|
||||
|
||||
|
||||
#### Create a Virtual Environment and Install Dependencies
|
||||
|
||||
To activate the Virtual Environment, run:
|
||||
You can use the `uv sync` to create a project virtual environment (if it does not already exist) and sync
|
||||
the project's dependencies with the environment.
|
||||
|
||||
```bash
|
||||
poetry shell
|
||||
uv sync
|
||||
```
|
||||
|
||||
To spawn a shell with the Virtual Environment activated. If the Virtual Environment doesn't exist, Poetry will create one for you. Then, to install dependencies, run:
|
||||
#### Use a specific Python version (optional)
|
||||
|
||||
If you need to work with a specific version of Python, you can create a new virtual environment for that version
|
||||
and run the sync command:
|
||||
|
||||
```bash
|
||||
poetry install
|
||||
uv venv --python 3.12
|
||||
uv sync
|
||||
```
|
||||
|
||||
**(Advanced) Use a Specific Python Version**
|
||||
|
||||
If for whatever reason you need to work in a specific (older) version of Python, run:
|
||||
|
||||
```bash
|
||||
poetry env use $(which python3.10)
|
||||
```
|
||||
|
||||
This creates a Virtual Environment with Python 3.10. For other versions, replace `$(which python3.10)` by the path to the interpreter (e.g., `/usr/bin/python3.11`) or use `$(which pythonX.Y)`.
|
||||
|
||||
More detailed options are described on the [Using Python environments](https://docs.astral.sh/uv/pip/environments/) documentation.
|
||||
|
||||
#### Add a new dependency
|
||||
|
||||
Simply use the `uv add` command. The `pyproject.toml` and `uv.lock` files will be updated.
|
||||
|
||||
```bash
|
||||
poetry add NAME
|
||||
uv add [OPTIONS] <PACKAGES|--requirements <REQUIREMENTS>>
|
||||
```
|
||||
|
||||
## Coding style guidelines
|
||||
### Code sytle guidelines
|
||||
|
||||
We use the following tools to enforce code style:
|
||||
|
||||
- iSort, to sort imports
|
||||
- isort, to sort imports
|
||||
- Black, to format code
|
||||
- [MyPy](https://mypy.readthedocs.io), as static type checker
|
||||
|
||||
|
||||
We run a series of checks on the code base on every commit, using `pre-commit`. To install the hooks, run:
|
||||
A set of styling checks, as well as regression tests, are defined and managed through the [pre-commit](https://pre-commit.com/) framework. To ensure that those scripts run automatically before a commit is finalized, install `pre-commit` on your local repository:
|
||||
|
||||
```bash
|
||||
pre-commit install
|
||||
uv run pre-commit install
|
||||
```
|
||||
|
||||
To run the checks on-demand, run:
|
||||
To run the checks on-demand, type:
|
||||
|
||||
```
|
||||
pre-commit run --all-files
|
||||
```bash
|
||||
uv run pre-commit run --all-files
|
||||
```
|
||||
|
||||
Note: Checks like `Black` and `isort` will "fail" if they modify files. This is because `pre-commit` doesn't like to see files modified by their Hooks. In these cases, `git add` the modified files and `git commit` again.
|
||||
Note: Checks like `Black` and `isort` will _fail_ if they modify files. This is because `pre-commit` doesn't like to see files modified by their hooks. In these cases, `git add` the modified files and `git commit` again.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[](https://pypi.org/project/docling-ibm-models/)
|
||||
[](https://pypi.org/project/docling-ibm-models/)
|
||||
[](https://python-poetry.org/)
|
||||
[](https://github.com/astral-sh/uv)
|
||||
[](https://github.com/psf/black)
|
||||
[](https://pycqa.github.io/isort/)
|
||||
[](https://github.com/pre-commit/pre-commit)
|
||||
@@ -15,53 +15,6 @@ AI modules to support the Docling PDF document conversion project.
|
||||
- Layout model is an AI model that provides among other things ability to detect tables on the page. This package contains inference code for Layout model.
|
||||
|
||||
|
||||
## Installation Instructions
|
||||
|
||||
### MacOS / Linux
|
||||
|
||||
To install `poetry` locally, use either `pip` or `homebrew`.
|
||||
|
||||
To install `poetry` on a docker container, do the following:
|
||||
```
|
||||
ENV POETRY_NO_INTERACTION=1 \
|
||||
POETRY_VIRTUALENVS_CREATE=false
|
||||
|
||||
# Install poetry
|
||||
RUN curl -sSL 'https://install.python-poetry.org' > install-poetry.py \
|
||||
&& python install-poetry.py \
|
||||
&& poetry --version \
|
||||
&& rm install-poetry.py
|
||||
```
|
||||
|
||||
To install and run the package, simply set up a poetry environment
|
||||
|
||||
```
|
||||
poetry env use $(which python3.10)
|
||||
poetry shell
|
||||
```
|
||||
|
||||
and install all the dependencies,
|
||||
|
||||
```
|
||||
poetry install # this will only install the deps from the poetry.lock
|
||||
|
||||
poetry install --no-dev # this will skip installing dev dependencies
|
||||
```
|
||||
|
||||
To update or add new dependencies from `pyproject.toml`, rebuild `poetry.lock`
|
||||
```
|
||||
poetry update
|
||||
```
|
||||
|
||||
#### MacOS Intel
|
||||
|
||||
When in development mode on MacOS with Intel chips, one can use compatible dependencies with
|
||||
|
||||
```console
|
||||
poetry update --with mac_intel
|
||||
```
|
||||
|
||||
|
||||
## Pipeline Overview
|
||||

|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class SamOptConfig(OPTConfig):
|
||||
|
||||
|
||||
class SamOPTModel(OPTModel):
|
||||
config_class = SamOptConfig
|
||||
config_class = SamOptConfig # type: ignore
|
||||
|
||||
def __init__(self, config: OPTConfig):
|
||||
super(SamOPTModel, self).__init__(config)
|
||||
@@ -131,7 +131,7 @@ class SamOPTModel(OPTModel):
|
||||
|
||||
|
||||
class SamOPTForCausalLM(OPTForCausalLM):
|
||||
config_class = SamOptConfig
|
||||
config_class = SamOptConfig # type: ignore
|
||||
|
||||
def __init__(self, config):
|
||||
super(OPTForCausalLM, self).__init__(config)
|
||||
|
||||
Generated
-5245
File diff suppressed because it is too large
Load Diff
+66
-81
@@ -1,90 +1,78 @@
|
||||
[tool.poetry]
|
||||
[project]
|
||||
name = "docling-ibm-models"
|
||||
version = "3.4.3" # DO NOT EDIT, updated automatically
|
||||
version = "3.4.3" # DO NOT EDIT, updated automatically
|
||||
description = "This package contains the AI models used by the Docling PDF conversion package"
|
||||
authors = ["Nikos Livathinos <nli@zurich.ibm.com>", "Maxim Lysak <mly@zurich.ibm.com>", "Ahmed Nassar <ahn@zurich.ibm.com>", "Christoph Auer <cau@zurich.ibm.com>", "Michele Dolfi <dol@zurich.ibm.com>", "Peter Staar <taa@zurich.ibm.com>"]
|
||||
license = "MIT"
|
||||
keywords = ["docling", "convert", "document", "pdf", "layout model", "segmentation", "table structure", "table former"]
|
||||
readme = "README.md"
|
||||
keywords= ["docling", "convert", "document", "pdf", "layout model", "segmentation", "table structure", "table former"]
|
||||
authors = [
|
||||
{ name = "Nikos Livathinos", email = "nli@zurich.ibm.com" },
|
||||
{ name = "Maxim Lysak", email = "mly@zurich.ibm.com" },
|
||||
{ name = "Ahmed Nassar", email = "ahn@zurich.ibm.com" },
|
||||
{ name = "Christoph Auer", email = "cau@zurich.ibm.com" },
|
||||
{ name = "Michele Dolfi", email = "dol@zurich.ibm.com" },
|
||||
{ name = "Peter Staar", email = "taa@zurich.ibm.com" },
|
||||
]
|
||||
classifiers = [
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Operating System :: MacOS :: MacOS X",
|
||||
"Operating System :: POSIX :: Linux",
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Intended Audience :: Developers",
|
||||
"Intended Audience :: Science/Research",
|
||||
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
||||
"Programming Language :: Python :: 3"
|
||||
"Operating System :: MacOS :: MacOS X",
|
||||
"Operating System :: POSIX :: Linux",
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Intended Audience :: Developers",
|
||||
"Intended Audience :: Science/Research",
|
||||
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
||||
"Programming Language :: Python :: 3",
|
||||
]
|
||||
packages = [
|
||||
{ include = "docling_ibm_models" },
|
||||
requires-python = '>=3.9,<4.0'
|
||||
dependencies = [
|
||||
'torch (>=2.2.2,<3.0.0)',
|
||||
'torchvision (>=0,<1)',
|
||||
'jsonlines (>=3.1.0,<4.0.0)',
|
||||
'Pillow (>=10.0.0,<12.0.0)',
|
||||
'tqdm (>=4.64.0,<5.0.0)',
|
||||
'opencv-python-headless (>=4.6.0.66,<5.0.0.0)',
|
||||
'huggingface_hub (>=0.23,<1)',
|
||||
'safetensors[torch] (>=0.4.3,<1)',
|
||||
'pydantic (>=2.0.0,<3.0.0)',
|
||||
'docling-core (>=2.19.0,<3.0.0)',
|
||||
'transformers (>=4.47.0,<5.0.0) ; python_version >= "3.13" and (sys_platform != "darwin" or platform_machine != "x86_64")',
|
||||
'transformers (>=4.42.0,<5.0.0) ; sys_platform != "darwin" or platform_machine != "x86_64"',
|
||||
'transformers (>=4.42.0,<4.43.0) ; python_version < "3.13" and sys_platform == "darwin" and platform_machine == "x86_64"',
|
||||
'numpy (>=1.24.4,<3.0.0) ; sys_platform != "darwin" or platform_machine != "x86_64"',
|
||||
'numpy (>=1.24.4,<2.0.0) ; sys_platform == "darwin" and platform_machine == "x86_64"',
|
||||
]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.9"
|
||||
torch = "^2.2.2"
|
||||
torchvision = "^0"
|
||||
transformers = [
|
||||
{markers = "python_version >= '3.13' and (sys_platform != 'darwin' or platform_machine != 'x86_64')", version = "^4.47.0"},
|
||||
{markers = "sys_platform != 'darwin' or platform_machine != 'x86_64'", version = "^4.42.0"},
|
||||
{markers = "python_version < '3.13' and sys_platform == 'darwin' and platform_machine == 'x86_64'", version = "~4.42.0"}
|
||||
]
|
||||
numpy = [
|
||||
{ version = ">=1.24.4,<3.0.0", markers = 'sys_platform != "darwin" or platform_machine != "x86_64"' },
|
||||
{ version = ">=1.24.4,<2.0.0", markers = 'sys_platform == "darwin" and platform_machine == "x86_64"' },
|
||||
]
|
||||
jsonlines = "^3.1.0"
|
||||
Pillow = ">=10.0.0,<12.0.0"
|
||||
tqdm = "^4.64.0"
|
||||
opencv-python-headless = "^4.6.0.66"
|
||||
huggingface_hub = ">=0.23,<1"
|
||||
safetensors = {version=">=0.4.3,<1", extras=["torch"]}
|
||||
pydantic = "^2.0.0"
|
||||
docling-core = "^2.19.0"
|
||||
[project.urls]
|
||||
homepage = "https://github.com/docling-project/docling-ibm-models"
|
||||
repository = "https://github.com/docling-project/docling-ibm-models"
|
||||
issues = "https://github.com/docling-project/docling-ibm-models/issues"
|
||||
changelog = "https://github.com/docling-project/docling-ibm-models/blob/main/CHANGELOG.md"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
black = {extras = ["jupyter"], version = "^24.4.2"}
|
||||
pytest = "^7.2.2"
|
||||
pre-commit = "^3.7.1"
|
||||
mypy = "^1.10.1"
|
||||
isort = "^5.10.1"
|
||||
python-semantic-release = "^7.32.2"
|
||||
flake8 = "^6.0.0"
|
||||
pyproject-flake8 = "^6.0.0"
|
||||
pytest-xdist = "^3.3.1"
|
||||
pytest-flake8 = "^1.1.0"
|
||||
types-requests = "^2.31.0.2"
|
||||
flake8-pyproject = "^1.2.3"
|
||||
pylint = "^2.17.5"
|
||||
ipykernel = "^6.29.5"
|
||||
datasets = "^3.2.0"
|
||||
|
||||
[tool.poetry.group.mac_intel]
|
||||
optional = true
|
||||
|
||||
[tool.poetry.group.mac_intel.dependencies]
|
||||
torch = [
|
||||
{markers = "sys_platform != 'darwin' or platform_machine != 'x86_64'", version = "^2.2.2"},
|
||||
{markers = "sys_platform == 'darwin' and platform_machine == 'x86_64'", version = "~2.2.2"}
|
||||
]
|
||||
torchvision = [
|
||||
{markers = "sys_platform != 'darwin' or platform_machine != 'x86_64'", version = "^0"},
|
||||
{markers = "sys_platform == 'darwin' and platform_machine == 'x86_64'", version = "~0.17.2"}
|
||||
[dependency-groups]
|
||||
dev = [
|
||||
"pre-commit~=3.7",
|
||||
"mypy~=1.10",
|
||||
"black~=24.4",
|
||||
"isort~=5.10",
|
||||
"autoflake~=2.0",
|
||||
"flake8~=7.1",
|
||||
"flake8-docstrings~=1.6",
|
||||
"types-setuptools~=70.3",
|
||||
"pandas-stubs~=2.1",
|
||||
"types-requests~=2.31",
|
||||
"coverage~=7.6",
|
||||
"pytest~=8.3",
|
||||
"pytest-cov>=6.1.1",
|
||||
"pytest-dependency~=0.6",
|
||||
"pytest-xdist~=3.3",
|
||||
"python-semantic-release~=7.32",
|
||||
"datasets~=3.2",
|
||||
]
|
||||
|
||||
[tool.poetry.group.constraints]
|
||||
optional = true
|
||||
[tool.uv]
|
||||
package = true
|
||||
|
||||
[tool.poetry.group.constraints.dependencies]
|
||||
numpy = [
|
||||
{ version = ">=1.24.4,<3.0.0", markers = 'python_version >= "3.10"' },
|
||||
{ version = ">=1.24.4,<2.1.0", markers = 'python_version < "3.10"' },
|
||||
]
|
||||
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
[tool.setuptools.packages.find]
|
||||
include = ["docling_ibm_models*"]
|
||||
|
||||
[tool.black]
|
||||
line-length = 88
|
||||
@@ -94,7 +82,7 @@ include = '\.pyi?$'
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
line_length = 88
|
||||
py_version=39
|
||||
py_version = 39
|
||||
|
||||
[tool.semantic_release]
|
||||
# for default values check:
|
||||
@@ -116,8 +104,5 @@ no_implicit_optional = true
|
||||
python_version = "3.10"
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = [
|
||||
"torchvision.*",
|
||||
"transformers.*"
|
||||
]
|
||||
ignore_missing_imports = true
|
||||
module = ["torchvision.*", "transformers.*"]
|
||||
ignore_missing_imports = true
|
||||
|
||||
Reference in New Issue
Block a user