1414 RUN_SLOW : yes
1515
1616jobs :
17- run_tests_single_gpu :
18- name : Diffusers tests
19- runs-on : [ self-hosted, docker-gpu, single-gpu ]
17+ run_slow_tests :
18+ strategy :
19+ fail-fast : false
20+ matrix :
21+ config :
22+ - name : Slow PyTorch CUDA tests on Ubuntu
23+ framework : pytorch
24+ runner : docker-gpu
25+ image : diffusers/diffusers-pytorch-cuda
26+ report : torch_cuda
27+ - name : Slow Flax TPU tests on Ubuntu
28+ framework : flax
29+ runner : docker-tpu
30+ image : diffusers/diffusers-flax-tpu
31+ report : flax_tpu
32+ - name : Slow ONNXRuntime CUDA tests on Ubuntu
33+ framework : onnxruntime
34+ runner : docker-gpu
35+ image : diffusers/diffusers-onnxruntime-cuda
36+ report : onnx_cuda
37+
38+ name : ${{ matrix.config.name }}
39+
40+ runs-on : ${{ matrix.config.runner }}
41+
2042 container :
21- image : nvcr.io/nvidia/pytorch:22.07-py3
22- options : --gpus 0 --shm-size "16gb" --ipc host -v /mnt/hf_cache:/mnt/cache
43+ image : ${{ matrix.config.image }}
44+ options : --shm-size "16gb" --ipc host -v /mnt/hf_cache:/mnt/cache/ ${{ matrix.config.runner == 'docker-tpu' && '--privileged' || '--gpus 0'}}
45+
46+ defaults :
47+ run :
48+ shell : bash
2349
2450 steps :
2551 - name : Checkout diffusers
@@ -28,44 +54,68 @@ jobs:
2854 fetch-depth : 2
2955
3056 - name : NVIDIA-SMI
57+ if : ${{ matrix.config.runner == 'docker-gpu' }}
3158 run : |
3259 nvidia-smi
3360
3461 - name : Install dependencies
3562 run : |
36- python -m pip install --upgrade pip
37- python -m pip uninstall -y torch torchvision torchtext
38- python -m pip install torch --extra-index-url https://download.pytorch.org/whl/cu117
3963 python -m pip install -e .[quality,test]
4064 python -m pip install git+https://github.com/huggingface/accelerate
4165
4266 - name : Environment
4367 run : |
4468 python utils/print_env.py
4569
46- - name : Run all (incl. slow) tests on GPU
70+ - name : Run slow PyTorch CUDA tests
71+ if : ${{ matrix.config.framework == 'pytorch' }}
72+ env :
73+ HUGGING_FACE_HUB_TOKEN : ${{ secrets.HUGGING_FACE_HUB_TOKEN }}
74+ run : |
75+ python -m pytest -n 1 --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 slow Flax TPU tests
81+ if : ${{ matrix.config.framework == 'flax' }}
4782 env :
4883 HUGGING_FACE_HUB_TOKEN : ${{ secrets.HUGGING_FACE_HUB_TOKEN }}
4984 run : |
50- python -m pytest -n 1 --max-worker-restart=0 --dist=loadfile -s -v --make-reports=tests_torch_gpu tests/
85+ python -m pytest -n 0 \
86+ -s -v -k "Flax" \
87+ --make-reports=tests_${{ matrix.config.report }} \
88+ tests/
89+
90+ - name : Run slow ONNXRuntime CUDA tests
91+ if : ${{ matrix.config.framework == 'onnxruntime' }}
92+ env :
93+ HUGGING_FACE_HUB_TOKEN : ${{ secrets.HUGGING_FACE_HUB_TOKEN }}
94+ run : |
95+ python -m pytest -n 1 --max-worker-restart=0 --dist=loadfile \
96+ -s -v -k "Onnx" \
97+ --make-reports=tests_${{ matrix.config.report }} \
98+ tests/
5199
52100 - name : Failure short reports
53101 if : ${{ failure() }}
54- run : cat reports/tests_torch_gpu_failures_short .txt
102+ run : cat reports/tests_${{ matrix.config.report }}_failures_short .txt
55103
56104 - name : Test suite reports artifacts
57105 if : ${{ always() }}
58106 uses : actions/upload-artifact@v2
59107 with :
60- name : torch_test_reports
108+ name : ${{ matrix.config.report }}_test_reports
61109 path : reports
62110
63- run_examples_single_gpu :
64- name : Examples tests
65- runs-on : [ self-hosted, docker-gpu, single-gpu ]
111+ run_examples_tests :
112+ name : Examples PyTorch CUDA tests on Ubuntu
113+
114+ runs-on : docker-gpu
115+
66116 container :
67- image : nvcr.io/nvidia/ pytorch:22.07-py3
68- options : --gpus 0 --shm-size "16gb" --ipc host -v /mnt/hf_cache:/mnt/cache
117+ image : diffusers/diffusers- pytorch-cuda
118+ options : --gpus 0 --shm-size "16gb" --ipc host -v /mnt/hf_cache:/mnt/cache/
69119
70120 steps :
71121 - name : Checkout diffusers
79129
80130 - name : Install dependencies
81131 run : |
82- python -m pip install --upgrade pip
83- python -m pip uninstall -y torch torchvision torchtext
84- python -m pip install torch --extra-index-url https://download.pytorch.org/whl/cu117
85132 python -m pip install -e .[quality,test,training]
86133 python -m pip install git+https://github.com/huggingface/accelerate
87134
@@ -93,11 +140,11 @@ jobs:
93140 env :
94141 HUGGING_FACE_HUB_TOKEN : ${{ secrets.HUGGING_FACE_HUB_TOKEN }}
95142 run : |
96- python -m pytest -n 1 --max-worker-restart=0 --dist=loadfile -s -v --make-reports=examples_torch_gpu examples/
143+ python -m pytest -n 1 --max-worker-restart=0 --dist=loadfile -s -v --make-reports=examples_torch_cuda examples/
97144
98145 - name : Failure short reports
99146 if : ${{ failure() }}
100- run : cat reports/examples_torch_gpu_failures_short .txt
147+ run : cat reports/examples_torch_cuda_failures_short .txt
101148
102149 - name : Test suite reports artifacts
103150 if : ${{ always() }}
0 commit comments