-
Notifications
You must be signed in to change notification settings - Fork 111
236 lines (228 loc) · 10.5 KB
/
examples.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
name: Run examples
on:
pull_request:
paths-ignore:
- "*.md"
- "**/*.md"
- "LICENSE*"
schedule:
# every 3 hours
- cron: "0 */3 * * *"
env:
CONTAINER_NAME: onediff-test
REGION_ID: cn-beijing
ACR_ORG: registry.cn-beijing.aliyuncs.com/oneflow
COMFYUI_SRC_DIR: ComfyUI
SDXL_BASE: /share_nfs/hf_models/sd_xl_base_1.0.safetensors
UNET_INT8: /share_nfs/hf_models/unet_int8
CONTROL_LORA_OPENPOSEXL2_RANK256: /share_nfs/hf_models/controlnet/control-lora-openposeXL2-rank256.safetensors
SELENIUM_CONTAINER_NAME: selenium-test
SELENIUM_IMAGE: standalone-chrome:119.0-chromedriver-119.0-grid-4.15.0-20231129
concurrency:
group: sd-examples-${{ github.ref }}
cancel-in-progress: true
jobs:
upload_src:
if: github.repository == 'siliconflow/onediff'
runs-on: [ubuntu-latest]
outputs:
onediff_src_url: ${{ steps.upload_to_oss.outputs.onediff_src_url }}
comfy_src_url: ${{ steps.upload_to_oss.outputs.comfy_src_url }}
steps:
- name: Setup ossutil
run: |
curl http://gosspublic.alicdn.com/ossutil/1.7.15/ossutil64 -o ossutil64
sudo chmod +x ossutil64
./ossutil64 config -e oss-cn-beijing.aliyuncs.com -i ${{ secrets.OSS_ACCESS_KEY_ID }} -k ${{ secrets.OSS_ACCESS_KEY_SECRET }} -L EN -c $HOME/.ossutilconfig
- name: Checkout
uses: actions/checkout@v4
with:
path: onediff
- name: Checkout ComfyUI
uses: actions/checkout@v4
with:
repository: comfyanonymous/ComfyUI
path: ComfyUI
- name: Pack src
working-directory: onediff
run: |
git reset --hard
git clean -f
git archive --format zip HEAD > onediff-src.zip
- name: Pack comfy
working-directory: ComfyUI
run: |
git reset --hard
git clean -f
git archive --prefix ${{ env.COMFYUI_SRC_DIR }}/ --format zip HEAD > comfyui-src.zip
- name: Upload src
id: upload_to_oss
run: |
ONEDIFF_DST="oss://gh-src-cache/onediff/${{ github.sha }}/onediff-src.zip"
COMFY_DST="oss://gh-src-cache/onediff/${{ github.sha }}/comfyui-src.zip"
./ossutil64 cp --disable-ignore-error --update onediff/onediff-src.zip ${ONEDIFF_DST}
./ossutil64 cp --disable-ignore-error --update ComfyUI/comfyui-src.zip ${COMFY_DST}
echo "onediff_src_url=${ONEDIFF_DST}" >> $GITHUB_OUTPUT
echo "comfy_src_url=${COMFY_DST}" >> $GITHUB_OUTPUT
run-examples:
name: " ${{ matrix.test-suite }} ${{ matrix.image }}"
runs-on: [self-hosted, cuda]
needs: [upload_src]
strategy:
fail-fast: false
max-parallel: 5
matrix:
image:
- onediff:cu118
- onediff-pro:cu121
test-suite:
- diffusers_examples
- comfy
steps:
- name: Login to ACR with the AccessKey pair
uses: aliyun/acr-login@v1
with:
login-server: https://registry.${{env.REGION_ID}}.aliyuncs.com
username: "${{ secrets.ACR_USERNAME }}"
password: "${{ secrets.ACR_PASSWORD }}"
- name: Fix permissions
run: |
set -x
docker run --rm -v $PWD:$PWD -w $PWD busybox rm -rf *
- name: Setup ossutil
if: github.repository == 'siliconflow/onediff'
run: |
if [ ! -f "$HOME/ossutil64" ]; then
curl http://gosspublic.alicdn.com/ossutil/1.7.15/ossutil64 -o $HOME/ossutil64
chmod +x $HOME/ossutil64
fi
$HOME/ossutil64 config -e oss-cn-beijing.aliyuncs.com -i ${{ secrets.OSS_ACCESS_KEY_ID }} -k ${{ secrets.OSS_ACCESS_KEY_SECRET }} -L EN -c $HOME/.ossutilconfig
- name: Checkout vis OSS
if: github.repository == 'siliconflow/onediff'
run: |
$HOME/ossutil64 cp ${{ needs.upload_src.outputs.onediff_src_url }} .
unzip -o $(basename ${{ needs.upload_src.outputs.onediff_src_url }})
- name: Checkout Comfy vis OSS
if: matrix.test-suite == 'comfy' && github.repository == 'siliconflow/onediff'
run: |
$HOME/ossutil64 cp ${{ needs.upload_src.outputs.comfy_src_url }} .
unzip -o $(basename ${{ needs.upload_src.outputs.comfy_src_url }})
- name: Checkout
if: github.repository != 'siliconflow/onediff'
uses: actions/checkout@v4
- name: Checkout ComfyUI
if: matrix.test-suite == 'comfy' && github.repository != 'siliconflow/onediff'
uses: actions/checkout@v4
with:
repository: comfyanonymous/ComfyUI
path: ${{ env.COMFYUI_SRC_DIR }}
- name: Clean docker containers
run: |
docker rm -f ${{ env.CONTAINER_NAME }} || true
docker rm -f ${{ env.SELENIUM_CONTAINER_NAME }} || true
- run: docker image prune -f
- run: |
docker pull ${{ env.ACR_ORG }}/${{ matrix.image }}
- if: matrix.test-suite == 'comfy'
run: |
docker pull ${{ env.ACR_ORG }}/${{ env.SELENIUM_IMAGE }}
- run: docker image prune -f
- name: Setup docker for ComfyUI Test
if: matrix.test-suite == 'comfy'
run: |
env
docker compose -f tests/comfy-docker-compose.yml up -d
env:
CONTAINER_NAME: ${{ env.CONTAINER_NAME }}
ACR_ORG: ${{ env.ACR_ORG }}
MATRIX_IMAGE: ${{ matrix.image }}
COMFYUI_SRC_DIR: ${{ env.COMFYUI_SRC_DIR }}
SDXL_BASE: ${{ env.SDXL_BASE }}
UNET_INT8: ${{ env.UNET_INT8 }}
SELENIUM_IMAGE: ${{ env.SELENIUM_IMAGE }}
SELENIUM_CONTAINER_NAME: ${{ env.SELENIUM_CONTAINER_NAME }}
SILICON_ONEDIFF_LICENSE_KEY: ${{ secrets.SILICON_ONEDIFF_LICENSE_KEY }}
- name: Setup docker for diffusers examples
if: matrix.test-suite == 'diffusers_examples'
run: |
env
docker compose -f tests/diffusers-docker-compose.yml up -d
env:
CONTAINER_NAME: ${{ env.CONTAINER_NAME }}
ACR_ORG: ${{ env.ACR_ORG }}
MATRIX_IMAGE: ${{ matrix.image }}
SDXL_BASE: ${{ env.SDXL_BASE }}
UNET_INT8: ${{ env.UNET_INT8 }}
SILICON_ONEDIFF_LICENSE_KEY: ${{ secrets.SILICON_ONEDIFF_LICENSE_KEY }}
- run: nvidia-smi
- run: nvidia-smi -L
- run: docker exec ${{ env.CONTAINER_NAME }} python3 -m oneflow --doctor
- run: docker exec ${{ env.CONTAINER_NAME }} python3 -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
- name: Pip Install Requirements for ComfyUI & Test
if: matrix.test-suite == 'comfy'
run: |
docker exec ${{ env.CONTAINER_NAME }} python3 -m pip install -r tests/comfyui/requirements.txt --user
docker exec ${{ env.CONTAINER_NAME }} python3 -m pip install -r ComfyUI/requirements.txt --user
- name: Print pip package versions
run: |
docker exec ${{ env.CONTAINER_NAME }} python3 -m pip list
- name: Start ComfyUI Web Service
if: matrix.test-suite == 'comfy'
run: |
docker exec -w /app/ComfyUI -d ${{ env.CONTAINER_NAME }} sh -c "python3 /app/ComfyUI/main.py --port 8188 > /app/ComfyUI/onediff_comfyui.log 2>&1"
sleep 30
# print to check if comfy is launched successfully
- run: docker exec ${{ env.CONTAINER_NAME }} ps aux
- name: Test ComfyUI
if: matrix.test-suite == 'comfy'
run: |
run_comfy_test() {
local workflow_name="$1"
docker exec -w /src/onediff/tests/comfyui ${{ env.CONTAINER_NAME }} python3 test_by_ui.py --comfy_port 8188 --workflow "$workflow_name" || {
docker exec ${{ env.CONTAINER_NAME }} cat /app/ComfyUI/onediff_comfyui.log
false
}
}
run_comfy_test "workflows/sdxl-unet-speedup-graph-saver.json"
run_comfy_test "workflows/sdxl-control-lora-speedup.json"
- name: Show ComfyUI Log
if: matrix.test-suite == 'comfy'
run: |
docker exec ${{ env.CONTAINER_NAME }} cat /app/ComfyUI/onediff_comfyui.log
- if: matrix.test-suite == 'diffusers_examples'
run: docker exec ${{ env.CONTAINER_NAME }} python3 examples/text_to_image.py --model_id=/share_nfs/hf_models/stable-diffusion-v1-5
- if: matrix.test-suite == 'diffusers_examples'
run: docker exec ${{ env.CONTAINER_NAME }} python3 examples/image_to_image.py --model_id=/share_nfs/hf_models/stable-diffusion-2-1
- if: matrix.test-suite == 'diffusers_examples'
run: docker exec ${{ env.CONTAINER_NAME }} python3 examples/text_to_image_sdxl.py --base /share_nfs/hf_models/stable-diffusion-xl-base-1.0 --compile_vae False --height 512 --width 512
- if: matrix.test-suite == 'diffusers_examples'
run: docker exec ${{ env.CONTAINER_NAME }} python3 examples/text_to_image_sdxl.py --base /share_nfs/hf_models/stable-diffusion-xl-base-1.0 --compile_unet False --height 512 --width 512 --run_multiple_resolutions True
- if: matrix.test-suite == 'diffusers_examples'
run: docker exec ${{ env.CONTAINER_NAME }} python3 examples/text_to_image_controlnet.py --base=/share_nfs/hf_models/stable-diffusion-v1-5 --controlnet=/share_nfs/hf_models/sd-controlnet-canny --input_image=/share_nfs/hf_models/input_image_vermeer.png
- if: matrix.test-suite == 'diffusers_examples'
run: docker exec ${{ env.CONTAINER_NAME }} bash examples/unet_save_and_load.sh --model_id=/share_nfs/hf_models/stable-diffusion-2-1
- name: Shutdown docker for ComfyUI Test
if: matrix.test-suite == 'comfy'
run: |
docker compose -f tests/comfy-docker-compose.yml down
env:
CONTAINER_NAME: ${{ env.CONTAINER_NAME }}
ACR_ORG: ${{ env.ACR_ORG }}
MATRIX_IMAGE: ${{ matrix.image }}
COMFYUI_SRC_DIR: ${{ env.COMFYUI_SRC_DIR }}
SDXL_BASE: ${{ env.SDXL_BASE }}
UNET_INT8: ${{ env.UNET_INT8 }}
SELENIUM_IMAGE: ${{ env.SELENIUM_IMAGE }}
SELENIUM_CONTAINER_NAME: ${{ env.SELENIUM_CONTAINER_NAME }}
SILICON_ONEDIFF_LICENSE_KEY: ${{ secrets.SILICON_ONEDIFF_LICENSE_KEY }}
- name: Shutdown docker for diffusers examples
if: matrix.test-suite == 'diffusers_examples'
run: |
docker compose -f tests/diffusers-docker-compose.yml down
env:
CONTAINER_NAME: ${{ env.CONTAINER_NAME }}
ACR_ORG: ${{ env.ACR_ORG }}
MATRIX_IMAGE: ${{ matrix.image }}
SDXL_BASE: ${{ env.SDXL_BASE }}
UNET_INT8: ${{ env.UNET_INT8 }}
SILICON_ONEDIFF_LICENSE_KEY: ${{ secrets.SILICON_ONEDIFF_LICENSE_KEY }}