From 00716fa4be018900d066a32556d84efd240dc3d5 Mon Sep 17 00:00:00 2001 From: Lewis Tunstall Date: Sat, 2 Mar 2024 14:52:21 +0000 Subject: [PATCH 1/7] Tidy up dependency groups --- .github/workflows/quality.yaml | 5 +---- .github/workflows/tests.yaml | 2 +- pyproject.toml | 9 ++++----- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/quality.yaml b/.github/workflows/quality.yaml index 23e956fbe..fa1490432 100644 --- a/.github/workflows/quality.yaml +++ b/.github/workflows/quality.yaml @@ -24,10 +24,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python setup.py egg_info - sed '/^$/q' src/lighteval.egg-info/requires.txt > src/lighteval.egg-info/requires_lite.txt - python -m pip install ruff -c src/lighteval.egg-info/requires_lite.txt - rm -rf src/lighteval.egg-info + python -m pip install ".[quality]" - name: Code quality run: | make quality diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index ceb68e17a..f8840b141 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -26,7 +26,7 @@ jobs: cache: 'pip' - name: Install lighteval in editable mode run: | - pip install -e .[accelerate] + pip install -e .[dev] - name: Get cached files uses: actions/cache@v2 id: get-cache diff --git a/pyproject.toml b/pyproject.toml index 4b746a110..96a6b1f0c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,12 +50,10 @@ keywords = ["evaluation", "nlp", "llm"] dependencies = [ # Base dependencies "transformers>=4.38.0", - "huggingface_hub==0.20.3", + "huggingface_hub>=0.20.3", "torch>=2.0", "GitPython==3.1.31", # for logging "datasets>=2.14.0", - # Test - "pytest==7.4.0", # Prettiness "termcolor==2.3.0", "pytablewriter", @@ -72,8 +70,6 @@ dependencies = [ "sentencepiece>=0.1.99", "protobuf==3.20.*", # pinned for sentencepiece compat "pycountry", - # Code style - "ruff==v0.2.2", ] [project.optional-dependencies] @@ -87,6 +83,9 @@ nanotron = [ "nanotron", "tensorboardX" ] +quality = ["ruff==v0.2.2"] +tests = ["pytest==7.4.0"] +dev = ["lighteval[accelerate,quality,tests]"] [project.urls] From 93cc6218e6826eda83374fded0fbc0b1073d457b Mon Sep 17 00:00:00 2001 From: Lewis Tunstall Date: Mon, 4 Mar 2024 11:18:19 +0000 Subject: [PATCH 2/7] Group transformers deps --- pyproject.toml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 96a6b1f0c..1df40128f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,7 @@ classifiers = [ keywords = ["evaluation", "nlp", "llm"] dependencies = [ # Base dependencies - "transformers>=4.38.0", + "transformers[sentencepiece,sklearn,sacrebleu]>=4.38.0", "huggingface_hub>=0.20.3", "torch>=2.0", "GitPython==3.1.31", # for logging @@ -62,12 +62,8 @@ dependencies = [ "aenum==3.1.15", # Base metrics "nltk==3.8.1", - "numpy", - "scikit-learn", "spacy==3.7.2", - "sacrebleu", "rouge_score==0.1.2", - "sentencepiece>=0.1.99", "protobuf==3.20.*", # pinned for sentencepiece compat "pycountry", ] From bdb9e3a0c648d32207ad7f8579a7cf4499c45ad7 Mon Sep 17 00:00:00 2001 From: Lewis Tunstall Date: Mon, 4 Mar 2024 11:22:44 +0000 Subject: [PATCH 3/7] Revert sp --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1df40128f..e7326b14f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,7 @@ classifiers = [ keywords = ["evaluation", "nlp", "llm"] dependencies = [ # Base dependencies - "transformers[sentencepiece,sklearn,sacrebleu]>=4.38.0", + "transformers[sklearn,sacrebleu]>=4.38.0", "huggingface_hub>=0.20.3", "torch>=2.0", "GitPython==3.1.31", # for logging @@ -64,6 +64,7 @@ dependencies = [ "nltk==3.8.1", "spacy==3.7.2", "rouge_score==0.1.2", + "sentencepiece>=0.1.99", "protobuf==3.20.*", # pinned for sentencepiece compat "pycountry", ] From 42fcf38f99c77f0bc60eb85df8e0c3dd5a3d8449 Mon Sep 17 00:00:00 2001 From: Lewis Tunstall Date: Mon, 4 Mar 2024 11:26:43 +0000 Subject: [PATCH 4/7] Revert sb --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e7326b14f..d93a6f995 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,7 @@ classifiers = [ keywords = ["evaluation", "nlp", "llm"] dependencies = [ # Base dependencies - "transformers[sklearn,sacrebleu]>=4.38.0", + "transformers[sklearn]>=4.38.0", "huggingface_hub>=0.20.3", "torch>=2.0", "GitPython==3.1.31", # for logging @@ -62,6 +62,7 @@ dependencies = [ "aenum==3.1.15", # Base metrics "nltk==3.8.1", + "sacrebleu", "spacy==3.7.2", "rouge_score==0.1.2", "sentencepiece>=0.1.99", From f784a1b7853352675e8629f9cf4856eb14019ccd Mon Sep 17 00:00:00 2001 From: Lewis Tunstall Date: Mon, 4 Mar 2024 11:28:19 +0000 Subject: [PATCH 5/7] Revert sk --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d93a6f995..e544b5664 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,7 @@ classifiers = [ keywords = ["evaluation", "nlp", "llm"] dependencies = [ # Base dependencies - "transformers[sklearn]>=4.38.0", + "transformers>=4.38.0", "huggingface_hub>=0.20.3", "torch>=2.0", "GitPython==3.1.31", # for logging @@ -63,6 +63,7 @@ dependencies = [ # Base metrics "nltk==3.8.1", "sacrebleu", + "scikit-learn", "spacy==3.7.2", "rouge_score==0.1.2", "sentencepiece>=0.1.99", From 4eb202d9564757244d71082a55685d66312f0552 Mon Sep 17 00:00:00 2001 From: Lewis Tunstall Date: Mon, 4 Mar 2024 11:28:54 +0000 Subject: [PATCH 6/7] Fix order --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e544b5664..b51a3df87 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,9 +62,9 @@ dependencies = [ "aenum==3.1.15", # Base metrics "nltk==3.8.1", - "sacrebleu", "scikit-learn", "spacy==3.7.2", + "sacrebleu", "rouge_score==0.1.2", "sentencepiece>=0.1.99", "protobuf==3.20.*", # pinned for sentencepiece compat From e0942435883da3a5794fa2026efa0902ff659931 Mon Sep 17 00:00:00 2001 From: Nathan Habib Date: Mon, 4 Mar 2024 13:18:08 +0100 Subject: [PATCH 7/7] Use pip install dev in the README and adds pre-commit to dev reqs --- README.md | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 568394cf3..8453af320 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ and pasting your access token. Lastly, if you intend to push to the code base, you'll need to install the precommit hook for styling tests: ```bash -pip install pre-commit +pip install .[dev] pre-commit install ``` diff --git a/pyproject.toml b/pyproject.toml index b51a3df87..9d4447e2f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -82,7 +82,7 @@ nanotron = [ "nanotron", "tensorboardX" ] -quality = ["ruff==v0.2.2"] +quality = ["ruff==v0.2.2","pre-commit"] tests = ["pytest==7.4.0"] dev = ["lighteval[accelerate,quality,tests]"]