Skip to content

Fix redundant warning printing #2530

Fix redundant warning printing

Fix redundant warning printing #2530

Workflow file for this run

name: CI testing
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: Install onediff-quant if needed
if: startsWith(matrix.image, 'onediff-pro')
run: |
docker exec ${{ env.CONTAINER_NAME }} python3 -m pip install --pre onediff-quant -f https://oneflow-pro.oss-cn-beijing.aliyuncs.com/onediff-quant/
- 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 --extra-model-paths-config /src/onediff/tests/comfyui/extra_model_paths.yaml > /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"
local timeout=$2
docker exec -w /src/onediff/tests/comfyui ${{ env.CONTAINER_NAME }} python3 test_by_ui.py --comfy_port 8188 --workflow "$workflow_name" --timeout $timeout || {
echo "test_by_ui.py fails! print the ComfyUI logs..."
docker exec ${{ env.CONTAINER_NAME }} cat /app/ComfyUI/onediff_comfyui.log
false
}
}
run_comfy_test "workflows/sdxl-unet-speedup-graph-saver.json" 200
run_comfy_test "workflows/sdxl-control-lora-speedup.json" 200
run_comfy_test "/share_nfs/hf_models/comfyui_resources/workflows/deep-cache.json" 600
run_comfy_test "/share_nfs/hf_models/comfyui_resources/workflows/deep-cache-with-lora.json" 800
# run_comfy_test "workflows/text-to-video-speedup.json" 5000
- name: Show ComfyUI Log
if: matrix.test-suite == 'comfy'
run: |
docker exec ${{ env.CONTAINER_NAME }} cat /app/ComfyUI/onediff_comfyui.log
- name: Setup OneDiff diffusers extension
if: matrix.test-suite == 'diffusers_examples'
run: |
docker exec -w /src/onediff/onediff_diffusers_extensions ${{ env.CONTAINER_NAME }} python3 -m pip install -e .
- if: matrix.test-suite == 'diffusers_examples' && startsWith(matrix.image, 'onediff-pro')
run: docker exec -w /src/onediff/onediff_diffusers_extensions ${{ env.CONTAINER_NAME }} python3 examples/text_to_image_sdxl_enterprise.py --model /share_nfs/hf_models/stable-diffusion-xl-base-1.0-int8 --width 512 --height 512 --saved_image output_enterprise_sdxl.png
- if: matrix.test-suite == 'diffusers_examples' && startsWith(matrix.image, 'onediff-pro')
run: docker exec -w /src/onediff/onediff_diffusers_extensions ${{ env.CONTAINER_NAME }} python3 examples/text_to_image_deep_cache_sd_sdxl_enterprise.py --model /share_nfs/stable-diffusion-xl-base-1.0-int8-deep-cache --model_type sdxl --width 512 --height 512 --saved_image output_enterprise_deepcache_sdxl.png
- if: matrix.test-suite == 'diffusers_examples' && startsWith(matrix.image, 'onediff-pro')
run: docker exec -w /src/onediff/onediff_diffusers_extensions ${{ env.CONTAINER_NAME }} python3 examples/text_to_image_deep_cache_sdxl.py --base /share_nfs/hf_models/stable-diffusion-xl-base-1.0 --width 512 --height 512 --run_multiple_resolutions true --saved_image deepcache_sdxl.png
- if: matrix.test-suite == 'diffusers_examples'
run: docker exec -w /src/onediff/onediff_diffusers_extensions ${{ 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 -w /src/onediff/onediff_diffusers_extensions ${{ 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 -w /src/onediff/onediff_diffusers_extensions ${{ 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 -w /src/onediff/onediff_diffusers_extensions ${{ 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 -w /src/onediff/onediff_diffusers_extensions ${{ env.CONTAINER_NAME }} bash examples/save_and_load_pipeline.sh
- if: matrix.test-suite == 'diffusers_examples'
run: docker exec -w /src/onediff/onediff_diffusers_extensions ${{ 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 -w /src/onediff/onediff_diffusers_extensions ${{ env.CONTAINER_NAME }} bash examples/unet_save_and_load.sh --model_id=/share_nfs/hf_models/stable-diffusion-2-1
- if: matrix.test-suite == 'diffusers_examples'
run: docker exec -w /src/onediff/onediff_diffusers_extensions ${{ env.CONTAINER_NAME }} python3 examples/text_to_image_sdxl_turbo.py --compile true --base /share_nfs/hf_models/sdxl-turbo
- if: matrix.test-suite == 'diffusers_examples'
run: docker exec -e ONEFLOW_MLIR_ENABLE_INFERENCE_OPTIMIZATION=0 ${{ env.CONTAINER_NAME }} python3 -m pytest -v onediff_diffusers_extensions/tests/test_lora.py
# - if: matrix.test-suite == 'diffusers_examples'
# run: docker exec -w /src/onediff/onediff_diffusers_extensions -e ONEFLOW_MLIR_ENABLE_INFERENCE_OPTIMIZATION=0 ${{ env.CONTAINER_NAME }} python3 examples/text_to_image_sdxl_reuse_pipe.py --base /share_nfs/hf_models/stable-diffusion-xl-base-1.0 --new_base /share_nfs/hf_models/dataautogpt3-OpenDalleV1.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 }}