|
18 | 18 | env:
|
19 | 19 | SKIP: no-commit-to-branch
|
20 | 20 |
|
| 21 | + preload-cache: |
| 22 | + name: Preload HF cache |
| 23 | + runs-on: ubuntu-latest |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + python_version: ["3.11"] |
| 28 | + pytorch_version: ["2.6.0"] |
| 29 | + timeout-minutes: 20 |
| 30 | + |
| 31 | + env: |
| 32 | + AXOLOTL_IS_CI_CACHE_PRELOAD: "1" |
| 33 | + |
| 34 | + steps: |
| 35 | + - name: Check out repository code |
| 36 | + uses: actions/checkout@v4 |
| 37 | + |
| 38 | + - name: Restore HF cache |
| 39 | + id: hf-cache-restore |
| 40 | + uses: actions/cache/restore@v4 |
| 41 | + with: |
| 42 | + path: | |
| 43 | + /home/runner/.cache/huggingface/hub/datasets--* |
| 44 | + /home/runner/.cache/huggingface/hub/models--* |
| 45 | + key: ${{ runner.os }}-hf-hub-cache-v2 |
| 46 | + |
| 47 | + - name: Setup Python |
| 48 | + uses: actions/setup-python@v5 |
| 49 | + with: |
| 50 | + python-version: ${{ matrix.python_version }} |
| 51 | + cache: 'pip' # caching pip dependencies |
| 52 | + |
| 53 | + - name: upgrade pip |
| 54 | + run: | |
| 55 | + pip3 install --upgrade pip |
| 56 | + pip3 install --upgrade packaging==23.2 setuptools==75.8.0 wheel |
| 57 | +
|
| 58 | + - name: Install PyTorch |
| 59 | + run: | |
| 60 | + pip3 install torch==${{ matrix.pytorch_version }} |
| 61 | +
|
| 62 | + - name: Install dependencies |
| 63 | + run: | |
| 64 | + pip3 show torch |
| 65 | + pip3 install --no-build-isolation -U -e . |
| 66 | + python scripts/unsloth_install.py | sh |
| 67 | + python scripts/cutcrossentropy_install.py | sh |
| 68 | + pip3 install -r requirements-dev.txt -r requirements-tests.txt |
| 69 | +
|
| 70 | + - name: Make sure PyTorch version wasn't clobbered |
| 71 | + run: | |
| 72 | + python -c "import torch; assert '${{ matrix.pytorch_version }}' in torch.__version__" |
| 73 | +
|
| 74 | + - name: Ensure axolotl CLI was installed |
| 75 | + run: | |
| 76 | + axolotl --help |
| 77 | +
|
| 78 | + - name: Pre-Download dataset fixture |
| 79 | + run: | |
| 80 | + huggingface-cli download --repo-type=dataset axolotl-ai-internal/axolotl-oss-dataset-fixtures |
| 81 | +
|
| 82 | + - name: Run tests |
| 83 | + run: | |
| 84 | + pytest -v tests/conftest.py |
| 85 | +
|
| 86 | + - name: Upload coverage to Codecov |
| 87 | + uses: codecov/codecov-action@v5 |
| 88 | + with: |
| 89 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 90 | + files: ./coverage.xml |
| 91 | + flags: unittests,pytorch-${{ matrix.pytorch_version }} |
| 92 | + fail_ci_if_error: false |
| 93 | + |
| 94 | + - name: cleanup pip cache |
| 95 | + run: | |
| 96 | + find "$(pip cache dir)/http-v2" -type f -mtime +14 -exec rm {} \; |
| 97 | +
|
| 98 | + - name: Save HF cache |
| 99 | + id: hf-cache |
| 100 | + uses: actions/cache/save@v4 |
| 101 | + with: |
| 102 | + path: | |
| 103 | + /home/runner/.cache/huggingface/hub/datasets--* |
| 104 | + /home/runner/.cache/huggingface/hub/models--* |
| 105 | + key: ${{ steps.hf-cache-restore.outputs.cache-primary-key }} |
| 106 | + |
21 | 107 | pytest:
|
22 | 108 | name: PyTest
|
23 | 109 | runs-on: ubuntu-latest
|
| 110 | + needs: [preload-cache] |
24 | 111 | strategy:
|
25 | 112 | fail-fast: false
|
26 | 113 | max-parallel: 2
|
|
0 commit comments