@@ -154,3 +154,153 @@ 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
0 commit comments