Skip to content
name: stable_diffusion_1_5_cpp
on:
pull_request:
paths:
- image_generation/stable_diffusion_1_5/cpp/**
- image_generation/common/**
- .github/workflows/stable_diffusion_1_5_cpp.yml
- thirdparty/openvino_tokenizers
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
stable_diffusion_1_5_cpp-linux:
runs-on: ubuntu-20.04-8-cores
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install OpenVINO
run: |
set -e
mkdir openvino
curl https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.3/linux/l_openvino_toolkit_ubuntu20_2023.3.0.13775.ceeafaf64f3_x86_64.tgz | tar --directory ./openvino/ --strip-components 1 -xz
sudo ./openvino/install_dependencies/install_openvino_dependencies.sh
- name: Download / convert models
run: |
set -e
source ./openvino/setupvars.sh
cd ./image_generation/stable_diffusion_1_5/cpp/scripts/
python -m pip install -U pip
python -m pip install -r ./requirements.txt
python -m pip install ../../../../thirdparty/openvino_tokenizers/
python convert_model.py -sd runwayml/stable-diffusion-v1-5 -b 1 -t FP16 -dyn True
- name: Build app
run: |
set -e
source ./openvino/setupvars.sh
cd ./image_generation/stable_diffusion_1_5/cpp/
cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/
cmake --build ./build/ --config Release --parallel
- name: Run app
run: |
set -e
source ./openvino/setupvars.sh
cd ./image_generation/stable_diffusion_1_5/cpp/build
./stable_diffusion -m ../scripts/runwayml/stable-diffusion-v1-5 -t FP16_dyn
stable_diffusion_1_5_cpp-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Initialize OpenVINO
shell: cmd
run: |
curl --output ov.zip https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.3/windows/w_openvino_toolkit_windows_2023.3.0.13775.ceeafaf64f3_x86_64.zip
unzip ov.zip
- name: Download / convert a model / tokenizer
shell: cmd
run: |
call w_openvino_toolkit_windows_2023.3.0.13775.ceeafaf64f3_x86_64/setupvars.bat
cd ./image_generation/stable_diffusion_1_5/cpp/scripts/
python -m pip install -r ./requirements.txt
python -m pip install ../../../../thirdparty/openvino_tokenizers/
python convert_model.py -sd runwayml/stable-diffusion-v1-5 -b 1 -t FP16 -dyn True
- name: Build app
shell: cmd
run: |
call w_openvino_toolkit_windows_2023.3.0.13775.ceeafaf64f3_x86_64/setupvars.bat
cd ./image_generation/stable_diffusion_1_5/cpp/
cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/
cmake --build ./build/ --config Release --parallel
- name: Run app
shell: cmd
run: |
call w_openvino_toolkit_windows_2023.3.0.13775.ceeafaf64f3_x86_64/setupvars.bat
cd ./image_generation/stable_diffusion_1_5/cpp/build/
call "./Release/stable_diffusion.exe" -m ../scripts/runwayml/stable-diffusion-v1-5 -t FP16_dyn