Skip to content

Commit dca284d

Browse files
authored
Use uv for Update Requirements GitHub Action (#3444)
1 parent a0066e4 commit dca284d

File tree

4 files changed

+15
-84
lines changed

4 files changed

+15
-84
lines changed

.github/workflows/update-requirements.yml

+13-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# This GitHub Actions workflow automatically updates the pinned versions
1+
# This GitHub Actions workflow automatically updates and upgrades the pinned versions
22
# in requirements.txt for all Python dependencies (including transitive dependencies)
3-
# whenever setup.cfg is modified.
3+
# whenever setup.cfg is modified or the workflow is manually triggered.
44

55
name: Update requirements.txt
66

@@ -11,14 +11,15 @@ on:
1111
paths:
1212
- "setup.cfg"
1313
- '.github/workflows/update-requirements.yml'
14+
workflow_dispatch:
1415

1516
jobs:
16-
update-requirements:
17-
name: Update requirements.txt
17+
upgrade-requirements:
18+
name: Upgrade requirements.txt
1819
runs-on: ubuntu-latest
1920
strategy:
2021
matrix:
21-
python-version: ["3.9"]
22+
python-version: ["3.10"]
2223
steps:
2324
- name: Check out repository
2425
uses: actions/checkout@v4
@@ -27,28 +28,25 @@ jobs:
2728
with:
2829
python-version: ${{ matrix.python-version }}
2930
cache: pip
30-
# Workaround a current issue with `pip check`.
31-
# See: https://github.com/stanford-crfm/helm/issues/2855
32-
# TODO(#2855): Remove this
33-
- name: Use old pip
34-
run: pip install --upgrade pip~=24.1.2
31+
- name: Install uv
32+
run: pip install uv
3533
- name: Install PyTorch manually
3634
# PyTorch has to be installed manually in a separate step with --no-cache-dir
3735
# to avoid pip getting killed because PyTorch is too big
3836
# See: https://stackoverflow.com/a/54329850
39-
run: pip install torch==2.2.2 torchvision==0.17.2 --index-url https://download.pytorch.org/whl/cpu --no-cache-dir
40-
- name: Resolve and install requirements
41-
run: pip install -e .[all,dev]
37+
run: uv pip install --system torch==2.2.2 torchvision==0.17.2 --index-url https://download.pytorch.org/whl/cpu --no-cache-dir
38+
- name: Upgrade dependencies
39+
run: uv pip install --system --upgrade -e .[all,dev] torch==2.2.2 torchvision==0.17.2
4240
- name: Verify dependencies
43-
run: pip check
41+
run: uv pip check && pip check
4442
- name: Write header to requirements.txt
4543
run: echo '# This file is automatically generated by GitHub Actions and contains pinned versions for all transitive Python dependencies. Do not modify this file!' > requirements.txt
4644
- name: Write dependencies to requirements.txt
4745
# grep is used to exclude dependencies installed in editable mode
4846
# and dependencies installed from outside PyPI.
4947
# sed is used to loosen the version matches for PyTorch
5048
# so that any CUDA version matches.
51-
run: pip freeze | grep -v -E "( @ |^-e)" | sed -E 's/==([A-Za-z0-9.]+)\+[A-Za-z0-9.]+/~=\1/' >> requirements.txt
49+
run: uv pip freeze | grep -v -E "( @ |^-e)" | sed -E 's/==([A-Za-z0-9.]+)\+[A-Za-z0-9.]+/~=\1/' >> requirements.txt
5250
# Need to manually run tests here because the pull request opened later will not
5351
# run the test workflow.
5452
#

.github/workflows/upgrade-requirements.yml

-69
This file was deleted.

setup.cfg

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ amazon =
138138
anthropic =
139139
anthropic~=0.17,<0.39 # TODO(#3212): Limit anthropic to >=0.39 after resolving #3212.
140140
websocket-client~=1.3.2 # For legacy stanford-online-all-v4-s3
141+
httpx<0.28.0 # TODO(#3324): Remove this tepmorary workaround
141142

142143
cohere =
143144
cohere~=5.3

src/helm/benchmark/metrics/evaluate_reference_metrics.py

+1
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ def cer_score(gold: str, pred: str) -> float:
282282
gold = normalize_text(gold, should_remove_articles=False)
283283
pred = normalize_text(pred, should_remove_articles=False)
284284
cer_ret = cer(gold, pred)
285+
assert isinstance(cer_ret, float)
285286
return cer_ret
286287

287288

0 commit comments

Comments
 (0)