Skip to content

Commit 195c887

Browse files
authored
Merge releases/2024/2 into master (openvinotoolkit#497)
2 parents e9b6c4e + f39618d commit 195c887

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+598
-225
lines changed

.github/workflows/causal_lm_cpp.yml

+97-65
Large diffs are not rendered by default.

.github/workflows/genai_package.yml

+34-23
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,21 @@ jobs:
1919
with:
2020
python-version: 3.8
2121
- run: mkdir ./ov/
22-
- run: curl https://storage.openvinotoolkit.org/repositories/openvino/packages/pre-release/2024.2.0rc1/linux/l_openvino_toolkit_ubuntu20_2024.2.0.dev20240524_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz
22+
- run: curl https://storage.openvinotoolkit.org/repositories/openvino/packages/pre-release/2024.2.0rc2/linux/l_openvino_toolkit_ubuntu20_2024.2.0.dev20240529_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz
2323
- run: sudo ./ov/install_dependencies/install_openvino_dependencies.sh
2424
- run: source ./ov/setupvars.sh && cmake -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -S ./ -B ./build/
2525
- run: source ./ov/setupvars.sh && cmake --build ./build/ --config ${{ matrix.build-type }} --target package -j
26+
- run: source ./ov/setupvars.sh && python -m pip install ./thirdparty/openvino_tokenizers/[transformers] --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/pre-release
27+
- run: source ./ov/setupvars.sh && python -m pip install --upgrade-strategy eager -r ./samples/requirements.txt
28+
- run: source ./ov/setupvars.sh && optimum-cli export openvino --trust-remote-code --model TinyLlama/TinyLlama-1.1B-Chat-v1.0 TinyLlama-1.1B-Chat-v1.0
2629
- run: source ./ov/setupvars.sh && cmake --install ./build/ --config ${{ matrix.build-type }} --prefix ov
2730
- run: ov/samples/cpp/build_samples.sh -i ${{ github.workspace }}/s\ pace
2831
if: ${{ 'Release' == matrix.build-type }} # build_samples enforces Release build
2932
- run: source ./ov/setupvars.sh && cmake -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -S ./ov/samples/cpp/ -B ./samples\ build/ && cmake --build ./samples\ build/ --config ${{ matrix.build-type }} -j && cmake --install ./samples\ build/ --config ${{ matrix.build-type }} --component samples_bin --prefix s\ pace
3033
if: ${{ 'Release' != matrix.build-type }}
31-
- run: source ./ov/setupvars.sh && python -m pip install ./thirdparty/openvino_tokenizers/[transformers] --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/pre-release
32-
- run: source ./ov/setupvars.sh && python -m pip install --upgrade-strategy eager -r ./samples/cpp/requirements.txt
33-
- run: source ./ov/setupvars.sh && optimum-cli export openvino --trust-remote-code --weight-format fp16 --model TinyLlama/TinyLlama-1.1B-Chat-v1.0 TinyLlama-1.1B-Chat-v1.0
34-
- run: source ./ov/setupvars.sh && timeout 50s ${{ github.workspace }}/s\ pace/samples_bin/greedy_causal_lm ./TinyLlama-1.1B-Chat-v1.0/ ""
34+
- run: source ./ov/setupvars.sh && timeout 25s ${{ github.workspace }}/s\ pace/samples_bin/greedy_causal_lm ./TinyLlama-1.1B-Chat-v1.0/ ""
35+
- run: source ./ov/setupvars.sh && timeout 25s ./ov/samples/python/multinomial_causal_lm/multinomial_causal_lm.py ./TinyLlama-1.1B-Chat-v1.0/ 0
36+
if: ${{ 'Release' == matrix.build-type }} # Python bindings can be built in Release only
3537

3638
macos_genai_package:
3739
strategy:
@@ -50,19 +52,24 @@ jobs:
5052
- run: brew install coreutils scons
5153
- run: source ./ov/setupvars.sh && cmake -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -S ./ -B ./build/
5254
- run: source ./ov/setupvars.sh && cmake --build ./build/ --config ${{ matrix.build-type }} --target package -j
55+
- run: source ./ov/setupvars.sh && python -m pip install ./thirdparty/openvino_tokenizers/[transformers] --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/pre-release
56+
- run: source ./ov/setupvars.sh && python -m pip install --upgrade-strategy eager -r ./samples/requirements.txt
57+
- run: source ./ov/setupvars.sh && optimum-cli export openvino --trust-remote-code --model TinyLlama/TinyLlama-1.1B-Chat-v1.0 TinyLlama-1.1B-Chat-v1.0
5358
- run: source ./ov/setupvars.sh && cmake --install ./build/ --config ${{ matrix.build-type }} --prefix ov
5459
- run: ov/samples/cpp/build_samples.sh -i ${{ github.workspace }}/s\ pace
5560
if: ${{ 'Release' == matrix.build-type }} # build_samples enforces Release build
56-
- run: source ./ov/setupvars.sh && python -m pip install ./thirdparty/openvino_tokenizers/[transformers] --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/pre-release
57-
if: ${{ 'Release' == matrix.build-type }}
58-
- run: source ./ov/setupvars.sh && python -m pip install --upgrade-strategy eager -r ./samples/cpp/requirements.txt
59-
if: ${{ 'Release' == matrix.build-type }}
60-
- run: source ./ov/setupvars.sh && optimum-cli export openvino --trust-remote-code --weight-format fp16 --model TinyLlama/TinyLlama-1.1B-Chat-v1.0 TinyLlama-1.1B-Chat-v1.0
61-
if: ${{ 'Release' == matrix.build-type }}
62-
- run: source ./ov/setupvars.sh && timeout 50s ${{ github.workspace }}/s\ pace/samples_bin/greedy_causal_lm ./TinyLlama-1.1B-Chat-v1.0/ ""
63-
if: ${{ 'Release' == matrix.build-type }}
61+
- run: >
62+
source ./ov/setupvars.sh
63+
&& cmake -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -S ./ov/samples/cpp/ -B ./samples\ build/
64+
&& cmake --build ./samples\ build/ --config ${{ matrix.build-type }} -j
65+
&& cmake --install ./samples\ build/ --config ${{ matrix.build-type }} --component samples_bin --prefix s\ pace
66+
if: ${{ 'Release' != matrix.build-type }}
67+
- run: source ./ov/setupvars.sh && timeout 25s ${{ github.workspace }}/s\ pace/samples_bin/greedy_causal_lm ./TinyLlama-1.1B-Chat-v1.0/ ""
68+
- run: source ./ov/setupvars.sh && timeout 25s ./ov/samples/python/multinomial_causal_lm/multinomial_causal_lm.py ./TinyLlama-1.1B-Chat-v1.0/ 0
69+
if: ${{ 'Release' == matrix.build-type }} # Python bindings can be built in Release only
6470

6571
windows_genai_package:
72+
if: false
6673
strategy:
6774
matrix:
6875
build-type: [Release, Debug]
@@ -79,20 +86,24 @@ jobs:
7986
- uses: actions/setup-python@v4
8087
with:
8188
python-version: 3.8
82-
- run: curl --output ov.zip https://storage.openvinotoolkit.org/repositories/openvino/packages/pre-release/2024.2.0rc1/windows/w_openvino_toolkit_windows_2024.2.0.dev20240524_x86_64.zip
89+
- run: curl --output ov.zip https://storage.openvinotoolkit.org/repositories/openvino/packages/pre-release/2024.2.0rc2/windows/w_openvino_toolkit_windows_2024.2.0.dev20240529_x86_64.zip
8390
- run: unzip ov.zip
8491
# Shorten the next setupvars calls.
85-
- run: mklink /D ov w_openvino_toolkit_windows_2024.2.0.dev20240524_x86_64
92+
- run: mklink /D ov w_openvino_toolkit_windows_2024.2.0.dev20240529_x86_64
8693
- run: call ov\setupvars.bat && cmake -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -S ./ -B ./build/
8794
- run: call ov\setupvars.bat && cmake --build ./build/ --config ${{ matrix.build-type }} --target package -j
88-
- run: call ov\setupvars.bat && cmake --install ./build/ --config ${{ matrix.build-type }} --prefix ov
89-
- run: call ov\samples\cpp\build_samples_msvc.bat -i "${{ github.workspace }}/samples_install"
90-
if: ${{ false && 'Release' == matrix.build-type }} # build_samples enforces Release build
9195
- run: call ov\setupvars.bat && python -m pip install ./thirdparty/openvino_tokenizers/[transformers] --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/pre-release
92-
if: ${{ false && 'Release' == matrix.build-type }}
93-
- run: call ov\setupvars.bat && python -m pip install --upgrade-strategy eager -r ./samples/cpp/requirements.txt
94-
if: ${{ false && 'Release' == matrix.build-type }}
96+
- run: call ov\setupvars.bat && python -m pip install --upgrade-strategy eager -r ./samples/requirements.txt
9597
- run: call ov\setupvars.bat && optimum-cli export openvino --trust-remote-code --weight-format fp16 --model TinyLlama/TinyLlama-1.1B-Chat-v1.0 TinyLlama-1.1B-Chat-v1.0
96-
if: ${{ false && 'Release' == matrix.build-type }}
98+
- run: call ov\setupvars.bat && cmake --install ./build/ --config ${{ matrix.build-type }} --prefix ov
99+
- run: call ov\samples\cpp\build_samples_msvc.bat -i "${{ github.workspace }}/samples_install"
100+
if: ${{ 'Release' == matrix.build-type }} # build_samples enforces Release build
101+
- run: >
102+
call ov\setupvars.bat
103+
&& cmake -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -S ./ov/samples/cpp/ -B "samples build"
104+
&& cmake --build "samples build" --config ${{ matrix.build-type }} -j
105+
&& cmake --install "samples build" --config ${{ matrix.build-type }} --component samples_bin --prefix samples_install
106+
if: ${{ 'Release' != matrix.build-type }}
97107
- run: call ov\setupvars.bat && "${{ github.workspace }}/samples_install/samples_bin/greedy_causal_lm" .\TinyLlama-1.1B-Chat-v1.0\ ""
98-
if: ${{ false && 'Release' == matrix.build-type }}
108+
- run: call ov\setupvars.bat && ./ov/samples/python/multinomial_causal_lm/multinomial_causal_lm.py ./TinyLlama-1.1B-Chat-v1.0/ 0
109+
if: ${{ 'Release' == matrix.build-type }} # Python bindings can be built in Release only

.github/workflows/genai_python_lib.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
python-version: 3.8
2121
- run: mkdir ./ov/
2222
# Install CentOS7 instead of Ubuntu to match PyPI distribution ABI.
23-
- run: curl https://storage.openvinotoolkit.org/repositories/openvino/packages/pre-release/2024.2.0rc1/linux/l_openvino_toolkit_centos7_2024.2.0.dev20240524_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz
23+
- run: curl https://storage.openvinotoolkit.org/repositories/openvino/packages/pre-release/2024.2.0rc2/linux/l_openvino_toolkit_centos7_2024.2.0.dev20240529_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz
2424
- run: sudo ./ov/install_dependencies/install_openvino_dependencies.sh
2525
- run: source ./ov/setupvars.sh && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/
2626
- run: source ./ov/setupvars.sh && cmake --build ./build/ --config Release -j
@@ -72,10 +72,10 @@ jobs:
7272
- uses: actions/setup-python@v4
7373
with:
7474
python-version: 3.8
75-
- run: curl --output ov.zip https://storage.openvinotoolkit.org/repositories/openvino/packages/pre-release/2024.2.0rc1/windows/w_openvino_toolkit_windows_2024.2.0.dev20240524_x86_64.zip
75+
- run: curl --output ov.zip https://storage.openvinotoolkit.org/repositories/openvino/packages/pre-release/2024.2.0rc2/windows/w_openvino_toolkit_windows_2024.2.0.dev20240529_x86_64.zip
7676
- run: unzip ov.zip
7777
# Shorten the next setupvars calls.
78-
- run: mklink /D ov w_openvino_toolkit_windows_2024.2.0.dev20240524_x86_64
78+
- run: mklink /D ov w_openvino_toolkit_windows_2024.2.0.dev20240529_x86_64
7979
- run: call ./ov/setupvars.bat && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/
8080
- run: call ./ov/setupvars.bat && cmake --build ./build/ --config Release -j
8181
- run: call ./ov/setupvars.bat && python -m pip install ./thirdparty/openvino_tokenizers/[transformers] -r ./requirements-build.txt -r ./tests/python_tests/requirements.txt --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/pre-release --upgrade-strategy eager

.github/workflows/lcm_dreamshaper_cpp.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
working-directory: ${{ env.working_directory }}
5555
run: |
5656
conda activate openvino_lcm_cpp
57-
optimum-cli export openvino --model SimianLuo/LCM_Dreamshaper_v7 --weight-format fp16 models/lcm_dreamshaper_v7/FP16
57+
optimum-cli export openvino --model SimianLuo/LCM_Dreamshaper_v7 models/lcm_dreamshaper_v7/FP16
5858
5959
- name: Build app
6060
working-directory: ${{ env.working_directory }}
@@ -99,7 +99,7 @@ jobs:
9999
working-directory: ${{ env.working_directory }}
100100
run: |
101101
conda activate openvino_lcm_cpp
102-
optimum-cli export openvino --model SimianLuo/LCM_Dreamshaper_v7 --weight-format fp16 models/lcm_dreamshaper_v7/FP16
102+
optimum-cli export openvino --model SimianLuo/LCM_Dreamshaper_v7 models/lcm_dreamshaper_v7/FP16
103103
104104
- name: Build app
105105
working-directory: ${{ env.working_directory }}

.github/workflows/stable_diffusion_1_5_cpp.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
working-directory: ${{ env.working_directory }}
5454
run: |
5555
conda activate openvino_sd_cpp
56-
optimum-cli export openvino --model runwayml/stable-diffusion-v1-5 --task stable-diffusion --weight-format fp16 models/stable_diffusion_v1_5_ov/FP16
56+
optimum-cli export openvino --model runwayml/stable-diffusion-v1-5 --task stable-diffusion models/stable_diffusion_v1_5_ov/FP16
5757
5858
- name: Build app
5959
working-directory: ${{ env.working_directory }}
@@ -96,7 +96,7 @@ jobs:
9696
working-directory: ${{ env.working_directory }}
9797
run: |
9898
conda activate openvino_sd_cpp
99-
optimum-cli export openvino --model runwayml/stable-diffusion-v1-5 --task stable-diffusion --weight-format fp16 models/stable_diffusion_v1_5_ov/FP16
99+
optimum-cli export openvino --model runwayml/stable-diffusion-v1-5 --task stable-diffusion models/stable_diffusion_v1_5_ov/FP16
100100
101101
- name: Build app
102102
working-directory: ${{ env.working_directory }}

CMakeLists.txt

+9-2
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,17 @@ install(DIRECTORY
3535
./samples/cpp/multinomial_causal_lm
3636
# Don't install prompt_lookup_decoding_lm and speculative_decoding_lm because they don't use openvino_genai library and arent verifyed yet.
3737
DESTINATION samples/cpp/ COMPONENT cpp_samples_genai)
38-
install(FILES ./samples/cpp/requirements.txt DESTINATION samples/cpp/ COMPONENT cpp_samples_genai)
38+
install(DIRECTORY
39+
./samples/python/beam_search_causal_lm
40+
./samples/python/chat_sample
41+
./samples/python/greedy_causal_lm
42+
./samples/python/multinomial_causal_lm
43+
DESTINATION samples/python/ COMPONENT cpp_samples_genai
44+
USE_SOURCE_PERMISSIONS)
45+
install(FILES ./samples/requirements.txt DESTINATION ./samples/ COMPONENT cpp_samples_genai)
3946
install(FILES LICENSE DESTINATION licensing COMPONENT licensing_genai RENAME LICENSE-GENAI)
4047
install(FILES third-party-programs.txt DESTINATION licensing COMPONENT licensing_genai RENAME third-party-programs-genai.txt)
41-
if(MSVC AND NOT DEFINED CPACK_GENERATOR)
48+
if(WIN32 AND NOT DEFINED CPACK_GENERATOR)
4249
set(CPACK_GENERATOR "ZIP")
4350
endif()
4451
include(CPack)

Jenkinsfile

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!groovy
2+
3+
properties([
4+
parameters([
5+
booleanParam(defaultValue: false,
6+
description: 'Cancel the rest of parallel stages if one of them fails and return status immediately',
7+
name: 'failFast'),
8+
booleanParam(defaultValue: true,
9+
description: 'Whether to propagate commit status to GitHub',
10+
name: 'propagateStatus'),
11+
booleanParam(defaultValue: false,
12+
description: 'If true, forces running pre-commit scope',
13+
name: 'forceRunPrecommitScope'),
14+
string(defaultValue: '',
15+
description: 'Pipeline shared library version (branch/tag/commit). Determined automatically if empty',
16+
name: 'library_version')
17+
])
18+
])
19+
loadOpenVinoLibrary {
20+
entrypoint(this)
21+
}

llm_bench/python/benchmark.py

+1
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ def run_text_generation_benchmark(model_path, framework, device, args, num_iters
290290
iter_data_list = []
291291
warmup_md5 = {}
292292
input_text_list = utils.model_utils.get_prompts(args)
293+
text_gen_fn = run_text_generation if not use_genai else run_text_generation_genai
293294
if args['prompt_index'] is None:
294295
prompt_idx_list = [prompt_idx for prompt_idx, input_text in enumerate(input_text_list)]
295296
text_list = input_text_list

samples/cpp/beam_search_causal_lm/CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ find_package(OpenVINOGenAI REQUIRED PATHS
77
)
88
add_executable(beam_search_causal_lm beam_search_causal_lm.cpp)
99
target_link_libraries(beam_search_causal_lm PRIVATE openvino::genai)
10-
target_compile_features(beam_search_causal_lm PRIVATE cxx_std_17)
10+
set_target_properties(beam_search_causal_lm PROPERTIES
11+
COMPILE_PDB_NAME beam_search_causal_lm
12+
# Ensure out of box LC_RPATH on macOS with SIP
13+
INSTALL_RPATH_USE_LINK_PATH ON)
14+
target_compile_features(beam_search_causal_lm PRIVATE cxx_std_11)
1115
install(TARGETS beam_search_causal_lm
1216
RUNTIME DESTINATION samples_bin/
1317
COMPONENT samples_bin

samples/cpp/beam_search_causal_lm/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Text generation C++ sample that supports most popular models like LLaMA 2
22

3-
This example showcases inference of text-generation Large Language Models (LLMs): `chatglm`, `LLaMA`, `Qwen` and other models with the same signature. The application don't have many configuration options to encourage the reader to explore and modify the source code. It's only possible to change the device for inference to a differnt one, GPU for example, from the command line interface. The sample fearures `ov::genai::LLMPipeline` and configures it to use multiple beam grops. There is also a Jupyter [notebook](https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/254-llm-chatbot) which provides an example of LLM-powered Chatbot in Python.
3+
This example showcases inference of text-generation Large Language Models (LLMs): `chatglm`, `LLaMA`, `Qwen` and other models with the same signature. The application doesn't have many configuration options to encourage the reader to explore and modify the source code. It's only possible to change the device for inference to a differnt one, GPU for example, from the command line interface. The sample fearures `ov::genai::LLMPipeline` and configures it to use multiple beam grops. There is also a Jupyter [notebook](https://github.com/openvinotoolkit/openvino_notebooks/tree/main/notebooks/254-llm-chatbot) which provides an example of LLM-powered Chatbot in Python.
44

55
## Download and convert the model and tokenizers
66

77
The `--upgrade-strategy eager` option is needed to ensure `optimum-intel` is upgraded to the latest version.
88

99
```sh
10-
python3 -m pip install --upgrade-strategy eager -r ../../requirements.txt
10+
pip install --upgrade-strategy eager -r ../../requirements.txt
1111
optimum-cli export openvino --trust-remote-code --model TinyLlama/TinyLlama-1.1B-Chat-v1.0 TinyLlama-1.1B-Chat-v1.0
1212
```
1313

samples/cpp/beam_search_causal_lm/beam_search_causal_lm.cpp

+7-8
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,21 @@ int main(int argc, char* argv[]) try {
88
throw std::runtime_error(std::string{"Usage: "} + argv[0] + " <MODEL_DIR> '<PROMPT 1>' ['<PROMPT 2>' ...]");
99
}
1010
auto prompts = std::vector<std::string>(argv + 2, argv + argc);
11-
1211
std::string model_path = argv[1];
13-
std::string device = "CPU"; // GPU can be used as well
1412

13+
std::string device = "CPU"; // GPU can be used as well
1514
ov::genai::LLMPipeline pipe(model_path, device);
16-
ov::genai::GenerationConfig config = pipe.get_generation_config();
15+
16+
ov::genai::GenerationConfig config;
1717
config.max_new_tokens = 20;
1818
config.num_beam_groups = 3;
1919
config.num_beams = 15;
20-
config.num_return_sequences = config.num_beams * prompts.size();
20+
config.num_return_sequences = config.num_beams;
2121

22+
// Since the streamer is set, the results will
23+
// be printed each time a new token is generated.
2224
auto beams = pipe.generate(prompts, config);
23-
for (int i = 0; i < beams.scores.size(); i++)
24-
std::cout << beams.scores[i] << ": " << beams.texts[i] << '\n';
25-
26-
return 0;
25+
std::cout << beams << '\n';
2726
} catch (const std::exception& error) {
2827
std::cerr << error.what() << '\n';
2928
return EXIT_FAILURE;

samples/cpp/chat_sample/CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ find_package(OpenVINOGenAI REQUIRED PATHS
77
)
88
add_executable(chat_sample chat_sample.cpp)
99
target_link_libraries(chat_sample PRIVATE openvino::genai)
10-
target_compile_features(chat_sample PRIVATE cxx_std_17)
10+
set_target_properties(chat_sample PROPERTIES
11+
COMPILE_PDB_NAME chat_sample
12+
# Ensure out of box LC_RPATH on macOS with SIP
13+
INSTALL_RPATH_USE_LINK_PATH ON)
14+
target_compile_features(chat_sample PRIVATE cxx_std_11)
1115
install(TARGETS chat_sample
1216
RUNTIME DESTINATION samples_bin/
1317
COMPONENT samples_bin

0 commit comments

Comments
 (0)