-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into wenyi5608-greedy-sampling
- Loading branch information
Showing
45 changed files
with
2,760 additions
and
1,637 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
BasedOnStyle: Google | ||
IndentWidth: 4 | ||
UseTab: Never | ||
ColumnLimit: 120 | ||
|
||
Language: Cpp | ||
Standard: Cpp11 | ||
|
||
AccessModifierOffset: -4 | ||
AlignConsecutiveMacros: true | ||
AllowAllArgumentsOnNextLine: false | ||
AllowAllConstructorInitializersOnNextLine: false | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortFunctionsOnASingleLine: Empty | ||
AllowShortIfStatementsOnASingleLine: Never | ||
AllowShortLambdasOnASingleLine: Empty | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakBeforeMultilineStrings: false | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
CommentPragmas: '^#' | ||
DerivePointerAlignment: false | ||
FixNamespaceComments: true | ||
IndentCaseLabels: false | ||
IndentPPDirectives: AfterHash | ||
ForEachMacros: | ||
- foreach | ||
- FOREACH_CHILD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,115 @@ | ||
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 | ||
|
||
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 | ||
- uses: actions/setup-python@v4 | ||
|
||
- name: Setup conda | ||
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
python-version: 3.8 | ||
- name: Install OpenVINO | ||
miniconda-version: "latest" | ||
activate-environment: openvino_sd_cpp | ||
python-version: "3.10" | ||
|
||
- name: Install OpenVINO and other conda dependencies | ||
run: | | ||
set -e | ||
mkdir openvino | ||
curl https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.1.0-14645-e6dc0865128/l_openvino_toolkit_ubuntu20_2024.1.0.dev20240304_x86_64.tgz | tar --directory ./openvino/ --strip-components 1 -xz | ||
sudo ./openvino/install_dependencies/install_openvino_dependencies.sh | ||
- name: Download / convert models | ||
conda activate openvino_sd_cpp | ||
conda install -c conda-forge openvino c-compiler cxx-compiler 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: | | ||
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 | ||
conda activate openvino_sd_cpp | ||
python -m pip install -r requirements.txt | ||
python -m pip install ../../../thirdparty/openvino_tokenizers/[transformers] | ||
- name: Download and convert model and tokenizer | ||
working-directory: ${{ env.working_directory }} | ||
run: | | ||
conda activate openvino_sd_cpp | ||
export MODEL_PATH="models/stable_diffusion_v1_5_ov/FP16" | ||
optimum-cli export openvino --model runwayml/stable-diffusion-v1-5 --task stable-diffusion --convert-tokenizer --weight-format fp16 $MODEL_PATH | ||
convert_tokenizer $MODEL_PATH/tokenizer/ --tokenizer-output-type i32 -o $MODEL_PATH/tokenizer/ | ||
- name: Build app | ||
working-directory: ${{ env.working_directory }} | ||
run: | | ||
set -e | ||
source ./openvino/setupvars.sh | ||
cd ./image_generation/stable_diffusion_1_5/cpp/ | ||
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: | | ||
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 | ||
./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 | ||
- uses: actions/setup-python@v4 | ||
|
||
- name: Setup conda | ||
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
python-version: 3.8 | ||
- name: Initialize OpenVINO | ||
shell: cmd | ||
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 openvino c-compiler cxx-compiler make cmake | ||
- name: Install python dependencies | ||
working-directory: ${{ env.working_directory }} | ||
run: | | ||
curl --output ov.zip https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.1.0-14645-e6dc0865128/w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64.zip | ||
unzip ov.zip | ||
- name: Download / convert a model / tokenizer | ||
shell: cmd | ||
conda activate openvino_sd_cpp | ||
python -m pip install -r requirements.txt | ||
python -m pip install ../../../thirdparty/openvino_tokenizers/[transformers] | ||
- name: Download and convert model and tokenizer | ||
working-directory: ${{ env.working_directory }} | ||
run: | | ||
call w_openvino_toolkit_windows_2024.1.0.dev20240304_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 | ||
conda activate openvino_sd_cpp | ||
$env:MODEL_PATH='models/stable_diffusion_v1_5_ov/FP16' | ||
optimum-cli export openvino --model runwayml/stable-diffusion-v1-5 --task stable-diffusion --convert-tokenizer --weight-format fp16 $env:MODEL_PATH | ||
convert_tokenizer $env:MODEL_PATH/tokenizer/ --tokenizer-output-type i32 -o $env:MODEL_PATH/tokenizer/ | ||
- name: Build app | ||
shell: cmd | ||
working-directory: ${{ env.working_directory }} | ||
run: | | ||
call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64/setupvars.bat | ||
cd ./image_generation/stable_diffusion_1_5/cpp/ | ||
conda activate openvino_sd_cpp | ||
cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ | ||
cmake --build ./build/ --config Release --parallel | ||
- name: Run app | ||
shell: cmd | ||
working-directory: ${{ env.working_directory }} | ||
run: | | ||
call w_openvino_toolkit_windows_2024.1.0.dev20240304_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 | ||
& "./build/Release/stable_diffusion.exe" -m ./models/stable_diffusion_v1_5_ov -t FP16 --dynamic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# build/artifact dirs | ||
_* | ||
[Bb]uild*/ | ||
cmake-build* | ||
|
||
# but ensure we don't skip __init__.py and __main__.py | ||
!__init__.py | ||
!__main__.py | ||
|
||
# developer tools | ||
*.idea | ||
.vscode | ||
.vs/ | ||
.vsconan/ | ||
.DS_Store | ||
**/tags | ||
compile_commands.json | ||
bin/ | ||
.local_vimrc | ||
.gdb_history | ||
.vimspector.json | ||
doc/ | ||
docs/build_documentation/work_dir/ | ||
temp/ | ||
.repo/ | ||
CMakeLists.txt.user | ||
docs/IE_PLUGIN_DG/html/ | ||
CMakeUserPresets.json | ||
|
||
*.project | ||
*.cproject | ||
*.pydevproject | ||
*.settings | ||
*/gen/ | ||
*.swp | ||
/config.xml | ||
|
||
# Python-specific | ||
*.?env* | ||
*.pyc | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
6 changes: 3 additions & 3 deletions
6
image_generation/lcm_dreamshaper_v7/cpp/scripts/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
--extra-index-url https://download.pytorch.org/whl/cpu | ||
torch==2.2.0+cpu | ||
diffusers==0.26.3 | ||
optimum-intel[nncf,openvino]==1.15.2 | ||
torch==2.2.2+cpu | ||
diffusers==0.27.2 | ||
optimum-intel[nncf,openvino]==1.16.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
build | ||
images | ||
models |
Oops, something went wrong.