From d21e27cb026a911a5779b14413fe2428df18d875 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Mon, 20 Jan 2025 13:57:09 +0400 Subject: [PATCH] GHA: Use 2025.0.0 RC1 (#1578) Also, ported the following PRs: - https://github.com/openvinotoolkit/openvino.genai/pull/1588 - https://github.com/openvinotoolkit/openvino.genai/pull/1586 - https://github.com/openvinotoolkit/openvino.genai/pull/1582 - https://github.com/openvinotoolkit/openvino.genai/pull/1573 - https://github.com/openvinotoolkit/openvino.genai/pull/1585 - https://github.com/openvinotoolkit/openvino.genai/pull/1584 --------- Signed-off-by: Tomasz Jankowski Co-authored-by: Pavel Esir Co-authored-by: Vladimir Zlobin Co-authored-by: Tomasz Jankowski Co-authored-by: Nikita Savelyev Co-authored-by: guozhong wang --- .github/workflows/causal_lm_cpp.yml | 12 ++++--- .github/workflows/genai-tools.yml | 4 +-- .github/workflows/job_vlm_sample_llava.yml | 2 +- .github/workflows/lcm_dreamshaper_cpp.yml | 6 ++-- .github/workflows/linux.yml | 4 +-- .github/workflows/mac.yml | 20 +++++------ .../workflows/stable_diffusion_1_5_cpp.yml | 10 +++--- .github/workflows/windows.yml | 2 +- samples/cpp/image_generation/README.md | 2 +- samples/cpp/visual_language_chat/README.md | 2 +- .../cpp/whisper_speech_recognition/README.md | 2 +- src/cpp/src/llm_pipeline_static.cpp | 3 +- src/cpp/src/lora_adapter.cpp | 6 ++-- src/cpp/src/make_tokenizer_stateful.hpp | 4 +-- src/cpp/src/whisper_pipeline_static.cpp | 2 +- src/docs/BUILD.md | 4 ++- tests/python_tests/requirements.txt | 2 +- .../python_tests/test_continuous_batching.py | 2 +- tests/python_tests/test_llm_pipeline.py | 2 +- tests/python_tests/test_sampling.py | 5 ++- tests/python_tests/test_tokenizer.py | 36 ++++++++++++------- thirdparty/openvino_tokenizers | 2 +- .../llm_bench/llm_bench_utils/output_json.py | 2 +- 23 files changed, 78 insertions(+), 58 deletions(-) diff --git a/.github/workflows/causal_lm_cpp.yml b/.github/workflows/causal_lm_cpp.yml index 5fc4617f2c..58d4d3e0be 100644 --- a/.github/workflows/causal_lm_cpp.yml +++ b/.github/workflows/causal_lm_cpp.yml @@ -16,10 +16,11 @@ concurrency: cancel-in-progress: true env: - l_ov_link: https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2025.0.0-17800-91ae987c516/l_openvino_toolkit_ubuntu20_2025.0.0.dev20250109_x86_64.tgz - l_u22_ov_link: https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2025.0.0-17800-91ae987c516/l_openvino_toolkit_ubuntu22_2025.0.0.dev20250109_x86_64.tgz - m_ov_link: https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2025.0.0-17800-91ae987c516/m_openvino_toolkit_macos_12_6_2025.0.0.dev20250109_x86_64.tgz - w_ov_link: https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2025.0.0-17800-91ae987c516/w_openvino_toolkit_windows_2025.0.0.dev20250109_x86_64.zip + l_ov_link: https://storage.openvinotoolkit.org/repositories/openvino/packages/pre-release/2025.0.0rc1/l_openvino_toolkit_ubuntu20_2025.0.0.dev20250116_x86_64.tgz + l_u22_ov_link: https://storage.openvinotoolkit.org/repositories/openvino/packages/pre-release/2025.0.0rc1/l_openvino_toolkit_ubuntu22_2025.0.0.dev20250116_x86_64.tgz + m_ov_link: https://storage.openvinotoolkit.org/repositories/openvino/packages/pre-release/2025.0.0rc1/m_openvino_toolkit_macos_12_6_2025.0.0.dev20250116_x86_64.tgz + w_ov_link: https://storage.openvinotoolkit.org/repositories/openvino/packages/pre-release/2025.0.0rc1/w_openvino_toolkit_windows_2025.0.0.dev20250116_x86_64.zip + jobs: cpp-multinomial-greedy_causal_lm-ubuntu: runs-on: ubuntu-20.04-8-cores @@ -463,6 +464,7 @@ jobs: env: PYTHONPATH: "./build/:$PYTHONPATH" LD_LIBRARY_PATH: "./build/openvino_genai/:$LD_LIBRARY_PATH" + cpp-prompt_lookup_decoding_lm-ubuntu: runs-on: ubuntu-20.04-16-cores defaults: @@ -520,6 +522,7 @@ jobs: env: PYTHONPATH: "./build/:$PYTHONPATH" LD_LIBRARY_PATH: "./build/openvino_genai/:$LD_LIBRARY_PATH" + cpp-Phi-1_5: runs-on: ubuntu-20.04-16-cores defaults: @@ -697,7 +700,6 @@ jobs: diff pred2.txt ref.txt echo "Chat sample python" passed - visual_language_chat_sample-ubuntu-minicpm_v2_6: runs-on: ubuntu-22.04-16-cores steps: diff --git a/.github/workflows/genai-tools.yml b/.github/workflows/genai-tools.yml index 3d6041129b..3f7741231a 100644 --- a/.github/workflows/genai-tools.yml +++ b/.github/workflows/genai-tools.yml @@ -39,12 +39,12 @@ jobs: - ${{ github.workspace }}:${{ github.workspace }} steps: - - uses: openvinotoolkit/openvino/.github/actions/openvino_provider@master + - uses: openvinotoolkit/openvino/.github/actions/openvino_provider@releases/2025/0 id: openvino_download with: platform: ubuntu22 commit_packages_to_provide: wheels - revision: ed470e7e40129d6b2bf728bc9527316937a69ef7 + revision: latest_available_commit llm_bench: name: 'LLM bench tests' diff --git a/.github/workflows/job_vlm_sample_llava.yml b/.github/workflows/job_vlm_sample_llava.yml index a8a7a19a5b..9ecc6c594a 100644 --- a/.github/workflows/job_vlm_sample_llava.yml +++ b/.github/workflows/job_vlm_sample_llava.yml @@ -11,7 +11,7 @@ on: type: string env: - l_u22_ov_link: https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2025.0.0-17800-91ae987c516/l_openvino_toolkit_ubuntu22_2025.0.0.dev20250109_x86_64.tgz + l_u22_ov_link: https://storage.openvinotoolkit.org/repositories/openvino/packages/pre-release/2025.0.0rc1/l_openvino_toolkit_ubuntu22_2025.0.0.dev20250116_x86_64.tgz jobs: visual_language_chat_sample-ubuntu-llava: diff --git a/.github/workflows/lcm_dreamshaper_cpp.yml b/.github/workflows/lcm_dreamshaper_cpp.yml index 6129aec624..89b7404258 100644 --- a/.github/workflows/lcm_dreamshaper_cpp.yml +++ b/.github/workflows/lcm_dreamshaper_cpp.yml @@ -18,8 +18,8 @@ concurrency: env: PYTHON_VERSION: '3.9' - LINUX_OV_ARCHIVE_URL: https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2025.0.0-17800-91ae987c516/l_openvino_toolkit_ubuntu22_2025.0.0.dev20250109_x86_64.tgz - WINDOWS_OV_ARCHIVE_URL: https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2025.0.0-17800-91ae987c516/w_openvino_toolkit_windows_2025.0.0.dev20250109_x86_64.zip + LINUX_OV_ARCHIVE_URL: https://storage.openvinotoolkit.org/repositories/openvino/packages/pre-release/2025.0.0rc1/l_openvino_toolkit_ubuntu22_2025.0.0.dev20250116_x86_64.tgz + WINDOWS_OV_ARCHIVE_URL: https://storage.openvinotoolkit.org/repositories/openvino/packages/pre-release/2025.0.0rc1/w_openvino_toolkit_windows_2025.0.0.dev20250116_x86_64.zip OV_INSTALL_DIR: ${{ github.workspace }}/ov jobs: @@ -93,7 +93,7 @@ jobs: ${{ env.build_dir }}/samples/cpp/image_generation/inpainting ./models/lcm_dreamshaper_v7 "cyberpunk cityscape like Tokyo New York with tall buildings at dusk golden hour cinematic lighting" ./image.png ./mask_image.png lcm_dreamshaper_v7_cpp-windows: - runs-on: windows-2019 + runs-on: windows-2022 defaults: run: shell: pwsh diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index ddc19f40d8..408b680067 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -47,12 +47,12 @@ jobs: - ${{ github.workspace }}:${{ github.workspace }} steps: - - uses: openvinotoolkit/openvino/.github/actions/openvino_provider@master + - uses: openvinotoolkit/openvino/.github/actions/openvino_provider@releases/2025/0 id: openvino_download with: platform: ubuntu22 commit_packages_to_provide: wheels - revision: ed470e7e40129d6b2bf728bc9527316937a69ef7 + revision: latest_available_commit - name: Clone docker tag from OpenVINO repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index f377d3e6a5..1172d9de38 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -17,8 +17,8 @@ concurrency: env: PYTHON_VERSION: '3.10' - OV_BRANCH: 'master' - OV_TARBALL: '' + OV_BRANCH: 'releases/2025/0' + OV_TARBALL: 'https://storage.openvinotoolkit.org/repositories/openvino/packages/pre-release/2025.0.0rc1/m_openvino_toolkit_macos_12_6_2025.0.0.dev20250116_x86_64.tgz' jobs: openvino_download: @@ -224,7 +224,7 @@ jobs: - name: Test bindings run: | source ${OV_INSTALL_DIR}/setupvars.sh - python -m pip install ./thirdparty/openvino_tokenizers/[transformers] -r ./tests/python_tests/requirements.txt --find-links ${OV_INSTALL_DIR}/wheels + python -m pip install ./thirdparty/openvino_tokenizers/[transformers] -r ./tests/python_tests/requirements.txt --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/pre-release python -m pytest -v ./tests/python_tests/test_tokenizer.py::test_set_chat_template env: PYTHONPATH: "./build/:$PYTHONPATH" @@ -232,9 +232,9 @@ jobs: - name: Test bindings (wheel) run: | source ${OV_INSTALL_DIR}/setupvars.sh - python -m pip install . --verbose --find-links ${OV_INSTALL_DIR}/wheels + python -m pip install . --verbose --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/pre-release python -c "from openvino_genai import LLMPipeline" - python -m pip install ./tools/who_what_benchmark --find-links ${OV_INSTALL_DIR}/wheels + python -m pip install ./tools/who_what_benchmark --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/pre-release python -m pytest -v ./tests/python_tests/ --ignore ./tests/python_tests/test_whisper_pipeline.py --ignore ./tests/python_tests/test_vlm_pipeline.py -k "not test_set_chat_template" genai_python_lib_whisper: @@ -289,7 +289,7 @@ jobs: - name: Test bindings run: | source ${OV_INSTALL_DIR}/setupvars.sh - python -m pip install ./thirdparty/openvino_tokenizers/[transformers] -r ./tests/python_tests/requirements.txt --find-links ${OV_INSTALL_DIR}/wheels + python -m pip install ./thirdparty/openvino_tokenizers/[transformers] -r ./tests/python_tests/requirements.txt --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/pre-release python -m pytest -v ./tests/python_tests/test_whisper_pipeline.py -k test_smoke env: PYTHONPATH: "./build/:$PYTHONPATH" @@ -297,9 +297,9 @@ jobs: - name: Test bindings (wheel) run: | source ${OV_INSTALL_DIR}/setupvars.sh - python -m pip install . --verbose --find-links ${OV_INSTALL_DIR}/wheels + python -m pip install . --verbose --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/pre-release python -c "from openvino_genai import LLMPipeline" - python -m pip install ./tools/who_what_benchmark --find-links ${OV_INSTALL_DIR}/wheels + python -m pip install ./tools/who_what_benchmark --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/pre-release python -m pytest -v ./tests/python_tests/test_whisper_pipeline.py -k "not test_smoke" genai_package: @@ -355,8 +355,8 @@ jobs: - name: Build and Install dependencies run: | source ${OV_INSTALL_DIR}/setupvars.sh - python -m pip install ./thirdparty/openvino_tokenizers/[transformers] --find-links ${OV_INSTALL_DIR}/wheels - python -m pip install -r ./samples/requirements.txt --find-links ${OV_INSTALL_DIR}/wheels + python -m pip install ./thirdparty/openvino_tokenizers/[transformers] --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/pre-release + python -m pip install -r ./samples/requirements.txt --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/pre-release optimum-cli export openvino --trust-remote-code --model TinyLlama/TinyLlama-1.1B-Chat-v1.0 TinyLlama-1.1B-Chat-v1.0 optimum-cli export openvino --trust-remote-code --model openai/whisper-tiny whisper-tiny diff --git a/.github/workflows/stable_diffusion_1_5_cpp.yml b/.github/workflows/stable_diffusion_1_5_cpp.yml index b4680e579f..7b22905dbe 100644 --- a/.github/workflows/stable_diffusion_1_5_cpp.yml +++ b/.github/workflows/stable_diffusion_1_5_cpp.yml @@ -40,12 +40,12 @@ jobs: - ${{ github.workspace }}:${{ github.workspace }} steps: - - uses: openvinotoolkit/openvino/.github/actions/openvino_provider@master + - uses: openvinotoolkit/openvino/.github/actions/openvino_provider@releases/2025/0 id: openvino_download with: platform: ubuntu22 commit_packages_to_provide: wheels - revision: ed470e7e40129d6b2bf728bc9527316937a69ef7 + revision: 2025.0.0rc1 openvino_download_windows: name: Download OpenVINO for Windows @@ -66,12 +66,12 @@ jobs: - ${{ github.workspace }}:${{ github.workspace }} steps: - - uses: openvinotoolkit/openvino/.github/actions/openvino_provider@master + - uses: openvinotoolkit/openvino/.github/actions/openvino_provider@releases/2025/0 id: openvino_download with: platform: windows commit_packages_to_provide: wheels - revision: ed470e7e40129d6b2bf728bc9527316937a69ef7 + revision: 2025.0.0rc1 stable_diffusion_1_5_cpp-linux: runs-on: ubuntu-22.04-8-cores @@ -153,7 +153,7 @@ jobs: stable_diffusion_1_5_cpp-windows: needs: [ openvino_download_windows ] - runs-on: windows-2019 + runs-on: windows-2022 defaults: run: shell: pwsh diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 6b402fe5a1..999a14297e 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -17,7 +17,7 @@ concurrency: env: PYTHON_VERSION: '3.11' - OV_BRANCH: 'ed470e7e40129d6b2bf728bc9527316937a69ef7' + OV_BRANCH: 'releases/2025/0' OV_TARBALL: '' jobs: diff --git a/samples/cpp/image_generation/README.md b/samples/cpp/image_generation/README.md index 3dcb64b97c..4d2b2ef9ff 100644 --- a/samples/cpp/image_generation/README.md +++ b/samples/cpp/image_generation/README.md @@ -28,7 +28,7 @@ Users can change the sample code and play with the following generation paramete The `--upgrade-strategy eager` option is needed to ensure `optimum-intel` is upgraded to the latest version. -It's not required to install [../../export-requirements.txt](../../export requirements.txt) for deployment if the model has already been exported. +It's not required to install [../../export-requirements.txt](../../export-requirements.txt) for deployment if the model has already been exported. ```sh pip install --upgrade-strategy eager -r ../../requirements.txt diff --git a/samples/cpp/visual_language_chat/README.md b/samples/cpp/visual_language_chat/README.md index 73baf0088a..0017bd0b7c 100644 --- a/samples/cpp/visual_language_chat/README.md +++ b/samples/cpp/visual_language_chat/README.md @@ -12,7 +12,7 @@ There are two sample files: The `--upgrade-strategy eager` option is needed to ensure `optimum-intel` is upgraded to the latest version. -It's not required to install [../../export-requirements.txt](../../export requirements.txt) for deployment if the model has already been exported. +It's not required to install [../../export-requirements.txt](../../export-requirements.txt) for deployment if the model has already been exported. ```sh pip install --upgrade-strategy eager -r ../../requirements.txt diff --git a/samples/cpp/whisper_speech_recognition/README.md b/samples/cpp/whisper_speech_recognition/README.md index 2ea3322dee..47650b566c 100644 --- a/samples/cpp/whisper_speech_recognition/README.md +++ b/samples/cpp/whisper_speech_recognition/README.md @@ -6,7 +6,7 @@ This example showcases inference of speech recognition Whisper Models. The appli The `--upgrade-strategy eager` option is needed to ensure `optimum-intel` is upgraded to the latest version. -It's not required to install [../../export-requirements.txt](../../export requirements.txt) for deployment if the model has already been exported. +It's not required to install [../../export-requirements.txt](../../export-requirements.txt) for deployment if the model has already been exported. ```sh pip install --upgrade-strategy eager -r ../../requirements.txt diff --git a/src/cpp/src/llm_pipeline_static.cpp b/src/cpp/src/llm_pipeline_static.cpp index b9a55477cb..63a990f252 100644 --- a/src/cpp/src/llm_pipeline_static.cpp +++ b/src/cpp/src/llm_pipeline_static.cpp @@ -34,6 +34,7 @@ namespace { namespace opp = ov::pass::pattern; class TransposeValueTensors : public ov::pass::MatcherPass { public: + OPENVINO_MATCHER_PASS_RTTI("TransposeValueTensors"); struct Context { std::vector> new_params; std::vector> old_params; @@ -95,7 +96,7 @@ class TransposeValueTensors : public ov::pass::MatcherPass { class ScaledDotProductAttentionDecomposition : public ov::pass::MatcherPass { public: - OPENVINO_RTTI("ScaledDotProductAttentionDecomposition", "0"); + OPENVINO_MATCHER_PASS_RTTI("ScaledDotProductAttentionDecomposition"); ScaledDotProductAttentionDecomposition() { auto pattern_node = ov::pass::pattern::wrap_type(); diff --git a/src/cpp/src/lora_adapter.cpp b/src/cpp/src/lora_adapter.cpp index f3c20fbfb4..2fd487f37f 100644 --- a/src/cpp/src/lora_adapter.cpp +++ b/src/cpp/src/lora_adapter.cpp @@ -473,7 +473,7 @@ struct LoRAWeightStateGetter { class LoRATransformBase : public ov::pass::MatcherPass { public: - OPENVINO_RTTI("LoRATransformBase"); + OPENVINO_MATCHER_PASS_RTTI("LoRATransformBase"); LoRATransformBase(const LoRAWeightByNodeGetter& lora_weight_getter) { register_matcher( @@ -693,7 +693,7 @@ class LoRAFuseTransform : public LoRATransformBase { public: - OPENVINO_RTTI("LoRAFuseTransform"); + OPENVINO_RTTI("LoRAFuseTransform", "genai", LoRATransformBase); LoRAFuseTransform(const LoRAWeightByNodeGetter& lora_weight_getter, const std::string& device_for_fusion = "CPU") : LoRATransformBase(lora_weight_getter), @@ -763,7 +763,7 @@ class LoRAFuseTransform : public LoRATransformBase { class LoRASeparateTransform : public LoRATransformBase { public: - OPENVINO_RTTI("LoRASeparateTransform"); + OPENVINO_RTTI("LoRASeparateTransform", "genai", LoRATransformBase); LoRASeparateTransform(const LoRAWeightByNodeGetter& lora_getter) : LoRATransformBase(lora_getter) {} diff --git a/src/cpp/src/make_tokenizer_stateful.hpp b/src/cpp/src/make_tokenizer_stateful.hpp index 1f25d2ad21..9ad06ae07a 100644 --- a/src/cpp/src/make_tokenizer_stateful.hpp +++ b/src/cpp/src/make_tokenizer_stateful.hpp @@ -34,7 +34,7 @@ namespace genai { **/ class MakeCombineSegmentsSatateful : public ov::pass::ModelPass { public: - OPENVINO_RTTI("MakeCombineSegmentsSatateful", "0"); + OPENVINO_MODEL_PASS_RTTI("MakeCombineSegmentsSatateful"); bool run_on_model(const std::shared_ptr& model) override; }; @@ -70,7 +70,7 @@ class MakeCombineSegmentsSatateful : public ov::pass::ModelPass { **/ class MakeVocabDecoderSatateful : public ov::pass::ModelPass { public: - OPENVINO_RTTI("MakeVocabDecoderSatateful", "0"); + OPENVINO_MODEL_PASS_RTTI("MakeVocabDecoderSatateful"); bool run_on_model(const std::shared_ptr& model) override; }; diff --git a/src/cpp/src/whisper_pipeline_static.cpp b/src/cpp/src/whisper_pipeline_static.cpp index 91de478b1c..551774ec59 100644 --- a/src/cpp/src/whisper_pipeline_static.cpp +++ b/src/cpp/src/whisper_pipeline_static.cpp @@ -347,7 +347,7 @@ void add_attention_mask_input(std::shared_ptr model) { using namespace ov::op; class AttentionMaskInput : public ov::pass::MatcherPass { public: - OPENVINO_RTTI("AttentionMaskInput"); + OPENVINO_MATCHER_PASS_RTTI("AttentionMaskInput"); AttentionMaskInput(std::shared_ptr model) { auto range = wrap_type(); diff --git a/src/docs/BUILD.md b/src/docs/BUILD.md index 77657620a0..4cda924fd2 100644 --- a/src/docs/BUILD.md +++ b/src/docs/BUILD.md @@ -191,9 +191,11 @@ The path to the openvino install directory is referred as througho ``` 4. Build the wheel in the `dist` directory: ```sh - python -m pip wheel . -w dist/ --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/pre-release + python -m pip wheel . -w dist/ --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/pre-release --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly ``` +> **NOTE**: You'd need to build ABI compatible OpenVINO and OpenVINO Tokenizers for Ubuntu instead of downloading them from PyPI. See [OpenVINO™ GenAI Dependencies](../README.md#openvino-genai-dependencies) for the explanation. + ### Install OpenVINO GenAI From Source 1. Clone OpenVINO GenAI repository and init submodules: diff --git a/tests/python_tests/requirements.txt b/tests/python_tests/requirements.txt index 8d0f6d4e30..0805c59b5a 100644 --- a/tests/python_tests/requirements.txt +++ b/tests/python_tests/requirements.txt @@ -1,6 +1,6 @@ --extra-index-url https://download.pytorch.org/whl/cpu diffusers==0.32.2 -optimum-intel @ git+https://github.com/eaidova/optimum-intel@ea/stateful_seq2seq +optimum-intel @ git+https://github.com/huggingface/optimum-intel@main numpy<2.0.0; platform_system == "Darwin" and platform_machine == "x86_64" onnx==1.17.0 pytest diff --git a/tests/python_tests/test_continuous_batching.py b/tests/python_tests/test_continuous_batching.py index 2ebe62b3e1..e8081f30e6 100644 --- a/tests/python_tests/test_continuous_batching.py +++ b/tests/python_tests/test_continuous_batching.py @@ -117,7 +117,7 @@ def test_cb_streamer_vs_return_vs_stateful(prompt): @pytest.mark.parametrize("model_descr", get_chat_models_list()) @pytest.mark.precommit def test_chat_scenario_vs_stateful(model_descr, generation_config_kwargs: Dict): - model_id, models_path, hf_tokenizer, opt_model, ov_pipe = read_model((model_descr[0], model_descr[1] / '_test_chat')) + model_id, models_path, hf_tokenizer, opt_model, ov_pipe = read_model((model_descr[0], model_descr[1])) cb_pipe = get_continuous_batching(models_path) ov_pipe.start_chat() diff --git a/tests/python_tests/test_llm_pipeline.py b/tests/python_tests/test_llm_pipeline.py index 0cc5f8d9f4..8968f2a083 100644 --- a/tests/python_tests/test_llm_pipeline.py +++ b/tests/python_tests/test_llm_pipeline.py @@ -129,7 +129,7 @@ def test_chat_scenario(model_descr, generation_config_kwargs: Dict): chat_history_hf = [] chat_history_ov = [] - model_id, path, tokenizer, opt_model, ov_pipe = read_model((model_descr[0], model_descr[1] / '_test_chat')) + model_id, path, tokenizer, opt_model, ov_pipe = read_model((model_descr[0], model_descr[1])) ov_generation_config = GenerationConfig(**generation_config_kwargs) hf_generation_config = convert_to_hf(opt_model.generation_config, ov_generation_config) diff --git a/tests/python_tests/test_sampling.py b/tests/python_tests/test_sampling.py index 97a2489d38..7a3aced29a 100644 --- a/tests/python_tests/test_sampling.py +++ b/tests/python_tests/test_sampling.py @@ -65,12 +65,15 @@ def test_stop_strings(tmp_path, generation_config): 'What is OpenVINO?', 'table is made of', 'The Sun is yellow because', - '你好! 你好嗎?' + '你好! 你好嗎?', 'I have an interview about product speccing with the company Weekend Health. Give me an example of a question they might ask with regards about a new feature' ]) @pytest.mark.parametrize("use_cb", [True, False]) def test_greedy(tmp_path, generation_config, prompt, use_cb): model_id : str = "katuni4ka/tiny-random-phi3" + if sys.platform.startswith('win') and prompt.startswith('你'): + pytest.skip("For unknown reason this prompt fails on Win") + run_llm_pipeline_with_ref(model_id=model_id, prompts=[prompt], generation_config=generation_config, diff --git a/tests/python_tests/test_tokenizer.py b/tests/python_tests/test_tokenizer.py index 7980c2152e..2613865df2 100644 --- a/tests/python_tests/test_tokenizer.py +++ b/tests/python_tests/test_tokenizer.py @@ -186,7 +186,7 @@ def test_apply_chat_template(model_tmp_path, chat_config: Tuple[str, Dict]): @pytest.mark.nightly def test_set_chat_template(): model_descr = get_chat_models_list()[0] - model_id, path, hf_tokenizer, opt_model, ov_pipe = read_model((model_descr[0], model_descr[1] / '_test_chat')) + model_id, path, hf_tokenizer, opt_model, ov_pipe = read_model((model_descr[0], model_descr[1])) prompt = "how are you?" dummy_conversation = [ @@ -217,24 +217,36 @@ def test_set_chat_template(): ] @pytest.mark.precommit @pytest.mark.nightly -@pytest.mark.parametrize("add_special_tokens", [True, False]) -@pytest.mark.parametrize("skip_special_tokens", [True, False]) @pytest.mark.parametrize("prompt", prompts) -def test_encode_decode_with_special_tokens_option(add_special_tokens, skip_special_tokens, prompt): +def test_encode_decode_with_special_tokens_option(prompt): import numpy as np - model_descr = get_chat_models_list()[0] - model_id, path, hf_tokenizer, model_opt, ov_pipe = read_model((model_descr[0], model_descr[1] / '_test_chat')) + model_descr = get_models_list()[0] + model_id, path, hf_tokenizer, model_opt, ov_pipe = read_model((model_descr[0], model_descr[1])) ov_tokenzier = ov_pipe.get_tokenizer() # Calling encode with 'add_special_tokens' will set state flag. - ov_res = ov_tokenzier.encode(prompt, add_special_tokens=add_special_tokens).input_ids.data - hf_res = hf_tokenizer(prompt, return_tensors="np", add_special_tokens=add_special_tokens)["input_ids"] - assert np.all(ov_res == hf_res) + ov_res_add_spec = ov_tokenzier.encode(prompt, add_special_tokens=True).input_ids.data + ov_res_no_spec = ov_tokenzier.encode(prompt, add_special_tokens=False).input_ids.data + hf_res_add_spec = hf_tokenizer(prompt, return_tensors="np", add_special_tokens=True)["input_ids"] + hf_res_no_spec = hf_tokenizer(prompt, return_tensors="np", add_special_tokens=False)["input_ids"] + assert np.all(ov_res_add_spec == hf_res_add_spec) + assert np.all(ov_res_no_spec == hf_res_no_spec) + + # Check that add_special_tokens flag indeed made any difference + assert ov_res_add_spec.size != ov_res_no_spec.size + assert hf_res_add_spec.size != hf_res_no_spec.size # Decode with 'skip_special_tokens' - decoded_genai = ov_tokenzier.decode(ov_res, skip_special_tokens=skip_special_tokens)[0] - decoded_hf = hf_tokenizer.decode(hf_res[0], skip_special_tokens=skip_special_tokens) - assert decoded_genai == decoded_hf + decoded_genai_skip_spec = ov_tokenzier.decode(hf_res_add_spec, skip_special_tokens=True)[0] + decoded_genai_no_skip = ov_tokenzier.decode(hf_res_add_spec, skip_special_tokens=False)[0] + decoded_hf_skip_spec = hf_tokenizer.decode(hf_res_add_spec[0], skip_special_tokens=True) + decoded_hf_no_skip = hf_tokenizer.decode(hf_res_add_spec[0], skip_special_tokens=False) + assert decoded_genai_skip_spec == decoded_hf_skip_spec + assert decoded_genai_no_skip == decoded_hf_no_skip + + # Check that skip_special_tokens indeed made any difference + assert decoded_genai_skip_spec != decoded_genai_no_skip + assert decoded_hf_skip_spec != decoded_hf_no_skip @pytest.mark.precommit diff --git a/thirdparty/openvino_tokenizers b/thirdparty/openvino_tokenizers index 708712d84d..e8da805a98 160000 --- a/thirdparty/openvino_tokenizers +++ b/thirdparty/openvino_tokenizers @@ -1 +1 @@ -Subproject commit 708712d84d3201f816c5e44532c9e1b14e4d8be8 +Subproject commit e8da805a98e987668c6436da132ea1ea413d62b3 diff --git a/tools/llm_bench/llm_bench_utils/output_json.py b/tools/llm_bench/llm_bench_utils/output_json.py index 7633417d94..0ccfe3cd4e 100644 --- a/tools/llm_bench/llm_bench_utils/output_json.py +++ b/tools/llm_bench/llm_bench_utils/output_json.py @@ -53,7 +53,7 @@ def write_result(report_file, model, framework, device, model_args, iter_data_li output_result = {'metadata': metadata, "perfdata": {'compile_time': pretrain_time, 'results': result}} with open(report_file, 'w') as outfile: - json.dump(output_result, outfile) + json.dump(output_result, outfile, indent=4) def get_timestamp(iter_idx, prompt_idx, iter_timestamp):