Skip to content

Commit

Permalink
[GHA] Small improvements (#1030)
Browse files Browse the repository at this point in the history
- Unify environment setting across workflows
  • Loading branch information
ilya-lavrenov authored Oct 21, 2024
1 parent 5c55f29 commit b85991e
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 42 deletions.
55 changes: 35 additions & 20 deletions .github/workflows/causal_lm_cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ on:
- 'releases/**'

permissions: read-all # Required by https://github.com/ossf/scorecard/blob/e23b8ad91fd6a64a0a971ca4fc0a4d1650725615/docs/checks.md#token-permissions

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# github.ref is not unique in post-commit
group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-causal-lm-cpp
cancel-in-progress: true

env:
Expand Down Expand Up @@ -49,17 +51,20 @@ jobs:
optimum-cli export openvino --trust-remote-code --weight-format fp16 --model openlm-research/open_llama_3b_v2 open_llama_3b_v2
- run: >
. ./ov/setupvars.sh
&& PYTHONPATH=./build/:$PYTHONPATH timeout 25s
./build/samples/cpp/multinomial_causal_lm/multinomial_causal_lm ./open_llama_3b_v2/ a
&& timeout 25s ./build/samples/cpp/multinomial_causal_lm/multinomial_causal_lm ./open_llama_3b_v2/ a
env:
PYTHONPATH: "./build"
- run: >
. ./ov/setupvars.sh
&& PYTHONPATH=./build/:$PYTHONPATH timeout 25s
./samples/python/multinomial_causal_lm/multinomial_causal_lm.py ./open_llama_3b_v2/ b
&& timeout 25s ./samples/python/multinomial_causal_lm/multinomial_causal_lm.py ./open_llama_3b_v2/ b
env:
PYTHONPATH: "./build"
- run: >
. ./ov/setupvars.sh
&& export PYTHONPATH=./build/:$PYTHONPATH
&& timeout 25s ./build/samples/cpp/greedy_causal_lm/greedy_causal_lm ./open_llama_3b_v2/ "return 0"
| diff <(timeout 25s samples/python/greedy_causal_lm/greedy_causal_lm.py ./open_llama_3b_v2/ "return 0") -
env:
PYTHONPATH: "./build"
cpp-beam_search_causal_lm-ubuntu:
strategy:
Expand Down Expand Up @@ -97,10 +102,10 @@ jobs:
python -m pip install ./thirdparty/openvino_tokenizers/[transformers] --pre --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly
optimum-cli export openvino --trust-remote-code --weight-format fp16 --model TinyLlama/TinyLlama-1.1B-Chat-v1.0 TinyLlama-1.1B-Chat-v1.0
- name: Compare
env:
PYTHONPATH: "./build/" # C++ ignores that
run: |
source ./ov/setupvars.sh
export PYTHONPATH=./build/:$PYTHONPATH # C++ ignores that
timeout 25s ${{ matrix.executable }} ./TinyLlama-1.1B-Chat-v1.0/ "Why is the Sun yellow?" > ./pred.txt
python -c "
import transformers
Expand Down Expand Up @@ -285,8 +290,9 @@ jobs:
optimum-cli export openvino --trust-remote-code --weight-format fp16 --model Qwen/Qwen-7B-Chat Qwen-7B-Chat
- run: >
. ./ov/setupvars.sh
&& export PYTHONPATH=./build/:$PYTHONPATH
&& timeout 2m ./build/samples/cpp/greedy_causal_lm/greedy_causal_lm ./Qwen-7B-Chat/ 69 | diff <(timeout 2m samples/python/greedy_causal_lm/greedy_causal_lm.py ./Qwen-7B-Chat/ 69) -
env:
PYTHONPATH: "./build"
cpp-beam_search_causal_lm-Qwen1_5-7B-Chat:
runs-on: ubuntu-20.04-16-cores
Expand Down Expand Up @@ -318,9 +324,10 @@ jobs:
optimum-cli export openvino --trust-remote-code --weight-format fp16 --model Qwen/Qwen1.5-7B-Chat Qwen1.5-7B-Chat
- run: >
. ./ov/setupvars.sh
&& export PYTHONPATH=./build/:$PYTHONPATH
&& timeout 50s ./build/samples/cpp/beam_search_causal_lm/beam_search_causal_lm ./Qwen1.5-7B-Chat/ "你好!"
| diff <(timeout 50s ./samples/python/beam_search_causal_lm/beam_search_causal_lm.py ./Qwen1.5-7B-Chat/ "你好!") -
env:
PYTHONPATH: "./build"
cpp-beam_search_causal_lm-Phi-2:
runs-on: ubuntu-20.04-16-cores
Expand Down Expand Up @@ -352,9 +359,10 @@ jobs:
optimum-cli export openvino --trust-remote-code --weight-format fp16 --model microsoft/phi-2 phi-2
- run: >
. ./ov/setupvars.sh
&& export PYTHONPATH=./build/:$PYTHONPATH
&& timeout 50s ./build/samples/cpp/beam_search_causal_lm/beam_search_causal_lm ./phi-2/ 69
| diff <(timeout 50s ./samples/python/beam_search_causal_lm/beam_search_causal_lm.py ./phi-2/ 69) -
env:
PYTHONPATH: "./build"
cpp-beam_search_causal_lm-notus-7b-v1:
runs-on: ubuntu-20.04-16-cores
Expand Down Expand Up @@ -386,9 +394,10 @@ jobs:
optimum-cli export openvino --trust-remote-code --weight-format fp16 --model argilla/notus-7b-v1 notus-7b-v1
- run: >
. ./ov/setupvars.sh
&& export PYTHONPATH=./build/:$PYTHONPATH
&& timeout 50s ./build/samples/cpp/beam_search_causal_lm/beam_search_causal_lm ./notus-7b-v1/ 69
| diff <(timeout 50s ./samples/python/beam_search_causal_lm/beam_search_causal_lm.py ./notus-7b-v1/ 69) -
env:
PYTHONPATH: "./build"
cpp-speculative_decoding_lm-ubuntu:
runs-on: ubuntu-20.04-16-cores
Expand Down Expand Up @@ -503,7 +512,6 @@ jobs:
./build/samples/cpp/prompt_lookup_decoding_lm/prompt_lookup_decoding_lm ./Qwen-7B-Chat/ "$(<prompt.txt)" > predictions_prompt_lookup.txt
./build/samples/cpp/greedy_causal_lm/greedy_causal_lm ./Qwen-7B-Chat/ "$(<prompt.txt)" > predictions_greedy.txt
python -c "
with open('predictions_greedy.txt', 'r') as f:
predicted_greedy = f.readline()
Expand Down Expand Up @@ -563,9 +571,10 @@ jobs:
echo Phi-1_5 passed
- run: >
. ./ov/setupvars.sh
&& export PYTHONPATH=./build/:$PYTHONPATH
&& timeout 50s samples/python/greedy_causal_lm/greedy_causal_lm.py ./phi-1_5/ "Alan Turing was a"
| diff ./pred_greedy.txt -
env:
PYTHONPATH: "./build"
cpp-greedy_causal_lm-redpajama-3b-chat:
runs-on: ubuntu-20.04-4-cores
Expand Down Expand Up @@ -617,9 +626,10 @@ jobs:
echo "Alan Turing was a" passed
- run: >
. ./ov/setupvars.sh
&& export PYTHONPATH=./build/:$PYTHONPATH
&& timeout 50s samples/python/greedy_causal_lm/greedy_causal_lm.py ./redpajama-3b-chat/ "Alan Turing was a"
| diff ./pred_greedy.txt -
env:
PYTHONPATH: "./build"
cpp-chat_sample-ubuntu:
runs-on: ubuntu-24.04
Expand Down Expand Up @@ -650,6 +660,8 @@ jobs:
python -m pip install ./thirdparty/openvino_tokenizers/[transformers] --pre --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly
optimum-cli export openvino --trust-remote-code --weight-format fp16 --model TinyLlama/TinyLlama-1.1B-Chat-v1.0 TinyLlama-1.1B-Chat-v1.0
- name: Compare
env:
PYTHONPATH: "./build"
run: |
source ./ov/setupvars.sh
printf 'What is 2 + 2?\nWhat is the previous answer?\nAdd 1 to it.\nSubtract 5 from it.\nWhy is the sun yellow?\nWhat was my first question?\n' > ./input.txt
Expand Down Expand Up @@ -682,11 +694,11 @@ jobs:
"
diff pred.txt ref.txt
echo "Chat sample cpp" passed
export PYTHONPATH=./build/:$PYTHONPATH
timeout 30s ./samples/python/chat_sample/chat_sample.py ./TinyLlama-1.1B-Chat-v1.0/ < input.txt > ./pred2.txt
diff pred2.txt ref.txt
echo "Chat sample python" passed
visual_language_chat_sample-ubuntu:
runs-on: ubuntu-22.04-16-cores
steps:
Expand Down Expand Up @@ -757,9 +769,10 @@ jobs:
- name: Run visual_language_chat Python sample - MiniCPM-V-2_6
run: >
source ./ov/setupvars.sh
&& PYTHONPATH=./build/:$PYTHONPATH
./samples/python/visual_language_chat/visual_language_chat.py ./MiniCPM-V-2_6/ ./images/
&& ./samples/python/visual_language_chat/visual_language_chat.py ./MiniCPM-V-2_6/ ./images/
<<< $'Describe the images?' | tee py.txt
env:
PYTHONPATH: "./build/"
- run: diff py.txt ref.txt
- name: Run visual_language_chat C++ sample with 2 prompts - MiniCPM-V-2_6
run: >
Expand All @@ -770,9 +783,10 @@ jobs:
- name: Run visual_language_chat Python sample with 2 prompts - MiniCPM-V-2_6
run: >
source ./ov/setupvars.sh
&& PYTHONPATH=./build/:$PYTHONPATH
./samples/python/visual_language_chat/visual_language_chat.py ./MiniCPM-V-2_6/ ./cat.jpg
&& ./samples/python/visual_language_chat/visual_language_chat.py ./MiniCPM-V-2_6/ ./cat.jpg
<<< $'What is unusual on this image?\nGo on.' | tee py2.txt
env:
PYTHONPATH: "./build/"
- run: diff cpp2.txt py2.txt
- name: Download and convert LLaVa 1.5 model and an image
run: |
Expand All @@ -797,6 +811,7 @@ jobs:
<<< $'Who drew this painting?\nWhen did the painter live?'
timeout-minutes: 4


cpp-continuous-batching-ubuntu:
runs-on: ubuntu-20.04-8-cores
defaults:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/lcm_dreamshaper_cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ on:

permissions: read-all # Required by https://github.com/ossf/scorecard/blob/e23b8ad91fd6a64a0a971ca4fc0a4d1650725615/docs/checks.md#token-permissions

concurrency:
# github.ref is not unique in post-commit
group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-lcm-dreamshaper-cpp
cancel-in-progress: true

env:
PYTHON_VERSION: '3.9'
LINUX_OV_ARCHIVE_URL: https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.5.0-17053-939b35a9629/l_openvino_toolkit_ubuntu22_2024.5.0.dev20241018_x86_64.tgz
WINDOWS_OV_ARCHIVE_URL: https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.5.0-17053-939b35a9629/w_openvino_toolkit_windows_2024.5.0.dev20241018_x86_64.zip
OV_INSTALL_DIR: ${{ github.workspace }}/ov

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

jobs:
lcm_dreamshaper_v7_cpp-linux:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -78,7 +79,6 @@ jobs:
python ./samples/python/text2image/main.py ./models/lcm_dreamshaper_v7/FP16 "cyberpunk cityscape like Tokyo New York with tall buildings at dusk golden hour cinematic lighting"
env:
PYTHONPATH: ${{ env.build_dir }}
LD_LIBRARY_PATH: ${{ env.build_dir }}/openvino_genai

lcm_dreamshaper_v7_cpp-windows:
runs-on: windows-2019
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
- master
- 'releases/**'

permissions: read-all # Required by https://github.com/ossf/scorecard/blob/e23b8ad91fd6a64a0a971ca4fc0a4d1650725615/docs/checks.md#token-permissions

concurrency:
# github.ref is not unique in post-commit
group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-linux
Expand All @@ -18,8 +20,6 @@ env:
OV_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref || github.ref }}
OV_TARBALL: ''

permissions: read-all # Required by https://github.com/ossf/scorecard/blob/e23b8ad91fd6a64a0a971ca4fc0a4d1650725615/docs/checks.md#token-permissions

jobs:
openvino_download:
name: Download OpenVINO package
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/llm_bench-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

name: llm_bench Python Test

env:
LLM_BENCH_PYPATH: tools/llm_bench
WWB_PATH: tools/who_what_benchmark

on:
push:
branches: [ "master" ]
Expand All @@ -21,6 +17,15 @@ on:

permissions: read-all # Required by https://github.com/ossf/scorecard/blob/e23b8ad91fd6a64a0a971ca4fc0a4d1650725615/docs/checks.md#token-permissions

concurrency:
# github.ref is not unique in post-commit
group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-llm-bench-python
cancel-in-progress: true

env:
LLM_BENCH_PYPATH: tools/llm_bench
WWB_PATH: tools/who_what_benchmark

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -57,9 +62,10 @@ jobs:
path: llm.bench_diff.diff
- name: Test native pytorch model on Linux
run: |
export GIT_LFS_SKIP_SMUDGE=0
git clone --depth 1 https://huggingface.co/katuni4ka/tiny-random-qwen
python ./tools/llm_bench/benchmark.py -m tiny-random-qwen -d cpu -n 1 -f pt
env:
GIT_LFS_SKIP_SMUDGE: 0
- name: Test tiny-random-baichuan2 on Linux
run: |
optimum-cli export openvino --model katuni4ka/tiny-random-baichuan2 --trust-remote-code --weight-format fp16 ./ov_models/tiny-random-baichuan2/pytorch/dldt/FP16
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
- master
- 'releases/**'

permissions: read-all # Required by https://github.com/ossf/scorecard/blob/e23b8ad91fd6a64a0a971ca4fc0a4d1650725615/docs/checks.md#token-permissions

concurrency:
# github.ref is not unique in post-commit
group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-mac
Expand All @@ -18,8 +20,6 @@ env:
OV_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref || github.ref }}
OV_TARBALL: ''

permissions: read-all # Required by https://github.com/ossf/scorecard/blob/e23b8ad91fd6a64a0a971ca4fc0a4d1650725615/docs/checks.md#token-permissions

jobs:
openvino_download:
name: Download OpenVINO package
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/stable_diffusion_1_5_cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ on:

permissions: read-all # Required by https://github.com/ossf/scorecard/blob/e23b8ad91fd6a64a0a971ca4fc0a4d1650725615/docs/checks.md#token-permissions

concurrency:
# github.ref is not unique in post-commit
group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-stable-diffusion-1-5-cpp
cancel-in-progress: true

env:
PYTHON_VERSION: '3.10'
LINUX_OV_ARCHIVE_URL: https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.5.0-17053-939b35a9629/l_openvino_toolkit_ubuntu20_2024.5.0.dev20241018_x86_64.tgz
WINDOWS_OV_ARCHIVE_URL: https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.5.0-17053-939b35a9629/w_openvino_toolkit_windows_2024.5.0.dev20241018_x86_64.zip
OV_INSTALL_DIR: ${{ github.workspace }}/ov

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

jobs:
stable_diffusion_1_5_cpp-linux:
runs-on: ubuntu-20.04-8-cores
Expand Down Expand Up @@ -84,7 +85,6 @@ jobs:
python ./samples/python/text2image/main.py ./models/dreamlike-art-dreamlike-anime-1.0/FP16 "cyberpunk cityscape like Tokyo New York with tall buildings at dusk golden hour cinematic lighting"
env:
PYTHONPATH: ${{ env.build_dir }}
LD_LIBRARY_PATH: ${{ env.build_dir }}/openvino_genai

- name: Run Python LoRA app
run: |
Expand All @@ -93,7 +93,6 @@ jobs:
python ./samples/python/text2image/lora.py ./models/dreamlike-art-dreamlike-anime-1.0/FP16 "curly-haired unicorn in the forest, anime, line" ./models/soulcard.safetensors 0.7
env:
PYTHONPATH: ${{ env.build_dir }}
LD_LIBRARY_PATH: ${{ env.build_dir }}/openvino_genai

stable_diffusion_1_5_cpp-windows:
runs-on: windows-2019
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
- master
- 'releases/**'

permissions: read-all # Required by https://github.com/ossf/scorecard/blob/e23b8ad91fd6a64a0a971ca4fc0a4d1650725615/docs/checks.md#token-permissions

concurrency:
# github.ref is not unique in post-commit
group: ${{ github.event_name == 'push' && github.run_id || github.ref }}-windows
Expand All @@ -18,8 +20,6 @@ env:
OV_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref || github.ref }}
OV_TARBALL: ''

permissions: read-all # Required by https://github.com/ossf/scorecard/blob/e23b8ad91fd6a64a0a971ca4fc0a4d1650725615/docs/checks.md#token-permissions

jobs:
openvino_download:
name: Download OpenVINO package
Expand Down

0 comments on commit b85991e

Please sign in to comment.