Skip to content

Commit 33fedbf

Browse files
committed
use PEP 639 format; add ruff rules; update workflows
1 parent b5e84f9 commit 33fedbf

File tree

8 files changed

+102
-84
lines changed

8 files changed

+102
-84
lines changed

.github/workflows/new_tasks.yml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
name: Scan for changed tasks
1717
steps:
1818
- name: checkout
19-
uses: actions/checkout@v4
19+
uses: actions/checkout@v6
2020
with:
2121
fetch-depth: 2 # OR "2" -> To retrieve the preceding commit.
2222

@@ -25,7 +25,7 @@ jobs:
2525
# and prepends the filter name to the standard output names.
2626
- name: Check task folders
2727
id: changed-tasks
28-
uses: tj-actions/changed-files@v46.0.5
28+
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62
2929
with:
3030
# tasks checks the tasks folder and api checks the api folder for changes
3131
files_yaml: |
@@ -44,28 +44,24 @@ jobs:
4444
echo "One or more test file(s) has changed."
4545
echo "List of all the files that have changed: ${{ steps.changed-tasks.outputs.tasks_all_modified_files }}"
4646
47-
- name: Set up Python 3.10
47+
- name: Install uv
4848
if: steps.changed-tasks.outputs.tasks_any_modified == 'true' || steps.changed-tasks.outputs.api_any_modified == 'true'
49-
uses: actions/setup-python@v5
49+
uses: astral-sh/setup-uv@v7
5050
with:
51-
python-version: '3.10'
52-
cache: 'pip'
53-
cache-dependency-path: pyproject.toml
51+
enable-cache: true
52+
python-version: "3.10"
53+
activate-environment: true
5454
- name: Install dependencies
5555
if: steps.changed-tasks.outputs.tasks_any_modified == 'true' || steps.changed-tasks.outputs.api_any_modified == 'true'
5656
run: |
57-
python -m pip install --upgrade pip
58-
pip install -e '.[dev,ifeval,unitxt,math,longbench]' --extra-index-url https://download.pytorch.org/whl/cpu
59-
# Install optional git dependencies
60-
# pip install bleurt@https://github.com/google-research/bleurt/archive/b610120347ef22b494b6d69b4316e303f5932516.zip#egg=bleurt
61-
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
57+
uv pip install -e '.[dev,ifeval,unitxt,math,longbench,hf]' --extra-index-url https://download.pytorch.org/whl/cpu
6258
- name: Test with pytest
6359
# if new tasks are added, run tests on them
6460
if: steps.changed-tasks.outputs.tasks_any_modified == 'true'
65-
run: python -m pytest tests/test_tasks.py -s -vv
61+
run: pytest -x -s -vv tests/test_tasks.py
6662
# if api is modified, run tests on it
6763
- name: Test more tasks with pytest
6864
env:
6965
API: true
7066
if: steps.changed-tasks.outputs.api_any_modified == 'true'
71-
run: python -m pytest tests/test_tasks.py -s -vv
67+
run: pytest -x -s -vv -n=auto tests/test_tasks.py

.github/workflows/unit_tests.yml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ jobs:
2121

2222
steps:
2323
- name: Checkout Code
24-
uses: actions/checkout@v4
25-
- name: Set up Python 3.10
26-
uses: actions/setup-python@v5
24+
uses: actions/checkout@v6
25+
- name: Install uv
26+
uses: astral-sh/setup-uv@v7
2727
with:
28-
python-version: '3.10'
29-
cache: pip
30-
cache-dependency-path: pyproject.toml
28+
enable-cache: true
29+
python-version: "3.10"
30+
activate-environment: true
31+
- name: Install pip
32+
run: uv pip install pip
3133
- name: Pre-Commit
3234
env:
3335
SKIP: "no-commit-to-branch,mypy"
@@ -43,13 +45,13 @@ jobs:
4345
timeout-minutes: 30
4446
steps:
4547
- name: Checkout Code
46-
uses: actions/checkout@v4
47-
- name: Set up Python ${{ matrix.python-version }}
48-
uses: actions/setup-python@v5
48+
uses: actions/checkout@v6
49+
- name: Install uv
50+
uses: astral-sh/setup-uv@v7
4951
with:
52+
enable-cache: true
5053
python-version: ${{ matrix.python-version }}
51-
cache: pip
52-
cache-dependency-path: pyproject.toml
54+
activate-environment: true
5355

5456
# Cache HuggingFace cache directory for CPU tests
5557
- name: Cache HuggingFace cache (CPU tests)
@@ -63,17 +65,16 @@ jobs:
6365
6466
- name: Install dependencies
6567
run: |
66-
python -m pip install --upgrade pip
67-
pip install -e '.[dev,unitxt]' --extra-index-url https://download.pytorch.org/whl/cpu
68-
pip install hf_xet
68+
uv pip install -e '.[dev,unitxt,hf]' --extra-index-url https://download.pytorch.org/whl/cpu
69+
uv pip install hf_xet
6970
7071
- name: Test with pytest
71-
run: python -m pytest --showlocals -s -vv -n=auto --ignore=tests/models/test_openvino.py --ignore=tests/models/test_hf_steered.py
72-
continue-on-error: true # Continue workflow even if tests fail
72+
run: pytest -x --showlocals -s -vv -n=auto --ignore=tests/models/test_openvino.py --ignore=tests/models/test_hf_steered.py --ignore=tests/scripts/test_zeno_visualize.py
7373

7474
# Save test artifacts
7575
- name: Archive test artifacts
76-
uses: actions/upload-artifact@v4
76+
if: always() # Upload artifacts even if tests fail
77+
uses: actions/upload-artifact@v5
7778
with:
7879
name: output_testcpu${{ matrix.python-version }}
7980
path: |

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ repos:
2727
- id: mixed-line-ending
2828
args: [ --fix=lf ]
2929
- repo: https://github.com/astral-sh/ruff-pre-commit
30-
rev: v0.13.2
30+
rev: v0.14.6
3131
hooks:
3232
# Run the linter.
3333
- id: ruff-check
@@ -46,7 +46,7 @@ repos:
4646
4747
args: [ --check-filenames, --check-hidden, --ignore-words=ignore.txt ]
4848
- repo: https://github.com/jackdewinter/pymarkdown
49-
rev: v0.9.32
49+
rev: v0.9.33
5050
hooks:
5151
- id: pymarkdown
5252
exclude: ^(lm_eval/tasks/.*|docs/footguns\.md)$

pyproject.toml

Lines changed: 51 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=40.8.0", "wheel"]
2+
requires = ["setuptools>=64.0"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
@@ -13,19 +13,15 @@ readme = "README.md"
1313
classifiers = [
1414
"Development Status :: 3 - Alpha",
1515
"Programming Language :: Python :: 3",
16-
"License :: OSI Approved :: MIT License",
1716
"Operating System :: OS Independent",
1817
]
1918
requires-python = ">=3.10"
20-
license = { "text" = "MIT" }
19+
license = { text = "MIT" }
2120
dependencies = [
22-
"evaluate",
2321
"datasets>=2.16.0",
2422
"evaluate>=0.4.0",
23+
"jinja2",
2524
"jsonlines",
26-
"numexpr",
27-
"peft>=0.2.0",
28-
"pybind11>=2.6.2",
2925
"pytablewriter",
3026
"rouge-score>=0.0.4",
3127
"sacrebleu>=1.5.0",
@@ -55,21 +51,21 @@ Repository = "https://github.com/EleutherAI/lm-evaluation-harness"
5551
[project.optional-dependencies]
5652
# Model backend dependencies
5753
api = ["requests", "aiohttp", "tenacity", "tqdm", "tiktoken"]
58-
hf = ["transformers>=4.1","torch>=1.8", "accelerate>=0.26.0"]
54+
hf = ["transformers>=4.1","torch>=1.8", "accelerate>=0.26.0", "peft>=0.2.0",]
5955
vllm = ["vllm>=0.4.2"]
6056
gptq = ["auto-gptq[triton]>=0.6.0"]
6157
gptqmodel = ["gptqmodel>=1.0.9"]
62-
ipex = ["optimum"]
58+
ipex = ["optimum-intel"]
6359
ibm_watsonx_ai = ["ibm_watsonx_ai>=1.1.22", "python-dotenv"]
64-
#mamba = ["mamba_ssm", "causal-conv1d==1.0.2", "torch"] # build error
65-
neuronx = ["optimum[neuronx]>0.0.1"]
60+
# mamba requires CUDA (nvcc) - cannot build on macOS/CPU-only systems
61+
# mamba = ["mamba_ssm", "causal-conv1d==1.0.2", "torch"]
6662
optimum = ["optimum[openvino]"]
6763
sparsify = ["sparsify"]
6864
sae_lens = ["sae_lens"]
6965
# Task specific dependencies
7066
acpbench = ["lark>=1.1.9", "tarski[clingo]==0.8.2", "pddl==0.4.2", "kstar-planner==1.4.2"]
7167
audiolm_qwen = ["librosa", "soundfile"]
72-
dev = ["pytest", "pytest-cov", "pytest-xdist", "pre-commit", "requests", "aiohttp", "tenacity", "tqdm", "tiktoken", "sentencepiece"]
68+
dev = ["pytest", "pytest-cov", "pytest-xdist", "pre-commit", "requests", "aiohttp", "tenacity", "tqdm", "tiktoken", "sentencepiece", "ruff"]
7369
hf_transfer = ["hf_transfer"]
7470
ifeval = ["langdetect", "immutabledict", "nltk>=3.9.1"]
7571
japanese_leaderboard = ["emoji==2.14.0", "neologdn==0.5.3", "fugashi[unidic-lite]", "rouge_score>=0.1.2"]
@@ -92,12 +88,16 @@ tasks = [
9288
"lm_eval[japanese_leaderboard]",
9389
"lm_eval[longbench]",
9490
"lm_eval[libra]",
95-
"lm_eval[mamba]",
9691
"lm_eval[math]",
9792
"lm_eval[multilingual]",
9893
"lm_eval[ruler]",
9994
]
10095

96+
[dependency-groups]
97+
dev = [
98+
"lm_eval[api]", "lm_eval[dev]", "lm_eval[hf]","sentencepiece"
99+
]
100+
101101
[tool.uv]
102102
conflicts = [
103103
[
@@ -122,18 +122,44 @@ plugins.md028.enabled = false # no-blanks-blockquote
122122
plugins.md029.allow_extended_start_values = true # ol-prefix
123123
plugins.md034.enabled = false # no-bare-urls
124124

125-
[tool.ruff.lint]
126-
extend-select = ["I", "W605"]
127-
128-
[tool.ruff.lint.isort]
129-
lines-after-imports = 2
130-
known-first-party = ["lm_eval"]
125+
[tool.ruff]
126+
lint.extend-select = [
127+
"I", # isort
128+
"UP", # pyupgrade
129+
"E", # pycodestyle errors
130+
"C419", # unnecessary-comprehension-in-call
131+
"F", # pyflakes
132+
"B", # flake8-bugbear
133+
"SIM", # flake8-simplify
134+
"RUF034", # useless-if-else
135+
"W605", # invalid-escape-sequence
136+
"FURB", # refurb
137+
]
138+
lint.fixable = [
139+
"I001", # unsorted-imports
140+
"F401", # unused-import
141+
"UP", # pyupgrade fixes
142+
]
143+
lint.ignore = [
144+
"E402", # module-import-not-at-top-of-file
145+
"E731", # lambda-assignment
146+
"E501", # line-too-long
147+
"E111", # indentation-with-invalid-multiple
148+
"E114", # indentation-with-invalid-multiple-comment
149+
"E117", # over-indented
150+
"E741", # ambiguous-variable-name
151+
"E701", # multiple-statements-on-one-line-colon
152+
]
131153

132154
[tool.ruff.lint.extend-per-file-ignores]
133-
"__init__.py" = ["F401", "F402", "F403"]
134-
"utils.py" = ["F401"]
135-
136-
[dependency-groups]
137-
dev = [
138-
"lm_eval[api]", "lm_eval[dev]", "lm_eval[hf]","sentencepiece"
155+
"__init__.py" = [
156+
"F401", # unused-import
157+
"F402", # import-shadowed-by-loop-var
158+
"F403", # undefined-local-with-import-star
159+
"F405", # undefined-local-with-import-star-usage
139160
]
161+
162+
[tool.ruff.lint.isort]
163+
combine-as-imports = true
164+
known-first-party = ["lm_eval"]
165+
lines-after-imports = 2

requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

setup.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)