Skip to content

Commit 120844a

Browse files
[Tests] Refactor push tests (#2329)
* [Tests] Refactor push tests * correct
1 parent a688c7b commit 120844a

File tree

2 files changed

+165
-150
lines changed

2 files changed

+165
-150
lines changed

.github/workflows/push_tests.yml

Lines changed: 0 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -154,153 +154,3 @@ jobs:
154154
with:
155155
name: examples_test_reports
156156
path: reports
157-
158-
run_fast_tests:
159-
strategy:
160-
fail-fast: false
161-
matrix:
162-
config:
163-
- name: Fast PyTorch CPU tests on Ubuntu
164-
framework: pytorch
165-
runner: docker-cpu
166-
image: diffusers/diffusers-pytorch-cpu
167-
report: torch_cpu
168-
- name: Fast Flax CPU tests on Ubuntu
169-
framework: flax
170-
runner: docker-cpu
171-
image: diffusers/diffusers-flax-cpu
172-
report: flax_cpu
173-
- name: Fast ONNXRuntime CPU tests on Ubuntu
174-
framework: onnxruntime
175-
runner: docker-cpu
176-
image: diffusers/diffusers-onnxruntime-cpu
177-
report: onnx_cpu
178-
- name: PyTorch Example CPU tests on Ubuntu
179-
framework: pytorch_examples
180-
runner: docker-cpu
181-
image: diffusers/diffusers-pytorch-cpu
182-
report: torch_cpu
183-
184-
name: ${{ matrix.config.name }}
185-
186-
runs-on: ${{ matrix.config.runner }}
187-
188-
container:
189-
image: ${{ matrix.config.image }}
190-
options: --shm-size "16gb" --ipc host -v /mnt/hf_cache:/mnt/cache/
191-
192-
defaults:
193-
run:
194-
shell: bash
195-
196-
steps:
197-
- name: Checkout diffusers
198-
uses: actions/checkout@v3
199-
with:
200-
fetch-depth: 2
201-
202-
- name: Install dependencies
203-
run: |
204-
apt-get update && apt-get install libsndfile1-dev -y
205-
python -m pip install -e .[quality,test]
206-
python -m pip install -U git+https://github.com/huggingface/transformers
207-
python -m pip install git+https://github.com/huggingface/accelerate
208-
209-
- name: Environment
210-
run: |
211-
python utils/print_env.py
212-
213-
- name: Run fast PyTorch CPU tests
214-
if: ${{ matrix.config.framework == 'pytorch' }}
215-
run: |
216-
python -m pytest -n 2 --max-worker-restart=0 --dist=loadfile \
217-
-s -v -k "not Flax and not Onnx" \
218-
--make-reports=tests_${{ matrix.config.report }} \
219-
tests/
220-
221-
- name: Run fast Flax TPU tests
222-
if: ${{ matrix.config.framework == 'flax' }}
223-
run: |
224-
python -m pytest -n 2 --max-worker-restart=0 --dist=loadfile \
225-
-s -v -k "Flax" \
226-
--make-reports=tests_${{ matrix.config.report }} \
227-
tests/
228-
229-
- name: Run fast ONNXRuntime CPU tests
230-
if: ${{ matrix.config.framework == 'onnxruntime' }}
231-
run: |
232-
python -m pytest -n 2 --max-worker-restart=0 --dist=loadfile \
233-
-s -v -k "Onnx" \
234-
--make-reports=tests_${{ matrix.config.report }} \
235-
tests/
236-
237-
- name: Run example PyTorch CPU tests
238-
if: ${{ matrix.config.framework == 'pytorch_examples' }}
239-
run: |
240-
python -m pytest -n 2 --max-worker-restart=0 --dist=loadfile \
241-
--make-reports=tests_${{ matrix.config.report }} \
242-
examples/test_examples.py
243-
244-
- name: Failure short reports
245-
if: ${{ failure() }}
246-
run: cat reports/tests_${{ matrix.config.report }}_failures_short.txt
247-
248-
- name: Test suite reports artifacts
249-
if: ${{ always() }}
250-
uses: actions/upload-artifact@v2
251-
with:
252-
name: pr_${{ matrix.config.report }}_test_reports
253-
path: reports
254-
255-
run_fast_tests_apple_m1:
256-
name: Fast PyTorch MPS tests on MacOS
257-
runs-on: [ self-hosted, apple-m1 ]
258-
259-
steps:
260-
- name: Checkout diffusers
261-
uses: actions/checkout@v3
262-
with:
263-
fetch-depth: 2
264-
265-
- name: Clean checkout
266-
shell: arch -arch arm64 bash {0}
267-
run: |
268-
git clean -fxd
269-
270-
- name: Setup miniconda
271-
uses: ./.github/actions/setup-miniconda
272-
with:
273-
python-version: 3.9
274-
275-
- name: Install dependencies
276-
shell: arch -arch arm64 bash {0}
277-
run: |
278-
${CONDA_RUN} python -m pip install --upgrade pip
279-
${CONDA_RUN} python -m pip install -e .[quality,test]
280-
${CONDA_RUN} python -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
281-
${CONDA_RUN} python -m pip install git+https://github.com/huggingface/accelerate
282-
${CONDA_RUN} python -m pip install -U git+https://github.com/huggingface/transformers
283-
284-
- name: Environment
285-
shell: arch -arch arm64 bash {0}
286-
run: |
287-
${CONDA_RUN} python utils/print_env.py
288-
289-
- name: Run fast PyTorch tests on M1 (MPS)
290-
shell: arch -arch arm64 bash {0}
291-
env:
292-
HF_HOME: /System/Volumes/Data/mnt/cache
293-
HUGGING_FACE_HUB_TOKEN: ${{ secrets.HUGGING_FACE_HUB_TOKEN }}
294-
run: |
295-
${CONDA_RUN} python -m pytest -n 0 -s -v --make-reports=tests_torch_mps tests/
296-
297-
- name: Failure short reports
298-
if: ${{ failure() }}
299-
run: cat reports/tests_torch_mps_failures_short.txt
300-
301-
- name: Test suite reports artifacts
302-
if: ${{ always() }}
303-
uses: actions/upload-artifact@v2
304-
with:
305-
name: pr_torch_mps_test_reports
306-
path: reports

.github/workflows/push_tests_fast.yml

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
name: Slow tests on main
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
env:
9+
DIFFUSERS_IS_CI: yes
10+
HF_HOME: /mnt/cache
11+
OMP_NUM_THREADS: 8
12+
MKL_NUM_THREADS: 8
13+
PYTEST_TIMEOUT: 600
14+
RUN_SLOW: no
15+
16+
jobs:
17+
run_fast_tests:
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
config:
22+
- name: Fast PyTorch CPU tests on Ubuntu
23+
framework: pytorch
24+
runner: docker-cpu
25+
image: diffusers/diffusers-pytorch-cpu
26+
report: torch_cpu
27+
- name: Fast Flax CPU tests on Ubuntu
28+
framework: flax
29+
runner: docker-cpu
30+
image: diffusers/diffusers-flax-cpu
31+
report: flax_cpu
32+
- name: Fast ONNXRuntime CPU tests on Ubuntu
33+
framework: onnxruntime
34+
runner: docker-cpu
35+
image: diffusers/diffusers-onnxruntime-cpu
36+
report: onnx_cpu
37+
- name: PyTorch Example CPU tests on Ubuntu
38+
framework: pytorch_examples
39+
runner: docker-cpu
40+
image: diffusers/diffusers-pytorch-cpu
41+
report: torch_cpu
42+
43+
name: ${{ matrix.config.name }}
44+
45+
runs-on: ${{ matrix.config.runner }}
46+
47+
container:
48+
image: ${{ matrix.config.image }}
49+
options: --shm-size "16gb" --ipc host -v /mnt/hf_cache:/mnt/cache/
50+
51+
defaults:
52+
run:
53+
shell: bash
54+
55+
steps:
56+
- name: Checkout diffusers
57+
uses: actions/checkout@v3
58+
with:
59+
fetch-depth: 2
60+
61+
- name: Install dependencies
62+
run: |
63+
apt-get update && apt-get install libsndfile1-dev -y
64+
python -m pip install -e .[quality,test]
65+
python -m pip install -U git+https://github.com/huggingface/transformers
66+
python -m pip install git+https://github.com/huggingface/accelerate
67+
68+
- name: Environment
69+
run: |
70+
python utils/print_env.py
71+
72+
- name: Run fast PyTorch CPU tests
73+
if: ${{ matrix.config.framework == 'pytorch' }}
74+
run: |
75+
python -m pytest -n 2 --max-worker-restart=0 --dist=loadfile \
76+
-s -v -k "not Flax and not Onnx" \
77+
--make-reports=tests_${{ matrix.config.report }} \
78+
tests/
79+
80+
- name: Run fast Flax TPU tests
81+
if: ${{ matrix.config.framework == 'flax' }}
82+
run: |
83+
python -m pytest -n 2 --max-worker-restart=0 --dist=loadfile \
84+
-s -v -k "Flax" \
85+
--make-reports=tests_${{ matrix.config.report }} \
86+
tests/
87+
88+
- name: Run fast ONNXRuntime CPU tests
89+
if: ${{ matrix.config.framework == 'onnxruntime' }}
90+
run: |
91+
python -m pytest -n 2 --max-worker-restart=0 --dist=loadfile \
92+
-s -v -k "Onnx" \
93+
--make-reports=tests_${{ matrix.config.report }} \
94+
tests/
95+
96+
- name: Run example PyTorch CPU tests
97+
if: ${{ matrix.config.framework == 'pytorch_examples' }}
98+
run: |
99+
python -m pytest -n 2 --max-worker-restart=0 --dist=loadfile \
100+
--make-reports=tests_${{ matrix.config.report }} \
101+
examples/test_examples.py
102+
103+
- name: Failure short reports
104+
if: ${{ failure() }}
105+
run: cat reports/tests_${{ matrix.config.report }}_failures_short.txt
106+
107+
- name: Test suite reports artifacts
108+
if: ${{ always() }}
109+
uses: actions/upload-artifact@v2
110+
with:
111+
name: pr_${{ matrix.config.report }}_test_reports
112+
path: reports
113+
114+
run_fast_tests_apple_m1:
115+
name: Fast PyTorch MPS tests on MacOS
116+
runs-on: [ self-hosted, apple-m1 ]
117+
118+
steps:
119+
- name: Checkout diffusers
120+
uses: actions/checkout@v3
121+
with:
122+
fetch-depth: 2
123+
124+
- name: Clean checkout
125+
shell: arch -arch arm64 bash {0}
126+
run: |
127+
git clean -fxd
128+
129+
- name: Setup miniconda
130+
uses: ./.github/actions/setup-miniconda
131+
with:
132+
python-version: 3.9
133+
134+
- name: Install dependencies
135+
shell: arch -arch arm64 bash {0}
136+
run: |
137+
${CONDA_RUN} python -m pip install --upgrade pip
138+
${CONDA_RUN} python -m pip install -e .[quality,test]
139+
${CONDA_RUN} python -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
140+
${CONDA_RUN} python -m pip install git+https://github.com/huggingface/accelerate
141+
${CONDA_RUN} python -m pip install -U git+https://github.com/huggingface/transformers
142+
143+
- name: Environment
144+
shell: arch -arch arm64 bash {0}
145+
run: |
146+
${CONDA_RUN} python utils/print_env.py
147+
148+
- name: Run fast PyTorch tests on M1 (MPS)
149+
shell: arch -arch arm64 bash {0}
150+
env:
151+
HF_HOME: /System/Volumes/Data/mnt/cache
152+
HUGGING_FACE_HUB_TOKEN: ${{ secrets.HUGGING_FACE_HUB_TOKEN }}
153+
run: |
154+
${CONDA_RUN} python -m pytest -n 0 -s -v --make-reports=tests_torch_mps tests/
155+
156+
- name: Failure short reports
157+
if: ${{ failure() }}
158+
run: cat reports/tests_torch_mps_failures_short.txt
159+
160+
- name: Test suite reports artifacts
161+
if: ${{ always() }}
162+
uses: actions/upload-artifact@v2
163+
with:
164+
name: pr_torch_mps_test_reports
165+
path: reports

0 commit comments

Comments
 (0)