-
Notifications
You must be signed in to change notification settings - Fork 15
71 lines (68 loc) · 2.75 KB
/
Copy pathunit_tests.yaml
File metadata and controls
71 lines (68 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Unit Tests
on:
pull_request:
branches:
- main
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- transformers: '5.12.1'
peft: '0.19.1'
- transformers: '5.15.0'
peft: '0.19.1'
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
id: setup_python
with:
python-version: '3.12'
- name: Get latest dependency versions
id: get_latest_versions
run: |
torch_version=$(python -m pip index versions torch --index-url https://download.pytorch.org/whl/cpu | perl -ne 'm|Available versions: ([\d\.]+)| && print $1')
deepspeed_version=$(python -m pip index versions deepspeed | perl -ne 'm|Available versions: ([\d\.]+)| && print $1')
versions="torch-$torch_version-deepspeed-$deepspeed_version"
echo "versions=$versions" >> $GITHUB_OUTPUT
- name: Restore cached virtualenv
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae
with:
key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ steps.get_latest_versions.outputs.versions }}-transformers-${{ matrix.transformers }}-peft-${{ matrix.peft }}-${{ hashFiles('pyproject.toml') }}
path: .venv
- name: Restore cached torch extensions
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae
with:
path: ~/.cache/torch_extensions
key: torch-extensions-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ steps.get_latest_versions.outputs.versions }}
- name: Restore huggingface cache
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae
with:
path: ~/.cache/huggingface
key: huggingface-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ steps.get_latest_versions.outputs.versions }}
- name: Setup environment
run: |
pip install uv
if [ ! -d .venv ]; then
uv venv
fi
source .venv/bin/activate
echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
uv pip install torch --index-url https://download.pytorch.org/whl/cpu
uv pip install ".[sft,testing]" "transformers==${{ matrix.transformers }}" "peft==${{ matrix.peft }}"
- name: Environment print
run: |
uv pip list
- name: Unit Tests
run: |
cd tests
python -m pytest -s -v