Skip to content

Commit b8af812

Browse files
committed
User-agent on CI snapshot download
1 parent c7b6790 commit b8af812

File tree

2 files changed

+3
-107
lines changed

2 files changed

+3
-107
lines changed

.github/workflows/tests.yml

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -44,96 +44,9 @@ jobs:
4444
env:
4545
SKIP: no-commit-to-branch
4646

47-
preload-cache:
48-
name: Preload HF cache
49-
runs-on: ubuntu-latest
50-
strategy:
51-
fail-fast: false
52-
matrix:
53-
python_version: ["3.11"]
54-
pytorch_version: ["2.6.0"]
55-
timeout-minutes: 20
56-
57-
env:
58-
AXOLOTL_IS_CI_CACHE_PRELOAD: "1"
59-
60-
steps:
61-
- name: Check out repository code
62-
uses: actions/checkout@v4
63-
64-
- name: Restore HF cache
65-
id: hf-cache-restore
66-
uses: actions/cache/restore@v4
67-
with:
68-
path: |
69-
/home/runner/.cache/huggingface/hub/datasets--*
70-
/home/runner/.cache/huggingface/hub/models--*
71-
key: ${{ runner.os }}-hf-hub-cache-v2
72-
73-
- name: Setup Python
74-
uses: actions/setup-python@v5
75-
with:
76-
python-version: ${{ matrix.python_version }}
77-
cache: 'pip' # caching pip dependencies
78-
79-
- name: upgrade pip
80-
run: |
81-
pip3 install --upgrade pip
82-
pip3 install --upgrade packaging==23.2 setuptools==75.8.0 wheel
83-
84-
- name: Install PyTorch
85-
run: |
86-
pip3 install torch==${{ matrix.pytorch_version }}
87-
88-
- name: Install dependencies
89-
run: |
90-
pip3 show torch
91-
pip3 install --no-build-isolation -U -e .
92-
python scripts/unsloth_install.py | sh
93-
python scripts/cutcrossentropy_install.py | sh
94-
pip3 install -r requirements-dev.txt -r requirements-tests.txt
95-
96-
- name: Make sure PyTorch version wasn't clobbered
97-
run: |
98-
python -c "import torch; assert '${{ matrix.pytorch_version }}' in torch.__version__"
99-
100-
- name: Ensure axolotl CLI was installed
101-
run: |
102-
axolotl --help
103-
104-
- name: Pre-Download dataset fixture
105-
run: |
106-
huggingface-cli download --repo-type=dataset axolotl-ai-internal/axolotl-oss-dataset-fixtures
107-
108-
- name: Run tests
109-
run: |
110-
pytest -v tests/conftest.py
111-
112-
- name: Upload coverage to Codecov
113-
uses: codecov/codecov-action@v5
114-
with:
115-
token: ${{ secrets.CODECOV_TOKEN }}
116-
files: ./coverage.xml
117-
flags: unittests,pytorch-${{ matrix.pytorch_version }}
118-
fail_ci_if_error: false
119-
120-
- name: cleanup pip cache
121-
run: |
122-
find "$(pip cache dir)/http-v2" -type f -mtime +14 -exec rm {} \;
123-
124-
- name: Save HF cache
125-
id: hf-cache
126-
uses: actions/cache/save@v4
127-
with:
128-
path: |
129-
/home/runner/.cache/huggingface/hub/datasets--*
130-
/home/runner/.cache/huggingface/hub/models--*
131-
key: ${{ steps.hf-cache-restore.outputs.cache-primary-key }}
132-
13347
pytest:
13448
name: PyTest
13549
runs-on: ubuntu-latest
136-
needs: [preload-cache]
13750
strategy:
13851
fail-fast: false
13952
matrix:
@@ -145,15 +58,6 @@ jobs:
14558
- name: Check out repository code
14659
uses: actions/checkout@v4
14760

148-
- name: Restore HF cache
149-
id: hf-cache-restore
150-
uses: actions/cache/restore@v4
151-
with:
152-
path: |
153-
/home/runner/.cache/huggingface/hub/datasets--*
154-
/home/runner/.cache/huggingface/hub/models--*
155-
key: ${{ runner.os }}-hf-hub-cache-v2
156-
15761
- name: Setup Python
15862
uses: actions/setup-python@v5
15963
with:
@@ -210,7 +114,6 @@ jobs:
210114
pytest-sdist:
211115
name: PyTest from Source Dist
212116
runs-on: ubuntu-latest
213-
needs: [preload-cache]
214117
strategy:
215118
fail-fast: false
216119
matrix:
@@ -222,15 +125,6 @@ jobs:
222125
- name: Check out repository code
223126
uses: actions/checkout@v4
224127

225-
- name: Restore HF cache
226-
id: hf-cache-restore
227-
uses: actions/cache/restore@v4
228-
with:
229-
path: |
230-
/home/runner/.cache/huggingface/hub/datasets--*
231-
/home/runner/.cache/huggingface/hub/models--*
232-
key: ${{ runner.os }}-hf-hub-cache-v2
233-
234128
- name: Setup Python
235129
uses: actions/setup-python@v5
236130
with:

tests/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ def snapshot_download_w_retry(*args, **kwargs):
5858
"""
5959
with hf_offline_context(True):
6060
try:
61-
return snapshot_download(*args, **kwargs)
61+
return snapshot_download(
62+
*args, user_agent={"is_ci": "true", "axolotl": "ci"}, **kwargs
63+
)
6264
except LocalEntryNotFoundError:
6365
pass
6466
with hf_offline_context(False):

0 commit comments

Comments
 (0)