From f925a5bfc451509aae93e74b412b68b9d81d2310 Mon Sep 17 00:00:00 2001 From: Marius Brehler Date: Mon, 28 Oct 2024 19:34:19 +0100 Subject: [PATCH] Revise and split requirements files (#340) Moves dependencies defined in the root `requirements.txt` to `sharktank/` and splits out test only deps to `requirements-tests.txt` file. Dependencies only used for development / in the CI are moved to `requirements-dev.txt` and the root requirements file is now used to pull in all the deps. Furthermore, some no longer used dependencies are removed. --- .github/workflows/ci-sharktank.yml | 6 +++--- .github/workflows/ci_eval.yaml | 2 +- requirements-dev.txt | 10 +++++++++ requirements.txt | 34 ++++-------------------------- sharktank/requirements-tests.txt | 2 ++ sharktank/requirements.txt | 17 ++++++++++++++- sharktank/setup.py | 1 - 7 files changed, 36 insertions(+), 36 deletions(-) create mode 100644 requirements-dev.txt diff --git a/.github/workflows/ci-sharktank.yml b/.github/workflows/ci-sharktank.yml index ead663f53..73243086a 100644 --- a/.github/workflows/ci-sharktank.yml +++ b/.github/workflows/ci-sharktank.yml @@ -6,14 +6,14 @@ on: paths: - '.github/workflows/ci-sharktank.yml' - 'sharktank/**' - - '*requirements.txt' + - '*requirements*.txt' push: branches: - main paths: - '.github/workflows/ci-sharktank.yml' - 'sharktank/**' - - '*requirements.txt' + - '*requirements*.txt' concurrency: # A PR number if a pull request and otherwise the commit hash. This cancels @@ -52,7 +52,7 @@ jobs: id: cache-pip with: path: ${{ env.PIP_CACHE_DIR }} - key: pip-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('*requirements.txt') }} + key: pip-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('*requirements*.txt','sharktank/requirements*.txt') }} - name: Install pip deps run: | diff --git a/.github/workflows/ci_eval.yaml b/.github/workflows/ci_eval.yaml index 7288ed8ac..7b80bd61b 100644 --- a/.github/workflows/ci_eval.yaml +++ b/.github/workflows/ci_eval.yaml @@ -45,7 +45,7 @@ jobs: id: cache-pip with: path: ${{ env.PIP_CACHE_DIR }} - key: pip-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('*requirements.txt') }} + key: pip-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('*requirements*.txt','sharktank/requirements*.txt') }} - name: Install sharktank deps run: | diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 000000000..e736fe3bd --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,10 @@ +# Used for managing pre-commit flows. +pre-commit + +# Type checking +mypy==1.8.0 +types-requests==2.31.0.20240125 + +# Testing +pytest==8.0.0 +pytest-xdist==3.5.0 diff --git a/requirements.txt b/requirements.txt index 0198314f8..cc2edf876 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,30 +1,4 @@ -# Runtime deps. -gguf==0.6.0 -numpy==1.26.3 -onnx==1.15.0 - -# Model deps. -huggingface-hub==0.22.2 -transformers==4.40.0 -sentencepiece==0.2.0 - -# It is expected that you have installed a PyTorch version/variant specific -# to your needs, so we only include a minimum version spec. -# TODO: Use a versioned release once 2.3.0 drops. -torch>=2.3.0.dev1 - -# Used for managing pre-commit flows. -pre-commit - -# Type checking -mypy==1.8.0 -types-requests==2.31.0.20240125 - -# Testing -parameterized -pytest==8.0.0 -pytest-xdist==3.5.0 - -# Serving deps. -fastapi==0.112.2 -uvicorn==0.30.6 +-r sharktank/requirements.txt +-r sharktank/requirements-tests.txt +-r shortfin/requirements-tests.txt +-r requirements-dev.txt diff --git a/sharktank/requirements-tests.txt b/sharktank/requirements-tests.txt index d7266a5e8..4be48fdde 100644 --- a/sharktank/requirements-tests.txt +++ b/sharktank/requirements-tests.txt @@ -1 +1,3 @@ datasets==3.0.0 +parameterized +pytest==8.0.0 diff --git a/sharktank/requirements.txt b/sharktank/requirements.txt index 6b21f239f..ad231d524 100644 --- a/sharktank/requirements.txt +++ b/sharktank/requirements.txt @@ -1 +1,16 @@ -gguf +# Runtime deps. +gguf==0.6.0 +numpy==1.26.3 + +# Model deps. +huggingface-hub==0.22.2 +transformers==4.40.0 +datasets + +# It is expected that you have installed a PyTorch version/variant specific +# to your needs, so we only include a minimum version spec. +torch>=2.3.0 + +# Serving deps. +fastapi==0.112.2 +uvicorn==0.30.6 diff --git a/sharktank/setup.py b/sharktank/setup.py index ab6e92d33..8ffcf3984 100644 --- a/sharktank/setup.py +++ b/sharktank/setup.py @@ -99,7 +99,6 @@ def initialize_options(self): extras_require={ "testing": [ f"pytest{get_version_spec('pytest')}", - f"pytest-xdist{get_version_spec('pytest-xdist')}", ], }, cmdclass={"build": BuildCommand},