-
Notifications
You must be signed in to change notification settings - Fork 35
109 lines (90 loc) · 3.08 KB
/
test.yml
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Test
on: [push, pull_request, workflow_call]
jobs:
validate:
name: Validate
if: github.repository_owner == 'explosion'
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Configure Python version
uses: actions/setup-python@v4
with:
python-version: "3.11"
architecture: x64
- name: black
run: |
python -m pip install black -c requirements.txt
python -m black curated_transformers examples --check
- name: isort
run: |
python -m pip install isort -c requirements.txt
python -m isort curated_transformers examples --check
- name: flake8
run: |
python -m pip install flake8==5.0.4
python -m flake8 curated_transformers examples --count --select=E901,E999,F821,F822,F823,W605 --show-source --statistics
test:
name: Run tests
needs: Validate
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.11"]
steps:
- uses: actions/checkout@v1
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Disabled as this seems to randomly break builds on Windows.
# cache: "pip"
- name: Install requirements
run: |
python -m pip install --upgrade pip setuptools wheel build
python -m pip install -r requirements.txt
- name: Build sdist
run: python -m build --sdist
- name: Run mypy
run: mypy curated_transformers
- name: Delete source directory
run: |
cp curated_transformers/tests/conftest.py .
rm -rf curated_transformers
shell: bash
- name: Uninstall all packages
run: |
python -m pip freeze
python -m pip freeze --exclude pywin32 > installed.txt
python -m pip uninstall -y -r installed.txt
- name: Install from sdist
run: |
SDIST=$(python -c "import os;print(os.listdir('./dist')[-1])" 2>&1)
python -m pip install dist/$SDIST
shell: bash
- name: Install test dependencies
run: |
python -m pip install -r requirements.txt
- name: Run pytest
run: python -m pytest --pyargs curated_transformers
- name: Install HF transformers
run: |
python -m pip install transformers
shell: bash
# Upstream Falcon imports this, but doesn't use it. 😭
- name: Install einops
run: |
python -m pip install einops
# For testing the Llama tokenizer against the HF slow tokenizer.
- name: Install sentencepiece
run: |
python -m pip install sentencepiece
# For testing safetensor checkpoints.
- name: Install safetensors
run: |
python -m pip install safetensors
- name: Run pytest (w/t HF transformers)
run: python -m pytest --pyargs curated_transformers