Skip to content

Commit

Permalink
Merge branch 'master' into generate_pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-esir authored May 14, 2024
2 parents d393f89 + 234ad87 commit 2b8954d
Show file tree
Hide file tree
Showing 31 changed files with 1,052 additions and 568 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ updates:
directory: "image_generation/lcm_dreamshaper_v7/cpp/scripts/"
schedule:
interval: "weekly"
- package-ecosystem: "pip"
directory: "text_generation/causal_lm/cpp/"
schedule:
interval: "weekly"
16 changes: 16 additions & 0 deletions .github/workflows/bandit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: python -m bandit --recursive --configfile bandit.yml .
on:
pull_request:
paths-ignore:
- 'thirdparty'
- '**.md'
jobs:
bandit:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.11
- run: python -m pip install bandit
- run: python -m bandit --recursive --configfile bandit.yml .
150 changes: 79 additions & 71 deletions .github/workflows/causal_lm_cpp.yml

Large diffs are not rendered by default.

138 changes: 85 additions & 53 deletions .github/workflows/lcm_dreamshaper_cpp.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: lcm_dreamshaper

on:
pull_request:
paths:
Expand All @@ -7,75 +8,106 @@ on:
- .github/workflows/lcm_dreamshaper_cpp.yml
- thirdparty/openvino_tokenizers
- "!**.md"

env:
working_directory: "./image_generation/lcm_dreamshaper_v7/cpp/"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lcm_dreamshaper_v7_cpp-linux:
runs-on: ubuntu-20.04
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: Initialize OpenVINO
miniconda-version: "latest"
activate-environment: openvino_lcm_cpp
python-version: "3.10"

- name: Install OpenVINO and other conda dependencies
run: |
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 a model / tokenizer
conda activate openvino_lcm_cpp
conda update -c conda-forge --all
conda install -c conda-forge openvino=2024.1.0 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: |
source ./openvino/setupvars.sh
cd ./image_generation/lcm_dreamshaper_v7/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 -lcm "SimianLuo/LCM_Dreamshaper_v7" -t "FP16"
conda activate openvino_lcm_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_lcm_cpp
optimum-cli export openvino --model SimianLuo/LCM_Dreamshaper_v7 --weight-format fp16 models/lcm_dreamshaper_v7/FP16
- name: Build app
working-directory: ${{ env.working_directory }}
run: |
source ./openvino/setupvars.sh
cd ./image_generation/lcm_dreamshaper_v7/cpp/
conda activate openvino_lcm_cpp
cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/
cmake --build ./build/ --config Release --parallel
- name: Run app
run: |
source ./openvino/setupvars.sh
cd ./image_generation/lcm_dreamshaper_v7/cpp/build/
./lcm_dreamshaper
working-directory: ${{ env.working_directory }}
run: ./build/lcm_dreamshaper

lcm_dreamshaper_v7_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/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
run: |
call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64/setupvars.bat
cd ./image_generation/lcm_dreamshaper_v7/cpp/scripts/
python -m pip install -r ./requirements.txt
python -m pip install ../../../../thirdparty/openvino_tokenizers/
python convert_model.py -lcm "SimianLuo/LCM_Dreamshaper_v7" -t "FP16"
- name: Build app
shell: cmd
run: |
call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64/setupvars.bat
cd ./image_generation/lcm_dreamshaper_v7/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_2024.1.0.dev20240304_x86_64/setupvars.bat
cd ./image_generation/lcm_dreamshaper_v7/cpp/build/
call "./Release/lcm_dreamshaper.exe"
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_lcm_cpp
python-version: "3.10"

- name: Install OpenVINO and other conda dependencies
run: |
conda activate openvino_lcm_cpp
conda update -c conda-forge --all
conda install -c conda-forge openvino=2024.1.0 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_lcm_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_lcm_cpp
optimum-cli export openvino --model SimianLuo/LCM_Dreamshaper_v7 --weight-format fp16 models/lcm_dreamshaper_v7/FP16
- name: Build app
working-directory: ${{ env.working_directory }}
run: |
conda activate openvino_lcm_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/lcm_dreamshaper.exe" -r --dynamic'
18 changes: 6 additions & 12 deletions .github/workflows/stable_diffusion_1_5_cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Install OpenVINO and other conda dependencies
run: |
conda activate openvino_sd_cpp
conda install -c conda-forge openvino=2024.0.0 c-compiler cxx-compiler make cmake
conda install -c conda-forge openvino=2024.1.0 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
Expand All @@ -53,9 +53,7 @@ jobs:
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/
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 }}
Expand All @@ -66,8 +64,7 @@ jobs:
- name: Run app
working-directory: ${{ env.working_directory }}
run: |
./build/stable_diffusion -m ./models/stable_diffusion_v1_5_ov -t FP16
run: ./build/stable_diffusion -m ./models/stable_diffusion_v1_5_ov -t FP16

stable_diffusion_1_5_cpp-windows:
runs-on: windows-latest
Expand All @@ -86,7 +83,7 @@ jobs:
- name: Install OpenVINO and other conda dependencies
run: |
conda activate openvino_sd_cpp
conda install -c conda-forge openvino=2024.0.0 c-compiler cxx-compiler make cmake
conda install -c conda-forge openvino=2024.1.0 c-compiler cxx-compiler git make cmake
- name: Install python dependencies
working-directory: ${{ env.working_directory }}
Expand All @@ -99,9 +96,7 @@ jobs:
working-directory: ${{ env.working_directory }}
run: |
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/
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 }}
Expand All @@ -112,5 +107,4 @@ jobs:
- name: Run app
working-directory: ${{ env.working_directory }}
run: |
& "./build/Release/stable_diffusion.exe" -m ./models/stable_diffusion_v1_5_ov -t FP16 --dynamic
run: '& "./build/Release/stable_diffusion.exe" -m ./models/stable_diffusion_v1_5_ov -t FP16 --dynamic'
Loading

0 comments on commit 2b8954d

Please sign in to comment.