Skip to content

Commit dfc2549

Browse files
pcuencahari10599
authored andcommitted
mps & onnx tests rework (huggingface#3449)
* Remove ONNX tests from PR. They are already a part of push_tests.yml. * Remove mps tests from PRs. They are already performed on push. * Fix workflow name for fast push tests. * Extract mps tests to a workflow. For better control/filtering. * Remove --extra-index-url from mps tests * Increase tolerance of mps test This test passes in my Mac (Ventura 13.3) but fails in the CI hardware (Ventura 13.2). I ran the local tests following the same steps that exist in the CI workflow. * Temporarily run mps tests on pr So we can test. * Revert "Temporarily run mps tests on pr" Tests passed, go back to running on push.
1 parent 573b5d4 commit dfc2549

File tree

4 files changed

+70
-121
lines changed

4 files changed

+70
-121
lines changed

.github/workflows/pr_tests.yml

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ jobs:
3636
runner: docker-cpu
3737
image: diffusers/diffusers-flax-cpu
3838
report: flax_cpu
39-
- name: Fast ONNXRuntime CPU tests
40-
framework: onnxruntime
41-
runner: docker-cpu
42-
image: diffusers/diffusers-onnxruntime-cpu
43-
report: onnx_cpu
4439
- name: PyTorch Example CPU tests
4540
framework: pytorch_examples
4641
runner: docker-cpu
@@ -98,14 +93,6 @@ jobs:
9893
--make-reports=tests_${{ matrix.config.report }} \
9994
tests
10095
101-
- name: Run fast ONNXRuntime CPU tests
102-
if: ${{ matrix.config.framework == 'onnxruntime' }}
103-
run: |
104-
python -m pytest -n 2 --max-worker-restart=0 --dist=loadfile \
105-
-s -v -k "Onnx" \
106-
--make-reports=tests_${{ matrix.config.report }} \
107-
tests/
108-
10996
- name: Run example PyTorch CPU tests
11097
if: ${{ matrix.config.framework == 'pytorch_examples' }}
11198
run: |
@@ -123,56 +110,3 @@ jobs:
123110
with:
124111
name: pr_${{ matrix.config.report }}_test_reports
125112
path: reports
126-
127-
run_fast_tests_apple_m1:
128-
name: Fast PyTorch MPS tests on MacOS
129-
runs-on: [ self-hosted, apple-m1 ]
130-
131-
steps:
132-
- name: Checkout diffusers
133-
uses: actions/checkout@v3
134-
with:
135-
fetch-depth: 2
136-
137-
- name: Clean checkout
138-
shell: arch -arch arm64 bash {0}
139-
run: |
140-
git clean -fxd
141-
142-
- name: Setup miniconda
143-
uses: ./.github/actions/setup-miniconda
144-
with:
145-
python-version: 3.9
146-
147-
- name: Install dependencies
148-
shell: arch -arch arm64 bash {0}
149-
run: |
150-
${CONDA_RUN} python -m pip install --upgrade pip
151-
${CONDA_RUN} python -m pip install -e .[quality,test]
152-
${CONDA_RUN} python -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
153-
${CONDA_RUN} python -m pip install accelerate --upgrade
154-
${CONDA_RUN} python -m pip install transformers --upgrade
155-
156-
- name: Environment
157-
shell: arch -arch arm64 bash {0}
158-
run: |
159-
${CONDA_RUN} python utils/print_env.py
160-
161-
- name: Run fast PyTorch tests on M1 (MPS)
162-
shell: arch -arch arm64 bash {0}
163-
env:
164-
HF_HOME: /System/Volumes/Data/mnt/cache
165-
HUGGING_FACE_HUB_TOKEN: ${{ secrets.HUGGING_FACE_HUB_TOKEN }}
166-
run: |
167-
${CONDA_RUN} python -m pytest -n 0 -s -v --make-reports=tests_torch_mps tests/
168-
169-
- name: Failure short reports
170-
if: ${{ failure() }}
171-
run: cat reports/tests_torch_mps_failures_short.txt
172-
173-
- name: Test suite reports artifacts
174-
if: ${{ always() }}
175-
uses: actions/upload-artifact@v2
176-
with:
177-
name: pr_torch_mps_test_reports
178-
path: reports

.github/workflows/push_tests_fast.yml

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Slow tests on main
1+
name: Fast tests on main
22

33
on:
44
push:
@@ -108,56 +108,3 @@ jobs:
108108
with:
109109
name: pr_${{ matrix.config.report }}_test_reports
110110
path: reports
111-
112-
run_fast_tests_apple_m1:
113-
name: Fast PyTorch MPS tests on MacOS
114-
runs-on: [ self-hosted, apple-m1 ]
115-
116-
steps:
117-
- name: Checkout diffusers
118-
uses: actions/checkout@v3
119-
with:
120-
fetch-depth: 2
121-
122-
- name: Clean checkout
123-
shell: arch -arch arm64 bash {0}
124-
run: |
125-
git clean -fxd
126-
127-
- name: Setup miniconda
128-
uses: ./.github/actions/setup-miniconda
129-
with:
130-
python-version: 3.9
131-
132-
- name: Install dependencies
133-
shell: arch -arch arm64 bash {0}
134-
run: |
135-
${CONDA_RUN} python -m pip install --upgrade pip
136-
${CONDA_RUN} python -m pip install -e .[quality,test]
137-
${CONDA_RUN} python -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
138-
${CONDA_RUN} python -m pip install accelerate --upgrade
139-
${CONDA_RUN} python -m pip install transformers --upgrade
140-
141-
- name: Environment
142-
shell: arch -arch arm64 bash {0}
143-
run: |
144-
${CONDA_RUN} python utils/print_env.py
145-
146-
- name: Run fast PyTorch tests on M1 (MPS)
147-
shell: arch -arch arm64 bash {0}
148-
env:
149-
HF_HOME: /System/Volumes/Data/mnt/cache
150-
HUGGING_FACE_HUB_TOKEN: ${{ secrets.HUGGING_FACE_HUB_TOKEN }}
151-
run: |
152-
${CONDA_RUN} python -m pytest -n 0 -s -v --make-reports=tests_torch_mps tests/
153-
154-
- name: Failure short reports
155-
if: ${{ failure() }}
156-
run: cat reports/tests_torch_mps_failures_short.txt
157-
158-
- name: Test suite reports artifacts
159-
if: ${{ always() }}
160-
uses: actions/upload-artifact@v2
161-
with:
162-
name: pr_torch_mps_test_reports
163-
path: reports

.github/workflows/push_tests_mps.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Fast mps 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_apple_m1:
18+
name: Fast PyTorch MPS tests on MacOS
19+
runs-on: [ self-hosted, apple-m1 ]
20+
21+
steps:
22+
- name: Checkout diffusers
23+
uses: actions/checkout@v3
24+
with:
25+
fetch-depth: 2
26+
27+
- name: Clean checkout
28+
shell: arch -arch arm64 bash {0}
29+
run: |
30+
git clean -fxd
31+
32+
- name: Setup miniconda
33+
uses: ./.github/actions/setup-miniconda
34+
with:
35+
python-version: 3.9
36+
37+
- name: Install dependencies
38+
shell: arch -arch arm64 bash {0}
39+
run: |
40+
${CONDA_RUN} python -m pip install --upgrade pip
41+
${CONDA_RUN} python -m pip install -e .[quality,test]
42+
${CONDA_RUN} python -m pip install torch torchvision torchaudio
43+
${CONDA_RUN} python -m pip install accelerate --upgrade
44+
${CONDA_RUN} python -m pip install transformers --upgrade
45+
46+
- name: Environment
47+
shell: arch -arch arm64 bash {0}
48+
run: |
49+
${CONDA_RUN} python utils/print_env.py
50+
51+
- name: Run fast PyTorch tests on M1 (MPS)
52+
shell: arch -arch arm64 bash {0}
53+
env:
54+
HF_HOME: /System/Volumes/Data/mnt/cache
55+
HUGGING_FACE_HUB_TOKEN: ${{ secrets.HUGGING_FACE_HUB_TOKEN }}
56+
run: |
57+
${CONDA_RUN} python -m pytest -n 0 -s -v --make-reports=tests_torch_mps tests/
58+
59+
- name: Failure short reports
60+
if: ${{ failure() }}
61+
run: cat reports/tests_torch_mps_failures_short.txt
62+
63+
- name: Test suite reports artifacts
64+
if: ${{ always() }}
65+
uses: actions/upload-artifact@v2
66+
with:
67+
name: pr_torch_mps_test_reports
68+
path: reports

tests/schedulers/test_scheduler_lms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,5 @@ def test_full_loop_device_karras_sigmas(self):
136136
result_sum = torch.sum(torch.abs(sample))
137137
result_mean = torch.mean(torch.abs(sample))
138138

139-
assert abs(result_sum.item() - 3812.9927) < 1e-2
139+
assert abs(result_sum.item() - 3812.9927) < 2e-2
140140
assert abs(result_mean.item() - 4.9648) < 1e-3

0 commit comments

Comments
 (0)