forked from openvinotoolkit/openvino.genai
-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (93 loc) · 4.04 KB
/
stable_diffusion_1_5_cpp.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
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
- "!**.md"
env:
working_directory: "./image_generation/stable_diffusion_1_5/cpp/"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
stable_diffusion_1_5_cpp-linux:
runs-on: ubuntu-20.04-8-cores
defaults:
run:
# Do not ignore bash profile files. From:
# https://github.com/marketplace/actions/setup-miniconda#important
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup conda
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
activate-environment: openvino_sd_cpp
python-version: "3.10"
- name: Install OpenVINO and other conda dependencies
run: |
conda activate openvino_sd_cpp
conda install -c conda-forge -c conda-forge/label/openvino_dev openvino==2024.2.0.dev20240513 c-compiler cxx-compiler git make cmake
conda env config vars set LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH
- name: Install python dependencies
working-directory: ${{ env.working_directory }}
run: |
conda activate openvino_sd_cpp
python -m pip install ../../../thirdparty/openvino_tokenizers/[transformers]
python -m pip install -r requirements.txt
- name: Download and convert model and tokenizer
working-directory: ${{ env.working_directory }}
run: |
conda activate openvino_sd_cpp
optimum-cli export openvino --model runwayml/stable-diffusion-v1-5 --task stable-diffusion --weight-format fp16 models/stable_diffusion_v1_5_ov/FP16
- name: Build app
working-directory: ${{ env.working_directory }}
run: |
conda activate openvino_sd_cpp
cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/
cmake --build ./build/ --config Release --parallel
- name: Run app
working-directory: ${{ env.working_directory }}
run: ./build/stable_diffusion -m ./models/stable_diffusion_v1_5_ov -t FP16
stable_diffusion_1_5_cpp-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup conda
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
activate-environment: openvino_sd_cpp
python-version: "3.10"
- name: Install OpenVINO and other conda dependencies
run: |
conda activate openvino_sd_cpp
conda install -c conda-forge -c conda-forge/label/openvino_dev openvino==2024.2.0.dev20240513 c-compiler cxx-compiler git make cmake
- name: Install python dependencies
working-directory: ${{ env.working_directory }}
run: |
conda activate openvino_sd_cpp
python -m pip install ../../../thirdparty/openvino_tokenizers/[transformers]
python -m pip install -r requirements.txt
- name: Download and convert model and tokenizer
working-directory: ${{ env.working_directory }}
run: |
conda activate openvino_sd_cpp
optimum-cli export openvino --model runwayml/stable-diffusion-v1-5 --task stable-diffusion --weight-format fp16 models/stable_diffusion_v1_5_ov/FP16
- name: Build app
working-directory: ${{ env.working_directory }}
run: |
conda activate openvino_sd_cpp
cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/
cmake --build ./build/ --config Release --parallel
- name: Run app
working-directory: ${{ env.working_directory }}
run: '& "./build/Release/stable_diffusion.exe" -m ./models/stable_diffusion_v1_5_ov -t FP16 --dynamic'