From d4a548e61028467e060c5bb5d7ffb3ab1c0d0255 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Wed, 15 May 2024 20:21:48 +0400 Subject: [PATCH 01/24] archive --- .gitignore | 2 +- CMakeLists.txt | 9 +++ pyproject.toml | 2 +- src/cpp/CMakeLists.txt | 59 ++++++++++++++++--- src/cpp/cmake/openvino_genaiConfig.cmake | 4 ++ .../generation_config.hpp | 2 +- .../genai => openvino_genai}/llm_pipeline.hpp | 6 +- .../streamer_base.hpp | 2 +- .../genai => openvino_genai}/tokenizer.hpp | 4 +- .../genai => openvino_genai}/visibility.hpp | 0 src/cpp/src/generation_config.cpp | 2 +- src/cpp/src/generation_config_helper.hpp | 2 +- src/cpp/src/greedy_decoding.cpp | 2 +- src/cpp/src/group_beam_searcher.hpp | 4 +- src/cpp/src/llm_pipeline.cpp | 4 +- src/cpp/src/text_callback_streamer.hpp | 4 +- src/cpp/src/tokenizer.cpp | 2 +- src/python/CMakeLists.txt | 9 +-- src/python/py_generate_pipeline.cpp | 2 +- text_generation/causal_lm/cpp/CMakeLists.txt | 26 +++++--- .../causal_lm/cpp/beam_search_causal_lm.cpp | 2 +- .../cpp/generate_pipeline/chat_sample.cpp | 2 +- .../cpp/generate_pipeline/generate_sample.cpp | 2 +- .../causal_lm/cpp/greedy_causal_lm.cpp | 2 +- 24 files changed, 110 insertions(+), 45 deletions(-) create mode 100644 src/cpp/cmake/openvino_genaiConfig.cmake rename src/cpp/include/{openvino/genai => openvino_genai}/generation_config.hpp (99%) rename src/cpp/include/{openvino/genai => openvino_genai}/llm_pipeline.hpp (98%) rename src/cpp/include/{openvino/genai => openvino_genai}/streamer_base.hpp (94%) rename src/cpp/include/{openvino/genai => openvino_genai}/tokenizer.hpp (96%) rename src/cpp/include/{openvino/genai => openvino_genai}/visibility.hpp (100%) diff --git a/.gitignore b/.gitignore index 1546c18f71..fe5cf86f7b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # They are copied to python folder during the build to allow skipping wheel installation -src/python/openvino_genai/*generate_pipeline_lib* +src/python/openvino_genai/*genai* src/python/openvino_genai/py_generate_pipeline* # build/artifact dirs diff --git a/CMakeLists.txt b/CMakeLists.txt index 754752962a..6f3086f212 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,5 +10,14 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release" "Debug" "RelWithD project(openvino_genai) add_subdirectory(./thirdparty/openvino_tokenizers/ "${CMAKE_CURRENT_BINARY_DIR}/openvino_tokenizers/") +set(openvino_genai_VERSION 2024.1.0.0) add_subdirectory(src) add_subdirectory(text_generation/causal_lm/cpp) + +install(DIRECTORY text_generation/causal_lm/cpp/ DESTINATION samples/cpp/causal_lm COMPONENT cpp_samples_genai) + +install(FILES LICENSE third-party-programs.txt DESTINATION licenses_genai COMPONENT licensing_genai) # TODO: how to merge with OPenvino + +set(CPACK_PACKAGE_VERSION ${openvino_genai_VERSION}) +set(CPACK_GENERATOR "ZIP") +include(CPack) diff --git a/pyproject.toml b/pyproject.toml index 007dcb11f7..87a4ada5e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ dependencies = [ [tool.scikit-build] cmake.source-dir = "./" cmake.build-type = "Release" -cmake.targets = ["py_generate_pipeline", "generate_pipeline_lib"] +cmake.targets = ["py_generate_pipeline", "genai"] install.components = ["genai", "genai_python"] sdist.cmake = true wheel.packages = ["src/python/openvino_genai"] diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index d706d32356..412c8dc106 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -44,13 +44,13 @@ ov_genai_build_jinja2cpp() file(GLOB SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") -set(TARGET_NAME generate_pipeline_lib) +set(TARGET_NAME genai) add_library(${TARGET_NAME} SHARED ${SOURCE_FILES}) target_include_directories(${TARGET_NAME} # TODO: remove it, because beam_search algo should not be exposed to end users - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../text_generation/causal_lm/cpp/ - PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) + PRIVATE "$" + PUBLIC "$") target_link_libraries(${TARGET_NAME} PUBLIC openvino::runtime PRIVATE nlohmann_json::nlohmann_json jinja2cpp) @@ -58,11 +58,54 @@ target_compile_definitions(${TARGET_NAME} PRIVATE OPENVINO_TOKENIZERS_PATH=\"$" - "${CMAKE_CURRENT_SOURCE_DIR}/../python/openvino_genai/$" - COMMENT "Copy generate_pipeline_lib to src/python/openvino_genai") + "$" + "${CMAKE_CURRENT_SOURCE_DIR}/../python/openvino_genai/$" + COMMENT "Copy genai to src/python/openvino_genai") + +export(TARGETS genai NAMESPACE openvino:: FILE "${CMAKE_BINARY_DIR}/openvino_genaiConfig.cmake") # TODO: try to merge +install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION . COMPONENT core_genai RUNTIME DESTINATION . COMPONENT core_genai) + +include(GenerateExportHeader) + +generate_export_header(genai) +set_property(TARGET genai PROPERTY VERSION ${openvino_genai_VERSION}) +set_property(TARGET genai PROPERTY SOVERSION 3) +set_property(TARGET genai PROPERTY INTERFACE_genai_MAJOR_VERSION 3) +set_property(TARGET genai APPEND PROPERTY COMPATIBLE_INTERFACE_STRING genai_MAJOR_VERSION) + +string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" ARCH_FOLDER) +if(X86_64) + set(ARCH_FOLDER intel64) +elseif(X86) + set(ARCH_FOLDER ia32) +elseif(MSVC AND ARM) + set(ARCH_FOLDER arm) +elseif((MSVC OR APPLE) AND AARCH64) + set(ARCH_FOLDER arm64) +elseif(UNIVERSAL2) + set(ARCH_FOLDER universal2) +elseif(ARCH_FOLDER STREQUAL "x86_64" OR ARCH_FOLDER STREQUAL "amd64" # Windows detects Intel's 64-bit CPU as AMD64 + OR CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64") + set(ARCH_FOLDER intel64) +endif() +install(TARGETS genai EXPORT openvino_genaiTargets + LIBRARY DESTINATION runtime/lib/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} COMPONENT core_genai_dev + ARCHIVE DESTINATION runtime/lib/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} COMPONENT core_genai_dev + RUNTIME DESTINATION runtime/bin/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} COMPONENT core_genai_dev + INCLUDES DESTINATION runtime/include) +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/" DESTINATION runtime/include COMPONENT core_genai_dev) + +include(CMakePackageConfigHelpers) +write_basic_package_version_file("${CMAKE_BINARY_DIR}/openvino_genaiConfigVersion.cmake" VERSION ${openvino_genai_VERSION} COMPATIBILITY AnyNewerVersion) + +export(EXPORT openvino_genaiTargets FILE "${CMAKE_BINARY_DIR}/openvino_genaiTargets.cmake" NAMESPACE openvino::) +configure_file(cmake/openvino_genaiConfig.cmake "${CMAKE_BINARY_DIR}/openvino_genaiConfig.cmake" COPYONLY) + +install(EXPORT openvino_genaiTargets FILE openvino_genaiTargets.cmake NAMESPACE openvino:: DESTINATION runtime/cmake) +install(FILES cmake/openvino_genaiConfig.cmake "${CMAKE_BINARY_DIR}/openvino_genaiConfigVersion.cmake" + DESTINATION runtime/cmake COMPONENT core_genai_dev) diff --git a/src/cpp/cmake/openvino_genaiConfig.cmake b/src/cpp/cmake/openvino_genaiConfig.cmake new file mode 100644 index 0000000000..9c423425d2 --- /dev/null +++ b/src/cpp/cmake/openvino_genaiConfig.cmake @@ -0,0 +1,4 @@ +include(CMakeFindDependencyMacro) +find_dependency(OpenVINO COMPONENTS Runtime) + +include("${CMAKE_CURRENT_LIST_DIR}/openvino_genaiTargets.cmake") diff --git a/src/cpp/include/openvino/genai/generation_config.hpp b/src/cpp/include/openvino_genai/generation_config.hpp similarity index 99% rename from src/cpp/include/openvino/genai/generation_config.hpp rename to src/cpp/include/openvino_genai/generation_config.hpp index e1f2151d49..45bef36574 100644 --- a/src/cpp/include/openvino/genai/generation_config.hpp +++ b/src/cpp/include/openvino_genai/generation_config.hpp @@ -9,7 +9,7 @@ #include "openvino/runtime/compiled_model.hpp" #include "openvino/runtime/infer_request.hpp" -#include "openvino/genai/tokenizer.hpp" +#include "openvino_genai/tokenizer.hpp" namespace ov { diff --git a/src/cpp/include/openvino/genai/llm_pipeline.hpp b/src/cpp/include/openvino_genai/llm_pipeline.hpp similarity index 98% rename from src/cpp/include/openvino/genai/llm_pipeline.hpp rename to src/cpp/include/openvino_genai/llm_pipeline.hpp index b25d11ecd4..68348b3ed6 100644 --- a/src/cpp/include/openvino/genai/llm_pipeline.hpp +++ b/src/cpp/include/openvino_genai/llm_pipeline.hpp @@ -7,9 +7,9 @@ #include #include -#include "openvino/genai/generation_config.hpp" -#include "openvino/genai/tokenizer.hpp" -#include "openvino/genai/streamer_base.hpp" +#include "openvino_genai/generation_config.hpp" +#include "openvino_genai/tokenizer.hpp" +#include "openvino_genai/streamer_base.hpp" namespace ov { diff --git a/src/cpp/include/openvino/genai/streamer_base.hpp b/src/cpp/include/openvino_genai/streamer_base.hpp similarity index 94% rename from src/cpp/include/openvino/genai/streamer_base.hpp rename to src/cpp/include/openvino_genai/streamer_base.hpp index 3f0879d702..46587b3e74 100644 --- a/src/cpp/include/openvino/genai/streamer_base.hpp +++ b/src/cpp/include/openvino_genai/streamer_base.hpp @@ -3,7 +3,7 @@ #pragma once -#include "openvino/genai/tokenizer.hpp" +#include "openvino_genai/tokenizer.hpp" namespace ov { diff --git a/src/cpp/include/openvino/genai/tokenizer.hpp b/src/cpp/include/openvino_genai/tokenizer.hpp similarity index 96% rename from src/cpp/include/openvino/genai/tokenizer.hpp rename to src/cpp/include/openvino_genai/tokenizer.hpp index 0d55d9b0fe..fd5bb775ab 100644 --- a/src/cpp/include/openvino/genai/tokenizer.hpp +++ b/src/cpp/include/openvino_genai/tokenizer.hpp @@ -7,14 +7,14 @@ #include #include #include -#include "openvino/genai/visibility.hpp" +#include "openvino_genai/visibility.hpp" namespace ov { /** * @brief class is used to encode prompts and decode resulting tokens */ -class OPENVINO_GENAI_EXPORTS Tokenizer { +class openvino_genai_EXPORTS Tokenizer { public: /** * @brief ov::Tokenizer constructor. diff --git a/src/cpp/include/openvino/genai/visibility.hpp b/src/cpp/include/openvino_genai/visibility.hpp similarity index 100% rename from src/cpp/include/openvino/genai/visibility.hpp rename to src/cpp/include/openvino_genai/visibility.hpp diff --git a/src/cpp/src/generation_config.cpp b/src/cpp/src/generation_config.cpp index 68fa0c86ab..84900e5e2e 100644 --- a/src/cpp/src/generation_config.cpp +++ b/src/cpp/src/generation_config.cpp @@ -7,7 +7,7 @@ #include #include -#include "openvino/genai/generation_config.hpp" +#include "openvino_genai/generation_config.hpp" #include "generation_config_helper.hpp" diff --git a/src/cpp/src/generation_config_helper.hpp b/src/cpp/src/generation_config_helper.hpp index f4e5839990..cfd6e295d9 100644 --- a/src/cpp/src/generation_config_helper.hpp +++ b/src/cpp/src/generation_config_helper.hpp @@ -3,7 +3,7 @@ #pragma once -#include "openvino/genai/generation_config.hpp" +#include "openvino_genai/generation_config.hpp" namespace ov { diff --git a/src/cpp/src/greedy_decoding.cpp b/src/cpp/src/greedy_decoding.cpp index 3298553a76..19f028c54c 100644 --- a/src/cpp/src/greedy_decoding.cpp +++ b/src/cpp/src/greedy_decoding.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #include "generation_config_helper.hpp" -#include "openvino/genai/llm_pipeline.hpp" +#include "openvino_genai/llm_pipeline.hpp" #include "utils.hpp" namespace ov { diff --git a/src/cpp/src/group_beam_searcher.hpp b/src/cpp/src/group_beam_searcher.hpp index 91f3ef4096..fa4ed632f4 100644 --- a/src/cpp/src/group_beam_searcher.hpp +++ b/src/cpp/src/group_beam_searcher.hpp @@ -4,8 +4,8 @@ #pragma once #include -#include "openvino/genai/generation_config.hpp" -#include "openvino/genai/llm_pipeline.hpp" +#include "openvino_genai/generation_config.hpp" +#include "openvino_genai/llm_pipeline.hpp" namespace ov { EncodedResults beam_search(ov::InferRequest& lm, ov::Tensor prompts, ov::Tensor attentin_mask, GenerationConfig sampling_params); diff --git a/src/cpp/src/llm_pipeline.cpp b/src/cpp/src/llm_pipeline.cpp index 9d4161f859..0618633e24 100644 --- a/src/cpp/src/llm_pipeline.cpp +++ b/src/cpp/src/llm_pipeline.cpp @@ -10,8 +10,8 @@ #include #include -#include "openvino/genai/generation_config.hpp" -#include "openvino/genai/llm_pipeline.hpp" +#include "openvino_genai/generation_config.hpp" +#include "openvino_genai/llm_pipeline.hpp" #include "utils.hpp" #include "generation_config_helper.hpp" #include "group_beam_searcher.hpp" diff --git a/src/cpp/src/text_callback_streamer.hpp b/src/cpp/src/text_callback_streamer.hpp index d9c1ba3ee5..cb9b9af124 100644 --- a/src/cpp/src/text_callback_streamer.hpp +++ b/src/cpp/src/text_callback_streamer.hpp @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#include "openvino/genai/streamer_base.hpp" -#include "openvino/genai/tokenizer.hpp" +#include "openvino_genai/streamer_base.hpp" +#include "openvino_genai/tokenizer.hpp" namespace ov { diff --git a/src/cpp/src/tokenizer.cpp b/src/cpp/src/tokenizer.cpp index 09d64460a2..2b7673e209 100644 --- a/src/cpp/src/tokenizer.cpp +++ b/src/cpp/src/tokenizer.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include "openvino/genai/tokenizer.hpp" +#include "openvino_genai/tokenizer.hpp" #include "utils.hpp" namespace { diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index b73950e828..1de9259137 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -16,16 +16,17 @@ if(NOT pybind11_POPULATED) endif() pybind11_add_module(py_generate_pipeline py_generate_pipeline.cpp) -target_link_libraries(py_generate_pipeline PRIVATE generate_pipeline_lib) +target_link_libraries(py_generate_pipeline PRIVATE openvino_genai) -install(TARGETS py_generate_pipeline LIBRARY DESTINATION . COMPONENT genai_python) +# find_package(Python3 REQUIRED COMPONENTS Interpreter Development) +install(TARGETS py_generate_pipeline LIBRARY DESTINATION . COMPONENT pygenai_${Python_VERSION_MAJOR}_${Python_VERSION_MINOR}) # setting RPATH / LC_RPATH depending on platform if(LINUX) - # to find libgenerate_pipeline_lib.so in the same folder + # to find libgenai.so in the same folder set(rpaths "$ORIGIN") elseif(APPLE) - # to find libgenerate_pipeline_lib.dylib in the same folder + # to find libgenai.dylib in the same folder set(rpaths "@loader_path") if(DEFINED SKBUILD) # in case we build pip package, we need to refer to libopenvino.dylib from 'openvino' package diff --git a/src/python/py_generate_pipeline.cpp b/src/python/py_generate_pipeline.cpp index 74cbe7e27d..3c522c1761 100644 --- a/src/python/py_generate_pipeline.cpp +++ b/src/python/py_generate_pipeline.cpp @@ -4,7 +4,7 @@ #include #include #include -#include "openvino/genai/llm_pipeline.hpp" +#include "openvino_genai/llm_pipeline.hpp" namespace py = pybind11; using namespace ov; diff --git a/text_generation/causal_lm/cpp/CMakeLists.txt b/text_generation/causal_lm/cpp/CMakeLists.txt index 8b6281f50e..43db04a33f 100644 --- a/text_generation/causal_lm/cpp/CMakeLists.txt +++ b/text_generation/causal_lm/cpp/CMakeLists.txt @@ -4,23 +4,31 @@ cmake_minimum_required(VERSION 3.15) project(causal_lm) -if(NOT TARGET openvino_tokenizers) -add_subdirectory(../../../thirdparty/openvino_tokenizers/ "${CMAKE_CURRENT_BINARY_DIR}/openvino_tokenizers/") +if(TARGET openvino_tokenizers) + set(OPENVINO_TOKENIZERS_PATH $) +else() + set(OPENVINO_TOKENIZERS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../bin/openvino_tokenizers.dll) # TODO: I'll go away after the generate() gets a way to find openvino_tokenizers endif() +if(openvino_genai_SOURCE_DIR) + set(openvino_genai_DIR "${CMAKE_BINARY_DIR}") +endif() + +find_package(openvino_genai REQUIRED) + add_executable(greedy_causal_lm greedy_causal_lm.cpp) -target_compile_definitions(greedy_causal_lm PRIVATE OPENVINO_TOKENIZERS_PATH=\"$\") -target_link_libraries(greedy_causal_lm PRIVATE generate_pipeline_lib) +target_compile_definitions(greedy_causal_lm PRIVATE OPENVINO_TOKENIZERS_PATH="${OPENVINO_TOKENIZERS_PATH}") +target_link_libraries(greedy_causal_lm PRIVATE openvino::genai) set_target_properties(greedy_causal_lm PROPERTIES CXX_STANDARD 17) set_target_properties(greedy_causal_lm PROPERTIES CXX_STANDARD_REQUIRED ON) add_executable(beam_search_causal_lm beam_search_causal_lm.cpp) -target_link_libraries(beam_search_causal_lm PRIVATE generate_pipeline_lib) +target_link_libraries(beam_search_causal_lm PRIVATE openvino::genai) set_target_properties(beam_search_causal_lm PROPERTIES CXX_STANDARD 17) set_target_properties(beam_search_causal_lm PROPERTIES CXX_STANDARD_REQUIRED ON) add_executable(speculative_decoding_lm speculative_decoding_lm.cpp) -target_compile_definitions(speculative_decoding_lm PRIVATE OPENVINO_TOKENIZERS_PATH=\"$\") +target_compile_definitions(speculative_decoding_lm PRIVATE OPENVINO_TOKENIZERS_PATH="${OPENVINO_TOKENIZERS_PATH}") target_include_directories(speculative_decoding_lm PRIVATE ./) find_package(OpenVINO REQUIRED COMPONENTS Runtime) target_link_libraries(speculative_decoding_lm PRIVATE openvino::runtime) @@ -30,7 +38,7 @@ find_package(TBB REQUIRED COMPONENTS tbb) target_link_libraries(speculative_decoding_lm PRIVATE TBB::tbb) add_executable(prompt_lookup_decoding_lm prompt_lookup_decoding_lm.cpp) -target_compile_definitions(prompt_lookup_decoding_lm PRIVATE OPENVINO_TOKENIZERS_PATH=\"$\") +target_compile_definitions(prompt_lookup_decoding_lm PRIVATE OPENVINO_TOKENIZERS_PATH="${OPENVINO_TOKENIZERS_PATH}") target_include_directories(prompt_lookup_decoding_lm PRIVATE ./) find_package(OpenVINO REQUIRED COMPONENTS Runtime) target_link_libraries(prompt_lookup_decoding_lm PRIVATE openvino::runtime) @@ -40,13 +48,13 @@ find_package(TBB REQUIRED COMPONENTS tbb) target_link_libraries(prompt_lookup_decoding_lm PRIVATE TBB::tbb) add_executable(generate_sample generate_pipeline/generate_sample.cpp) -target_link_libraries(generate_sample PRIVATE generate_pipeline_lib) +target_link_libraries(generate_sample PRIVATE openvino::genai) target_include_directories(generate_sample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") set_target_properties(generate_sample PROPERTIES CXX_STANDARD 17) set_target_properties(generate_sample PROPERTIES CXX_STANDARD_REQUIRED ON) add_executable(chat_sample generate_pipeline/chat_sample.cpp) -target_link_libraries(chat_sample PRIVATE generate_pipeline_lib) +target_link_libraries(chat_sample PRIVATE openvino::genai) target_include_directories(chat_sample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") set_target_properties(chat_sample PROPERTIES CXX_STANDARD 17) set_target_properties(chat_sample PROPERTIES CXX_STANDARD_REQUIRED ON) diff --git a/text_generation/causal_lm/cpp/beam_search_causal_lm.cpp b/text_generation/causal_lm/cpp/beam_search_causal_lm.cpp index 056c923224..abef50f3d6 100644 --- a/text_generation/causal_lm/cpp/beam_search_causal_lm.cpp +++ b/text_generation/causal_lm/cpp/beam_search_causal_lm.cpp @@ -1,7 +1,7 @@ // Copyright (C) 2023-2024 Intel Corporation // SPDX-License-Identifier: Apache-2.0 -#include +#include int main(int argc, char* argv[]) try { if (argc < 3) { diff --git a/text_generation/causal_lm/cpp/generate_pipeline/chat_sample.cpp b/text_generation/causal_lm/cpp/generate_pipeline/chat_sample.cpp index b1ecb5f5f4..e1a92b346b 100644 --- a/text_generation/causal_lm/cpp/generate_pipeline/chat_sample.cpp +++ b/text_generation/causal_lm/cpp/generate_pipeline/chat_sample.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include "openvino/genai/llm_pipeline.hpp" +#include "openvino_genai/llm_pipeline.hpp" using namespace std; diff --git a/text_generation/causal_lm/cpp/generate_pipeline/generate_sample.cpp b/text_generation/causal_lm/cpp/generate_pipeline/generate_sample.cpp index 84e07c394b..744c3899f2 100644 --- a/text_generation/causal_lm/cpp/generate_pipeline/generate_sample.cpp +++ b/text_generation/causal_lm/cpp/generate_pipeline/generate_sample.cpp @@ -1,7 +1,7 @@ // Copyright (C) 2023-2024 Intel Corporation // SPDX-License-Identifier: Apache-2.0 -#include "openvino/genai/llm_pipeline.hpp" +#include "openvino_genai/llm_pipeline.hpp" using std::cout; using std::endl; diff --git a/text_generation/causal_lm/cpp/greedy_causal_lm.cpp b/text_generation/causal_lm/cpp/greedy_causal_lm.cpp index 7b1dde4dc8..54e0b31f50 100644 --- a/text_generation/causal_lm/cpp/greedy_causal_lm.cpp +++ b/text_generation/causal_lm/cpp/greedy_causal_lm.cpp @@ -1,7 +1,7 @@ // Copyright (C) 2023-2024 Intel Corporation // SPDX-License-Identifier: Apache-2.0 -#include "openvino/genai/llm_pipeline.hpp" +#include "openvino_genai/llm_pipeline.hpp" int main(int argc, char* argv[]) try { if (3 > argc || argc > 4) From c22d6c18e47ff32119e34dfd3d102b9b22b98c40 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Thu, 16 May 2024 13:12:00 +0400 Subject: [PATCH 02/24] dont modify whats not mine --- src/cpp/CMakeLists.txt | 2 +- src/cpp/include/openvino_genai/tokenizer.hpp | 2 +- src/cpp/include/openvino_genai/visibility.hpp | 4 ++-- src/python/CMakeLists.txt | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 412c8dc106..91be0afbb5 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -50,7 +50,7 @@ add_library(${TARGET_NAME} SHARED ${SOURCE_FILES}) target_include_directories(${TARGET_NAME} # TODO: remove it, because beam_search algo should not be exposed to end users PRIVATE "$" - PUBLIC "$") + PUBLIC "$" "$") target_link_libraries(${TARGET_NAME} PUBLIC openvino::runtime PRIVATE nlohmann_json::nlohmann_json jinja2cpp) diff --git a/src/cpp/include/openvino_genai/tokenizer.hpp b/src/cpp/include/openvino_genai/tokenizer.hpp index fd5bb775ab..ce90784bf6 100644 --- a/src/cpp/include/openvino_genai/tokenizer.hpp +++ b/src/cpp/include/openvino_genai/tokenizer.hpp @@ -14,7 +14,7 @@ namespace ov { /** * @brief class is used to encode prompts and decode resulting tokens */ -class openvino_genai_EXPORTS Tokenizer { +class OPENVINO_GENAI_EXPORTS Tokenizer { public: /** * @brief ov::Tokenizer constructor. diff --git a/src/cpp/include/openvino_genai/visibility.hpp b/src/cpp/include/openvino_genai/visibility.hpp index 3a143da92a..6a8cf756e0 100644 --- a/src/cpp/include/openvino_genai/visibility.hpp +++ b/src/cpp/include/openvino_genai/visibility.hpp @@ -3,8 +3,8 @@ #include "openvino/core/visibility.hpp" -#ifdef generate_pipeline_lib_EXPORTS +#ifdef genai_EXPORTS # define OPENVINO_GENAI_EXPORTS OPENVINO_CORE_EXPORTS #else # define OPENVINO_GENAI_EXPORTS OPENVINO_CORE_IMPORTS -#endif // generate_pipeline_lib_EXPORTS +#endif // genai_EXPORTS diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 1de9259137..a2b1f6f7b7 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -16,7 +16,7 @@ if(NOT pybind11_POPULATED) endif() pybind11_add_module(py_generate_pipeline py_generate_pipeline.cpp) -target_link_libraries(py_generate_pipeline PRIVATE openvino_genai) +target_link_libraries(py_generate_pipeline PRIVATE genai) # find_package(Python3 REQUIRED COMPONENTS Interpreter Development) install(TARGETS py_generate_pipeline LIBRARY DESTINATION . COMPONENT pygenai_${Python_VERSION_MAJOR}_${Python_VERSION_MINOR}) From 8976cadda25691d298df8e0e343eee01a44616ac Mon Sep 17 00:00:00 2001 From: Wovchena Date: Thu, 16 May 2024 20:15:52 +0400 Subject: [PATCH 03/24] alias --- .github/workflows/genai_package.yml | 38 ++++++++++++++++++++++++ CMakeLists.txt | 2 +- src/cpp/CMakeLists.txt | 1 + src/cpp/cmake/openvino_genaiConfig.cmake | 4 ++- 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/genai_package.yml diff --git a/.github/workflows/genai_package.yml b/.github/workflows/genai_package.yml new file mode 100644 index 0000000000..496a05a805 --- /dev/null +++ b/.github/workflows/genai_package.yml @@ -0,0 +1,38 @@ +name: genai_package +on: pull_request +jobs: + genai_package_ubuntu: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: actions/setup-python@v4 + with: + python-version: 3.8 + - run: mkdir ./ov/ + - run: curl https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.1.0-14758-22bd6ff0494/l_openvino_toolkit_centos7_2024.1.0.dev20240315_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz # Install CentOS7 instead of Ubuntu to match PyPI distribution ABI + - run: sudo ./ov/install_dependencies/install_openvino_dependencies.sh + - run: source ./ov/setupvars.sh && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ + - run: source ./ov/setupvars.sh && cmake --build ./build/ --config Release --target package -j + + genai_package_windows: + runs-on: windows-latest + defaults: + run: + shell: cmd + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: actions/setup-python@v4 + with: + python-version: 3.8 + - 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 + - run: unzip ov.zip + - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ + - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && cmake --build ./build/ --config Release --target package -j + - run: python -m pip install "numpy<1.27" + - run: set "PYTHONPATH=./src/python;" && call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && python -c "from openvino_genai.py_generate_pipeline import LLMPipeline" # cmd evaluates variables in a different way. Setting PYTHONPATH before setupvars.bat instead of doing that after solves that. + - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && python -m pip install . + - run: python -c "from openvino_genai.py_generate_pipeline import LLMPipeline" diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f3086f212..6ce969be4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release" "Debug" "RelWithD project(openvino_genai) add_subdirectory(./thirdparty/openvino_tokenizers/ "${CMAKE_CURRENT_BINARY_DIR}/openvino_tokenizers/") -set(openvino_genai_VERSION 2024.1.0.0) +set(openvino_genai_VERSION 2024.1.0.0) # TODO: set project version add_subdirectory(src) add_subdirectory(text_generation/causal_lm/cpp) diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 91be0afbb5..7b5a7b21f8 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -46,6 +46,7 @@ file(GLOB SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") set(TARGET_NAME genai) add_library(${TARGET_NAME} SHARED ${SOURCE_FILES}) +add_library(openvino::genai ALIAS genai) target_include_directories(${TARGET_NAME} # TODO: remove it, because beam_search algo should not be exposed to end users diff --git a/src/cpp/cmake/openvino_genaiConfig.cmake b/src/cpp/cmake/openvino_genaiConfig.cmake index 9c423425d2..a986b3b716 100644 --- a/src/cpp/cmake/openvino_genaiConfig.cmake +++ b/src/cpp/cmake/openvino_genaiConfig.cmake @@ -1,4 +1,6 @@ include(CMakeFindDependencyMacro) find_dependency(OpenVINO COMPONENTS Runtime) -include("${CMAKE_CURRENT_LIST_DIR}/openvino_genaiTargets.cmake") +if(NOT TARGET genai) + include("${CMAKE_CURRENT_LIST_DIR}/openvino_genaiTargets.cmake") +endif() From 74885f77a056e6e4a8697c0d3d462023c8feb57a Mon Sep 17 00:00:00 2001 From: Wovchena Date: Thu, 16 May 2024 20:56:54 +0400 Subject: [PATCH 04/24] fix component name --- CMakeLists.txt | 6 +----- pyproject.toml | 2 +- src/cpp/CMakeLists.txt | 8 ++++---- src/python/CMakeLists.txt | 2 +- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ce969be4d..e605a304f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,17 +7,13 @@ cmake_minimum_required(VERSION 3.15) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build type") set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release" "Debug" "RelWithDebInfo" "MinSizeRel") -project(openvino_genai) +project(openvino_genai VERSION 2024.2.0.0) add_subdirectory(./thirdparty/openvino_tokenizers/ "${CMAKE_CURRENT_BINARY_DIR}/openvino_tokenizers/") -set(openvino_genai_VERSION 2024.1.0.0) # TODO: set project version add_subdirectory(src) add_subdirectory(text_generation/causal_lm/cpp) install(DIRECTORY text_generation/causal_lm/cpp/ DESTINATION samples/cpp/causal_lm COMPONENT cpp_samples_genai) - install(FILES LICENSE third-party-programs.txt DESTINATION licenses_genai COMPONENT licensing_genai) # TODO: how to merge with OPenvino - -set(CPACK_PACKAGE_VERSION ${openvino_genai_VERSION}) set(CPACK_GENERATOR "ZIP") include(CPack) diff --git a/pyproject.toml b/pyproject.toml index 87a4ada5e3..9f2e7d58d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ dependencies = [ cmake.source-dir = "./" cmake.build-type = "Release" cmake.targets = ["py_generate_pipeline", "genai"] -install.components = ["genai", "genai_python"] +install.components = ["genai", "pygenai"] sdist.cmake = true wheel.packages = ["src/python/openvino_genai"] wheel.install-dir = "openvino_genai" diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 7b5a7b21f8..c174fd2482 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -74,10 +74,10 @@ install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION . COMPONENT core_genai RUNTIM include(GenerateExportHeader) generate_export_header(genai) -set_property(TARGET genai PROPERTY VERSION ${openvino_genai_VERSION}) -set_property(TARGET genai PROPERTY SOVERSION 3) -set_property(TARGET genai PROPERTY INTERFACE_genai_MAJOR_VERSION 3) -set_property(TARGET genai APPEND PROPERTY COMPATIBLE_INTERFACE_STRING genai_MAJOR_VERSION) +# set_property(TARGET genai PROPERTY VERSION ${openvino_genai_VERSION}) +# set_property(TARGET genai PROPERTY SOVERSION 3) +# set_property(TARGET genai PROPERTY INTERFACE_genai_MAJOR_VERSION 3) +# set_property(TARGET genai APPEND PROPERTY COMPATIBLE_INTERFACE_STRING genai_MAJOR_VERSION) string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" ARCH_FOLDER) if(X86_64) diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index a2b1f6f7b7..4f505c6c98 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -19,7 +19,7 @@ pybind11_add_module(py_generate_pipeline py_generate_pipeline.cpp) target_link_libraries(py_generate_pipeline PRIVATE genai) # find_package(Python3 REQUIRED COMPONENTS Interpreter Development) -install(TARGETS py_generate_pipeline LIBRARY DESTINATION . COMPONENT pygenai_${Python_VERSION_MAJOR}_${Python_VERSION_MINOR}) +install(TARGETS py_generate_pipeline LIBRARY DESTINATION . COMPONENT pygenai) # setting RPATH / LC_RPATH depending on platform if(LINUX) From ca6f897f005aa2df1807ab65e28e01da337cc44f Mon Sep 17 00:00:00 2001 From: Wovchena Date: Thu, 16 May 2024 21:12:24 +0400 Subject: [PATCH 05/24] raname component --- pyproject.toml | 2 +- src/python/CMakeLists.txt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9f2e7d58d1..cb373e12c8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ dependencies = [ cmake.source-dir = "./" cmake.build-type = "Release" cmake.targets = ["py_generate_pipeline", "genai"] -install.components = ["genai", "pygenai"] +install.components = ["core_genai", "pygenai"] sdist.cmake = true wheel.packages = ["src/python/openvino_genai"] wheel.install-dir = "openvino_genai" diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 4f505c6c98..11128e8184 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -18,7 +18,6 @@ endif() pybind11_add_module(py_generate_pipeline py_generate_pipeline.cpp) target_link_libraries(py_generate_pipeline PRIVATE genai) -# find_package(Python3 REQUIRED COMPONENTS Interpreter Development) install(TARGETS py_generate_pipeline LIBRARY DESTINATION . COMPONENT pygenai) # setting RPATH / LC_RPATH depending on platform From ebb027e077a06c94e18c2dd08157f1fa722dac04 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Thu, 16 May 2024 22:37:42 +0400 Subject: [PATCH 06/24] remove leftovers --- src/cpp/CMakeLists.txt | 43 +++++++------------ ...ig.cmake => openvino_genaiConfig.cmake.in} | 4 ++ src/python/CMakeLists.txt | 2 +- text_generation/causal_lm/cpp/CMakeLists.txt | 8 ++-- 4 files changed, 23 insertions(+), 34 deletions(-) rename src/cpp/{cmake/openvino_genaiConfig.cmake => openvino_genaiConfig.cmake.in} (75%) diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index c174fd2482..b4db77b04b 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -46,7 +46,7 @@ file(GLOB SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") set(TARGET_NAME genai) add_library(${TARGET_NAME} SHARED ${SOURCE_FILES}) -add_library(openvino::genai ALIAS genai) +add_library(openvino::${TARGET_NAME} ALIAS ${TARGET_NAME}) target_include_directories(${TARGET_NAME} # TODO: remove it, because beam_search algo should not be exposed to end users @@ -59,26 +59,15 @@ target_compile_definitions(${TARGET_NAME} PRIVATE OPENVINO_TOKENIZERS_PATH=\"$" - "${CMAKE_CURRENT_SOURCE_DIR}/../python/openvino_genai/$" - COMMENT "Copy genai to src/python/openvino_genai") + "$" + "${CMAKE_CURRENT_SOURCE_DIR}/../python/openvino_genai/$" + COMMENT "Copy ${TARGET_NAME} to src/python/openvino_genai") -export(TARGETS genai NAMESPACE openvino:: FILE "${CMAKE_BINARY_DIR}/openvino_genaiConfig.cmake") # TODO: try to merge install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION . COMPONENT core_genai RUNTIME DESTINATION . COMPONENT core_genai) -include(GenerateExportHeader) - -generate_export_header(genai) -# set_property(TARGET genai PROPERTY VERSION ${openvino_genai_VERSION}) -# set_property(TARGET genai PROPERTY SOVERSION 3) -# set_property(TARGET genai PROPERTY INTERFACE_genai_MAJOR_VERSION 3) -# set_property(TARGET genai APPEND PROPERTY COMPATIBLE_INTERFACE_STRING genai_MAJOR_VERSION) - string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" ARCH_FOLDER) if(X86_64) set(ARCH_FOLDER intel64) @@ -90,23 +79,21 @@ elseif((MSVC OR APPLE) AND AARCH64) set(ARCH_FOLDER arm64) elseif(UNIVERSAL2) set(ARCH_FOLDER universal2) -elseif(ARCH_FOLDER STREQUAL "x86_64" OR ARCH_FOLDER STREQUAL "amd64" # Windows detects Intel's 64-bit CPU as AMD64 +elseif(ARCH_FOLDER STREQUAL "x86_64" OR ARCH_FOLDER STREQUAL "amd64" # Windows detects Intel's 64-bit CPU as AMD64 OR CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64") set(ARCH_FOLDER intel64) endif() -install(TARGETS genai EXPORT openvino_genaiTargets +install(TARGETS ${TARGET_NAME} EXPORT openvino_genaiTargets LIBRARY DESTINATION runtime/lib/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} COMPONENT core_genai_dev ARCHIVE DESTINATION runtime/lib/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} COMPONENT core_genai_dev RUNTIME DESTINATION runtime/bin/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} COMPONENT core_genai_dev INCLUDES DESTINATION runtime/include) -install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/" DESTINATION runtime/include COMPONENT core_genai_dev) - +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION runtime/include COMPONENT core_genai_dev) +install(EXPORT openvino_genaiTargets FILE openvino_genaiTargets.cmake NAMESPACE openvino:: DESTINATION runtime/cmake) include(CMakePackageConfigHelpers) -write_basic_package_version_file("${CMAKE_BINARY_DIR}/openvino_genaiConfigVersion.cmake" VERSION ${openvino_genai_VERSION} COMPATIBILITY AnyNewerVersion) - +configure_package_config_file(openvino_genaiConfig.cmake.in "${CMAKE_BINARY_DIR}/openvino_genaiConfig.cmake" INSTALL_DESTINATION runtime/cmake) +install(FILES "${CMAKE_BINARY_DIR}/openvino_genaiConfig.cmake" "${CMAKE_BINARY_DIR}/openvino_genaiConfigVersion.cmake" DESTINATION runtime/cmake COMPONENT core_genai_dev) +include(CMakePackageConfigHelpers) +write_basic_package_version_file("${CMAKE_BINARY_DIR}/openvino_genaiConfigVersion.cmake" VERSION ${CMAKE_PROJECT_VERSION} COMPATIBILITY AnyNewerVersion) export(EXPORT openvino_genaiTargets FILE "${CMAKE_BINARY_DIR}/openvino_genaiTargets.cmake" NAMESPACE openvino::) -configure_file(cmake/openvino_genaiConfig.cmake "${CMAKE_BINARY_DIR}/openvino_genaiConfig.cmake" COPYONLY) - -install(EXPORT openvino_genaiTargets FILE openvino_genaiTargets.cmake NAMESPACE openvino:: DESTINATION runtime/cmake) -install(FILES cmake/openvino_genaiConfig.cmake "${CMAKE_BINARY_DIR}/openvino_genaiConfigVersion.cmake" - DESTINATION runtime/cmake COMPONENT core_genai_dev) +# export(TARGETS ${TARGET_NAME} NAMESPACE openvino:: FILE "${CMAKE_BINARY_DIR}/openvino_genaiConfig.cmake") TODO diff --git a/src/cpp/cmake/openvino_genaiConfig.cmake b/src/cpp/openvino_genaiConfig.cmake.in similarity index 75% rename from src/cpp/cmake/openvino_genaiConfig.cmake rename to src/cpp/openvino_genaiConfig.cmake.in index a986b3b716..abfd33b524 100644 --- a/src/cpp/cmake/openvino_genaiConfig.cmake +++ b/src/cpp/openvino_genaiConfig.cmake.in @@ -1,6 +1,10 @@ +@PACKAGE_INIT@ + include(CMakeFindDependencyMacro) find_dependency(OpenVINO COMPONENTS Runtime) if(NOT TARGET genai) include("${CMAKE_CURRENT_LIST_DIR}/openvino_genaiTargets.cmake") endif() + +check_required_components(openvino_genai) diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 11128e8184..a6195eda25 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -37,7 +37,7 @@ if(rpaths) set_target_properties(py_generate_pipeline PROPERTIES INSTALL_RPATH "${rpaths}") endif() -# Populate python with the libraries to allow skipping wheel installation +# Copy the library to python to allow skipping wheel installation add_custom_command(TARGET py_generate_pipeline POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy "$" diff --git a/text_generation/causal_lm/cpp/CMakeLists.txt b/text_generation/causal_lm/cpp/CMakeLists.txt index 43db04a33f..7b0beef308 100644 --- a/text_generation/causal_lm/cpp/CMakeLists.txt +++ b/text_generation/causal_lm/cpp/CMakeLists.txt @@ -10,11 +10,9 @@ else() set(OPENVINO_TOKENIZERS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../bin/openvino_tokenizers.dll) # TODO: I'll go away after the generate() gets a way to find openvino_tokenizers endif() -if(openvino_genai_SOURCE_DIR) - set(openvino_genai_DIR "${CMAKE_BINARY_DIR}") -endif() - -find_package(openvino_genai REQUIRED) +find_package(openvino_genai REQUIRED + PATHS "${CMAKE_BINARY_DIR}" # Reuse the package from the build. The lowest priority. +) add_executable(greedy_causal_lm greedy_causal_lm.cpp) target_compile_definitions(greedy_causal_lm PRIVATE OPENVINO_TOKENIZERS_PATH="${OPENVINO_TOKENIZERS_PATH}") From a6357b6a06d514581f6a036c8b5c791bf03c366d Mon Sep 17 00:00:00 2001 From: Wovchena Date: Thu, 16 May 2024 22:49:41 +0400 Subject: [PATCH 07/24] test install --- .github/workflows/genai_package.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/genai_package.yml b/.github/workflows/genai_package.yml index 496a05a805..4e96e939d7 100644 --- a/.github/workflows/genai_package.yml +++ b/.github/workflows/genai_package.yml @@ -32,7 +32,6 @@ jobs: - run: unzip ov.zip - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && cmake --build ./build/ --config Release --target package -j - - run: python -m pip install "numpy<1.27" - - run: set "PYTHONPATH=./src/python;" && call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && python -c "from openvino_genai.py_generate_pipeline import LLMPipeline" # cmd evaluates variables in a different way. Setting PYTHONPATH before setupvars.bat instead of doing that after solves that. - - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && python -m pip install . - - run: python -c "from openvino_genai.py_generate_pipeline import LLMPipeline" + - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && cmake --install ./build/ --config Release --prefix w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64 + - run: samples/cpp/build_samples_msvc.bat -b ${{ github.workspace }}/samples-build + - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && ${{ github.workspace }}/samples-build/intel64/Release/greedy_causal_lm asdf From bb5ef004e7d0cad52e248d29bcd26c2981290c77 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Thu, 16 May 2024 23:02:15 +0400 Subject: [PATCH 08/24] call --- .github/workflows/genai_package.yml | 2 +- src/python/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/genai_package.yml b/.github/workflows/genai_package.yml index 4e96e939d7..b93901854d 100644 --- a/.github/workflows/genai_package.yml +++ b/.github/workflows/genai_package.yml @@ -33,5 +33,5 @@ jobs: - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && cmake --build ./build/ --config Release --target package -j - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && cmake --install ./build/ --config Release --prefix w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64 - - run: samples/cpp/build_samples_msvc.bat -b ${{ github.workspace }}/samples-build + - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\samples/cpp/build_samples_msvc.bat -b ${{ github.workspace }}/samples-build - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && ${{ github.workspace }}/samples-build/intel64/Release/greedy_causal_lm asdf diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index a6195eda25..21e20db3ed 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -43,3 +43,4 @@ add_custom_command(TARGET py_generate_pipeline POST_BUILD "$" "${CMAKE_CURRENT_SOURCE_DIR}/openvino_genai/$" COMMENT "Copy py_generate_pipeline to src/python/openvino_genai/") +# TODO: install python into archive From d3d680d36af255c524a045ff677fb2e86e6c65d2 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Thu, 16 May 2024 23:11:53 +0400 Subject: [PATCH 09/24] PATHS --- text_generation/causal_lm/cpp/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/text_generation/causal_lm/cpp/CMakeLists.txt b/text_generation/causal_lm/cpp/CMakeLists.txt index 7b0beef308..d9538176df 100644 --- a/text_generation/causal_lm/cpp/CMakeLists.txt +++ b/text_generation/causal_lm/cpp/CMakeLists.txt @@ -11,7 +11,9 @@ else() endif() find_package(openvino_genai REQUIRED - PATHS "${CMAKE_BINARY_DIR}" # Reuse the package from the build. The lowest priority. + PATHS + "${CMAKE_BINARY_DIR}" # Reuse the package from the build. + ${OpenVINO_DIR} # GenAI may be installed alogside with OpenVINO. ) add_executable(greedy_causal_lm greedy_causal_lm.cpp) From 02d3382520281705479a90f67314bdbe7f04d586 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Thu, 16 May 2024 23:24:23 +0400 Subject: [PATCH 10/24] include path --- .github/workflows/genai_lib.yml | 4 ++-- .github/workflows/genai_package.yml | 6 +++++- src/cpp/CMakeLists.txt | 2 +- text_generation/causal_lm/cpp/CMakeLists.txt | 7 +++---- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/genai_lib.yml b/.github/workflows/genai_lib.yml index 5b8d6db3fe..d647036e4e 100644 --- a/.github/workflows/genai_lib.yml +++ b/.github/workflows/genai_lib.yml @@ -15,9 +15,9 @@ jobs: - run: sudo ./ov/install_dependencies/install_openvino_dependencies.sh - run: source ./ov/setupvars.sh && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ - run: source ./ov/setupvars.sh && cmake --build ./build/ --config Release -j - - run: python -m pip install openvino # Can't load CentOS libraries from the archive + - run: python -m pip install --pre openvino --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly # Can't load CentOS libraries from the archive - run: PYTHONPATH=./src/python/ python -c "from openvino_genai.py_generate_pipeline import LLMPipeline" - - run: source ./ov/setupvars.sh && python -m pip install --pre --upgrade . --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly + - run: source ./ov/setupvars.sh && python -m pip install --pre . --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly - run: python -c "from openvino_genai.py_generate_pipeline import LLMPipeline" genai_lib_windows: diff --git a/.github/workflows/genai_package.yml b/.github/workflows/genai_package.yml index b93901854d..64d265932b 100644 --- a/.github/workflows/genai_package.yml +++ b/.github/workflows/genai_package.yml @@ -33,5 +33,9 @@ jobs: - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && cmake --build ./build/ --config Release --target package -j - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && cmake --install ./build/ --config Release --prefix w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64 - - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\samples/cpp/build_samples_msvc.bat -b ${{ github.workspace }}/samples-build + - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\samples\cpp\build_samples_msvc.bat -b ${{ github.workspace }}/samples-build - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && ${{ github.workspace }}/samples-build/intel64/Release/greedy_causal_lm asdf + - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && python -m pip install --upgrade-strategy eager -r text_generation/causal_lm/cpp/requirements.txt + - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && python -m pip install ./thirdparty/openvino_tokenizers/[transformers] + - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\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 + - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && ${{ github.workspace }}/samples-build/intel64/Release/greedy_causal_lm .\TinyLlama-1.1B-Chat-v1.0\ "" diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index b4db77b04b..7eb2e82611 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -51,7 +51,7 @@ add_library(openvino::${TARGET_NAME} ALIAS ${TARGET_NAME}) target_include_directories(${TARGET_NAME} # TODO: remove it, because beam_search algo should not be exposed to end users PRIVATE "$" - PUBLIC "$" "$") + PUBLIC "$" "$") target_link_libraries(${TARGET_NAME} PUBLIC openvino::runtime PRIVATE nlohmann_json::nlohmann_json jinja2cpp) diff --git a/text_generation/causal_lm/cpp/CMakeLists.txt b/text_generation/causal_lm/cpp/CMakeLists.txt index d9538176df..07d91e6d3b 100644 --- a/text_generation/causal_lm/cpp/CMakeLists.txt +++ b/text_generation/causal_lm/cpp/CMakeLists.txt @@ -10,10 +10,9 @@ else() set(OPENVINO_TOKENIZERS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../bin/openvino_tokenizers.dll) # TODO: I'll go away after the generate() gets a way to find openvino_tokenizers endif() -find_package(openvino_genai REQUIRED - PATHS - "${CMAKE_BINARY_DIR}" # Reuse the package from the build. - ${OpenVINO_DIR} # GenAI may be installed alogside with OpenVINO. +find_package(openvino_genai REQUIRED PATHS + "${CMAKE_BINARY_DIR}" # Reuse the package from the build. + ${OpenVINO_DIR} # GenAI may be installed alogside OpenVINO. ) add_executable(greedy_causal_lm greedy_causal_lm.cpp) From 2f3fa47e16e9e80243e13dd63ae130e1ca0bcc2a Mon Sep 17 00:00:00 2001 From: Wovchena Date: Thu, 16 May 2024 23:34:34 +0400 Subject: [PATCH 11/24] remove dummy call --- .github/workflows/genai_package.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/genai_package.yml b/.github/workflows/genai_package.yml index 64d265932b..13177c0f1d 100644 --- a/.github/workflows/genai_package.yml +++ b/.github/workflows/genai_package.yml @@ -34,7 +34,6 @@ jobs: - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && cmake --build ./build/ --config Release --target package -j - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && cmake --install ./build/ --config Release --prefix w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64 - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\samples\cpp\build_samples_msvc.bat -b ${{ github.workspace }}/samples-build - - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && ${{ github.workspace }}/samples-build/intel64/Release/greedy_causal_lm asdf - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && python -m pip install --upgrade-strategy eager -r text_generation/causal_lm/cpp/requirements.txt - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && python -m pip install ./thirdparty/openvino_tokenizers/[transformers] - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\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 From 14413f2db97c186b8799c907713530277c06775d Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 17 May 2024 00:16:41 +0400 Subject: [PATCH 12/24] try --- text_generation/causal_lm/cpp/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/text_generation/causal_lm/cpp/CMakeLists.txt b/text_generation/causal_lm/cpp/CMakeLists.txt index 07d91e6d3b..e59dbfb0a8 100644 --- a/text_generation/causal_lm/cpp/CMakeLists.txt +++ b/text_generation/causal_lm/cpp/CMakeLists.txt @@ -12,7 +12,7 @@ endif() find_package(openvino_genai REQUIRED PATHS "${CMAKE_BINARY_DIR}" # Reuse the package from the build. - ${OpenVINO_DIR} # GenAI may be installed alogside OpenVINO. + # ${OpenVINO_DIR} # GenAI may be installed alogside OpenVINO. ) add_executable(greedy_causal_lm greedy_causal_lm.cpp) @@ -57,3 +57,5 @@ target_link_libraries(chat_sample PRIVATE openvino::genai) target_include_directories(chat_sample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") set_target_properties(chat_sample PROPERTIES CXX_STANDARD 17) set_target_properties(chat_sample PROPERTIES CXX_STANDARD_REQUIRED ON) + +# TODO: install samples From 22eb791cd4321904e23aa05ec20fefade3c626c0 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 17 May 2024 14:23:47 +0400 Subject: [PATCH 13/24] test ubuntu --- .github/workflows/genai_package.yml | 30 +++++++++++-------- .../{genai_lib.yml => genai_python_lib.yml} | 18 +++++------ src/python/CMakeLists.txt | 1 - text_generation/causal_lm/cpp/CMakeLists.txt | 2 +- 4 files changed, 28 insertions(+), 23 deletions(-) rename .github/workflows/{genai_lib.yml => genai_python_lib.yml} (58%) diff --git a/.github/workflows/genai_package.yml b/.github/workflows/genai_package.yml index 13177c0f1d..36e8f02ec8 100644 --- a/.github/workflows/genai_package.yml +++ b/.github/workflows/genai_package.yml @@ -1,7 +1,7 @@ name: genai_package on: pull_request jobs: - genai_package_ubuntu: + ubuntu_genai_package: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v4 @@ -11,12 +11,18 @@ jobs: with: python-version: 3.8 - run: mkdir ./ov/ - - run: curl https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.1.0-14758-22bd6ff0494/l_openvino_toolkit_centos7_2024.1.0.dev20240315_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz # Install CentOS7 instead of Ubuntu to match PyPI distribution ABI + - run: curl https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.2.0-15349-765302e0de1/l_openvino_toolkit_ubuntu20_2024.2.0.dev20240515_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz - run: sudo ./ov/install_dependencies/install_openvino_dependencies.sh - run: source ./ov/setupvars.sh && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ - run: source ./ov/setupvars.sh && cmake --build ./build/ --config Release --target package -j + - run: source ./ov/setupvars.sh && cmake --install ./build/ --config Release --prefix ov + - run: ov/samples/cpp/build_samples.sh -b "${{ github.workspace }}/s pace" + - run: source ./ov/setupvars.sh && python -m pip install --upgrade-strategy eager -r text_generation/causal_lm/cpp/requirements.txt + - run: source ./ov/setupvars.sh && python -m pip install ./thirdparty/openvino_tokenizers/[transformers] + - 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 + - run: source ./ov/setupvars.sh && timeout 50s "${{ github.workspace }}/s pace/intel64/Release/greedy_causal_lm" .\TinyLlama-1.1B-Chat-v1.0\ "" - genai_package_windows: + windows_genai_package: runs-on: windows-latest defaults: run: @@ -28,13 +34,13 @@ jobs: - uses: actions/setup-python@v4 with: python-version: 3.8 - - 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 + - run: curl --output ov.zip https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.2.0-15349-765302e0de1/w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64.zip - run: unzip ov.zip - - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ - - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && cmake --build ./build/ --config Release --target package -j - - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && cmake --install ./build/ --config Release --prefix w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64 - - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\samples\cpp\build_samples_msvc.bat -b ${{ github.workspace }}/samples-build - - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && python -m pip install --upgrade-strategy eager -r text_generation/causal_lm/cpp/requirements.txt - - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && python -m pip install ./thirdparty/openvino_tokenizers/[transformers] - - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\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 - - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && ${{ github.workspace }}/samples-build/intel64/Release/greedy_causal_lm .\TinyLlama-1.1B-Chat-v1.0\ "" + - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ + - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && cmake --build ./build/ --config Release --target package -j + - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && cmake --install ./build/ --config Release --prefix w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64 + - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\samples\cpp\build_samples.ps1 -b "${{ github.workspace }}/s pace" + - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && python -m pip install --upgrade-strategy eager -r text_generation/causal_lm/cpp/requirements.txt + - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && python -m pip install ./thirdparty/openvino_tokenizers/[transformers] + - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\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 + - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && "${{ github.workspace }}/s pace/intel64/Release/greedy_causal_lm" .\TinyLlama-1.1B-Chat-v1.0\ "" diff --git a/.github/workflows/genai_lib.yml b/.github/workflows/genai_python_lib.yml similarity index 58% rename from .github/workflows/genai_lib.yml rename to .github/workflows/genai_python_lib.yml index d647036e4e..e1386e9508 100644 --- a/.github/workflows/genai_lib.yml +++ b/.github/workflows/genai_python_lib.yml @@ -1,7 +1,7 @@ -name: genai_lib +name: genai_python_lib on: pull_request jobs: - genai_lib_ubuntu: + ubuntu_genai_python_lib: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v4 @@ -11,7 +11,7 @@ jobs: with: python-version: 3.8 - run: mkdir ./ov/ - - run: curl https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.1.0-14758-22bd6ff0494/l_openvino_toolkit_centos7_2024.1.0.dev20240315_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz # Install CentOS7 instead of Ubuntu to match PyPI distribution ABI + - run: curl https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.2.0-15349-765302e0de1/l_openvino_toolkit_centos7_2024.2.0.dev20240515_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz # Install CentOS7 instead of Ubuntu to match PyPI distribution ABI - run: sudo ./ov/install_dependencies/install_openvino_dependencies.sh - run: source ./ov/setupvars.sh && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ - run: source ./ov/setupvars.sh && cmake --build ./build/ --config Release -j @@ -20,7 +20,7 @@ jobs: - run: source ./ov/setupvars.sh && python -m pip install --pre . --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly - run: python -c "from openvino_genai.py_generate_pipeline import LLMPipeline" - genai_lib_windows: + windows_genai_python_lib: runs-on: windows-latest defaults: run: @@ -32,11 +32,11 @@ jobs: - uses: actions/setup-python@v4 with: python-version: 3.8 - - 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 + - run: curl --output ov.ziphttps://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.2.0-15349-765302e0de1/w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64.zip - run: unzip ov.zip - - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ - - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && cmake --build ./build/ --config Release -j + - run: call /w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ + - run: call /w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && cmake --build ./build/ --config Release -j - run: python -m pip install "numpy<1.27" - - run: set "PYTHONPATH=./src/python;" && call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && python -c "from openvino_genai.py_generate_pipeline import LLMPipeline" # cmd evaluates variables in a different way. Setting PYTHONPATH before setupvars.bat instead of doing that after solves that. - - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && python -m pip install . + - run: set "PYTHONPATH=./src/python;" && call /w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && python -c "from openvino_genai.py_generate_pipeline import LLMPipeline" # cmd evaluates variables in a different way. Setting PYTHONPATH before setupvars.bat instead of doing that after solves that. + - run: call /w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && python -m pip install . - run: python -c "from openvino_genai.py_generate_pipeline import LLMPipeline" diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 21e20db3ed..a6195eda25 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -43,4 +43,3 @@ add_custom_command(TARGET py_generate_pipeline POST_BUILD "$" "${CMAKE_CURRENT_SOURCE_DIR}/openvino_genai/$" COMMENT "Copy py_generate_pipeline to src/python/openvino_genai/") -# TODO: install python into archive diff --git a/text_generation/causal_lm/cpp/CMakeLists.txt b/text_generation/causal_lm/cpp/CMakeLists.txt index e59dbfb0a8..82132a1aad 100644 --- a/text_generation/causal_lm/cpp/CMakeLists.txt +++ b/text_generation/causal_lm/cpp/CMakeLists.txt @@ -12,7 +12,7 @@ endif() find_package(openvino_genai REQUIRED PATHS "${CMAKE_BINARY_DIR}" # Reuse the package from the build. - # ${OpenVINO_DIR} # GenAI may be installed alogside OpenVINO. + ${OpenVINO_DIR} # GenAI may be installed alogside OpenVINO. ) add_executable(greedy_causal_lm greedy_causal_lm.cpp) From 396c81a573a12e9fc61e53d239889554965d61b3 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 17 May 2024 14:35:48 +0400 Subject: [PATCH 14/24] fix build --- .github/workflows/genai_package.yml | 2 +- .github/workflows/genai_python_lib.yml | 10 +++++----- CMakeLists.txt | 2 +- src/python/CMakeLists.txt | 3 +++ 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/genai_package.yml b/.github/workflows/genai_package.yml index 36e8f02ec8..5da6496fcd 100644 --- a/.github/workflows/genai_package.yml +++ b/.github/workflows/genai_package.yml @@ -11,7 +11,7 @@ jobs: with: python-version: 3.8 - run: mkdir ./ov/ - - run: curl https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.2.0-15349-765302e0de1/l_openvino_toolkit_ubuntu20_2024.2.0.dev20240515_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz + - run: curl https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.2.0-15337-4936b145686/l_openvino_toolkit_ubuntu20_2024.2.0.dev20240515_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz - run: sudo ./ov/install_dependencies/install_openvino_dependencies.sh - run: source ./ov/setupvars.sh && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ - run: source ./ov/setupvars.sh && cmake --build ./build/ --config Release --target package -j diff --git a/.github/workflows/genai_python_lib.yml b/.github/workflows/genai_python_lib.yml index e1386e9508..81440fee59 100644 --- a/.github/workflows/genai_python_lib.yml +++ b/.github/workflows/genai_python_lib.yml @@ -11,7 +11,7 @@ jobs: with: python-version: 3.8 - run: mkdir ./ov/ - - run: curl https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.2.0-15349-765302e0de1/l_openvino_toolkit_centos7_2024.2.0.dev20240515_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz # Install CentOS7 instead of Ubuntu to match PyPI distribution ABI + - run: curl https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.1.0-14758-22bd6ff0494/l_openvino_toolkit_centos7_2024.1.0.dev20240315_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz # Install CentOS7 instead of Ubuntu to match PyPI distribution ABI - run: sudo ./ov/install_dependencies/install_openvino_dependencies.sh - run: source ./ov/setupvars.sh && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ - run: source ./ov/setupvars.sh && cmake --build ./build/ --config Release -j @@ -32,11 +32,11 @@ jobs: - uses: actions/setup-python@v4 with: python-version: 3.8 - - run: curl --output ov.ziphttps://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.2.0-15349-765302e0de1/w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64.zip + - run: curl --output ov.zip https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.2.0-15349-765302e0de1/w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64.zip - run: unzip ov.zip - - run: call /w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ - - run: call /w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && cmake --build ./build/ --config Release -j + - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ + - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && cmake --build ./build/ --config Release -j - run: python -m pip install "numpy<1.27" - run: set "PYTHONPATH=./src/python;" && call /w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && python -c "from openvino_genai.py_generate_pipeline import LLMPipeline" # cmd evaluates variables in a different way. Setting PYTHONPATH before setupvars.bat instead of doing that after solves that. - - run: call /w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && python -m pip install . + - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && python -m pip install . - run: python -c "from openvino_genai.py_generate_pipeline import LLMPipeline" diff --git a/CMakeLists.txt b/CMakeLists.txt index e605a304f5..809327095c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,6 @@ add_subdirectory(src) add_subdirectory(text_generation/causal_lm/cpp) install(DIRECTORY text_generation/causal_lm/cpp/ DESTINATION samples/cpp/causal_lm COMPONENT cpp_samples_genai) -install(FILES LICENSE third-party-programs.txt DESTINATION licenses_genai COMPONENT licensing_genai) # TODO: how to merge with OPenvino +install(FILES LICENSE third-party-programs.txt DESTINATION licensing_genai COMPONENT licensing_genai) # TODO: how to merge with OPenvino set(CPACK_GENERATOR "ZIP") include(CPack) diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index a6195eda25..45fd1a0bad 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -43,3 +43,6 @@ add_custom_command(TARGET py_generate_pipeline POST_BUILD "$" "${CMAKE_CURRENT_SOURCE_DIR}/openvino_genai/$" COMMENT "Copy py_generate_pipeline to src/python/openvino_genai/") + +find_package(Python3 REQUIRED COMPONENTS Interpreter Development) +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/openvino_genai/ DESTINATION python COMPONENT pygenai_${Python_VERSION_MAJOR}_${Python_VERSION_MINOR}) From 9fe05d2cd307b8089672cd2f8cbad16d89e9592e Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 17 May 2024 14:38:20 +0400 Subject: [PATCH 15/24] add subfolder --- .github/workflows/genai_package.yml | 2 +- src/python/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/genai_package.yml b/.github/workflows/genai_package.yml index 5da6496fcd..79813e9133 100644 --- a/.github/workflows/genai_package.yml +++ b/.github/workflows/genai_package.yml @@ -39,7 +39,7 @@ jobs: - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && cmake --build ./build/ --config Release --target package -j - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && cmake --install ./build/ --config Release --prefix w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64 - - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\samples\cpp\build_samples.ps1 -b "${{ github.workspace }}/s pace" + - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\samples\cpp\build_samples.bat -b "${{ github.workspace }}/s pace" - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && python -m pip install --upgrade-strategy eager -r text_generation/causal_lm/cpp/requirements.txt - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && python -m pip install ./thirdparty/openvino_tokenizers/[transformers] - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\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 diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 45fd1a0bad..62f26f3215 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -45,4 +45,4 @@ add_custom_command(TARGET py_generate_pipeline POST_BUILD COMMENT "Copy py_generate_pipeline to src/python/openvino_genai/") find_package(Python3 REQUIRED COMPONENTS Interpreter Development) -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/openvino_genai/ DESTINATION python COMPONENT pygenai_${Python_VERSION_MAJOR}_${Python_VERSION_MINOR}) +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/openvino_genai/ DESTINATION python/openvino_genai/ COMPONENT pygenai_${Python_VERSION_MAJOR}_${Python_VERSION_MINOR}) From 0095dcc10da08d7a489f16e500f7679d7c9228fa Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 17 May 2024 14:41:58 +0400 Subject: [PATCH 16/24] downgrade package --- .github/workflows/genai_package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/genai_package.yml b/.github/workflows/genai_package.yml index 79813e9133..88fddda0f6 100644 --- a/.github/workflows/genai_package.yml +++ b/.github/workflows/genai_package.yml @@ -11,7 +11,7 @@ jobs: with: python-version: 3.8 - run: mkdir ./ov/ - - run: curl https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.2.0-15337-4936b145686/l_openvino_toolkit_ubuntu20_2024.2.0.dev20240515_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz + - run: curlhttps://storage.openvinotoolkit.org/repositories/openvino/packages/2024.1/linux/l_openvino_toolkit_ubuntu20_2024.1.0.15008.f4afc983258_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz - run: sudo ./ov/install_dependencies/install_openvino_dependencies.sh - run: source ./ov/setupvars.sh && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ - run: source ./ov/setupvars.sh && cmake --build ./build/ --config Release --target package -j From a88aa694f1e2fdd2e0c29cbe2dfaddf66847e68c Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 17 May 2024 14:42:39 +0400 Subject: [PATCH 17/24] space --- .github/workflows/genai_package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/genai_package.yml b/.github/workflows/genai_package.yml index 88fddda0f6..2c891e6224 100644 --- a/.github/workflows/genai_package.yml +++ b/.github/workflows/genai_package.yml @@ -11,7 +11,7 @@ jobs: with: python-version: 3.8 - run: mkdir ./ov/ - - run: curlhttps://storage.openvinotoolkit.org/repositories/openvino/packages/2024.1/linux/l_openvino_toolkit_ubuntu20_2024.1.0.15008.f4afc983258_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz + - run: curl https://storage.openvinotoolkit.org/repositories/openvino/packages/2024.1/linux/l_openvino_toolkit_ubuntu20_2024.1.0.15008.f4afc983258_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz - run: sudo ./ov/install_dependencies/install_openvino_dependencies.sh - run: source ./ov/setupvars.sh && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ - run: source ./ov/setupvars.sh && cmake --build ./build/ --config Release --target package -j From f16950bac1719a29284204b53a213ef481f13157 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 17 May 2024 14:52:07 +0400 Subject: [PATCH 18/24] fix --- .github/workflows/genai_package.yml | 3 ++- .github/workflows/genai_python_lib.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/genai_package.yml b/.github/workflows/genai_package.yml index 2c891e6224..4552aa2bee 100644 --- a/.github/workflows/genai_package.yml +++ b/.github/workflows/genai_package.yml @@ -2,6 +2,7 @@ name: genai_package on: pull_request jobs: ubuntu_genai_package: + if: false runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v4 @@ -39,7 +40,7 @@ jobs: - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && cmake --build ./build/ --config Release --target package -j - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && cmake --install ./build/ --config Release --prefix w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64 - - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\samples\cpp\build_samples.bat -b "${{ github.workspace }}/s pace" + - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\samples\cpp\build_samples_msvc.bat -b "${{ github.workspace }}/s pace" - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && python -m pip install --upgrade-strategy eager -r text_generation/causal_lm/cpp/requirements.txt - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && python -m pip install ./thirdparty/openvino_tokenizers/[transformers] - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\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 diff --git a/.github/workflows/genai_python_lib.yml b/.github/workflows/genai_python_lib.yml index 81440fee59..e9cfefff31 100644 --- a/.github/workflows/genai_python_lib.yml +++ b/.github/workflows/genai_python_lib.yml @@ -37,6 +37,6 @@ jobs: - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && cmake --build ./build/ --config Release -j - run: python -m pip install "numpy<1.27" - - run: set "PYTHONPATH=./src/python;" && call /w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && python -c "from openvino_genai.py_generate_pipeline import LLMPipeline" # cmd evaluates variables in a different way. Setting PYTHONPATH before setupvars.bat instead of doing that after solves that. + - run: set "PYTHONPATH=./src/python;" && call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && python -c "from openvino_genai.py_generate_pipeline import LLMPipeline" # cmd evaluates variables in a different way. Setting PYTHONPATH before setupvars.bat instead of doing that after solves that. - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && python -m pip install . - run: python -c "from openvino_genai.py_generate_pipeline import LLMPipeline" From 0718392cb8dc2e558de543d0e105e7bbc754ea4f Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 17 May 2024 15:03:08 +0400 Subject: [PATCH 19/24] no space --- .github/workflows/genai_package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/genai_package.yml b/.github/workflows/genai_package.yml index 4552aa2bee..b6f1647c7a 100644 --- a/.github/workflows/genai_package.yml +++ b/.github/workflows/genai_package.yml @@ -40,8 +40,8 @@ jobs: - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && cmake --build ./build/ --config Release --target package -j - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && cmake --install ./build/ --config Release --prefix w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64 - - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\samples\cpp\build_samples_msvc.bat -b "${{ github.workspace }}/s pace" + - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\samples\cpp\build_samples_msvc.bat -b "${{ github.workspace }}/samples_build" - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && python -m pip install --upgrade-strategy eager -r text_generation/causal_lm/cpp/requirements.txt - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && python -m pip install ./thirdparty/openvino_tokenizers/[transformers] - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\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 - - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && "${{ github.workspace }}/s pace/intel64/Release/greedy_causal_lm" .\TinyLlama-1.1B-Chat-v1.0\ "" + - run: call w_openvino_toolkit_windows_2024.2.0.dev20240515_x86_64\setupvars.bat && "${{ github.workspace }}/samples_build/intel64/Release/greedy_causal_lm" .\TinyLlama-1.1B-Chat-v1.0\ "" From 8688e8d59464cd56c9fc7c6f36faf4924856bac2 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 17 May 2024 19:01:35 +0400 Subject: [PATCH 20/24] conditionally include build type into archive --- .github/workflows/genai_package.yml | 1 - src/cpp/CMakeLists.txt | 37 ++++++++++++++++------------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/.github/workflows/genai_package.yml b/.github/workflows/genai_package.yml index b6f1647c7a..3f3ee5082e 100644 --- a/.github/workflows/genai_package.yml +++ b/.github/workflows/genai_package.yml @@ -2,7 +2,6 @@ name: genai_package on: pull_request jobs: ubuntu_genai_package: - if: false runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v4 diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 7eb2e82611..9ad71424d7 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -68,25 +68,30 @@ add_custom_command(TARGET ${TARGET_NAME} POST_BUILD install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION . COMPONENT core_genai RUNTIME DESTINATION . COMPONENT core_genai) -string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" ARCH_FOLDER) -if(X86_64) - set(ARCH_FOLDER intel64) -elseif(X86) - set(ARCH_FOLDER ia32) -elseif(MSVC AND ARM) - set(ARCH_FOLDER arm) -elseif((MSVC OR APPLE) AND AARCH64) - set(ARCH_FOLDER arm64) -elseif(UNIVERSAL2) - set(ARCH_FOLDER universal2) -elseif(ARCH_FOLDER STREQUAL "x86_64" OR ARCH_FOLDER STREQUAL "amd64" # Windows detects Intel's 64-bit CPU as AMD64 +# - Windows: `\runtime\bin\intel64\Release\` +# - MacOS_x86: `/runtime/lib/intel64/Release` +# - MacOS_arm64: `/runtime/lib/arm64/Release/` +# - Linux_x86: `/runtime/lib/intel64/` +# - Linux_arm64: `/runtime/lib/aarch64/` +string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" ARCH_DIR) +if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*") + set(ARCH_DIR intel64) +elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^(arm64.*|aarch64.*|AARCH64.*|ARM64.*)") + if(APPLE) + set(ARCH_DIR "arm64") + else() + set(ARCH_DIR "aarch64") + endif() +elseif(ARCH_DIR STREQUAL "x86_64" OR ARCH_DIR STREQUAL "amd64" # Windows detects Intel's 64-bit CPU as AMD64 OR CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64") - set(ARCH_FOLDER intel64) + set(ARCH_DIR intel64) +endif() +if(MSVC OR APPLE) + set(ARCH_DIR ${ARCH_DIR}/${CMAKE_BUILD_TYPE}) endif() install(TARGETS ${TARGET_NAME} EXPORT openvino_genaiTargets - LIBRARY DESTINATION runtime/lib/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} COMPONENT core_genai_dev - ARCHIVE DESTINATION runtime/lib/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} COMPONENT core_genai_dev - RUNTIME DESTINATION runtime/bin/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} COMPONENT core_genai_dev + LIBRARY DESTINATION runtime/lib/${ARCH_DIR} COMPONENT core_genai_dev + RUNTIME DESTINATION runtime/bin/${ARCH_DIR} COMPONENT core_genai_dev INCLUDES DESTINATION runtime/include) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION runtime/include COMPONENT core_genai_dev) install(EXPORT openvino_genaiTargets FILE openvino_genaiTargets.cmake NAMESPACE openvino:: DESTINATION runtime/cmake) From 2e01d26cad77d2cde8111073135c55f06b806abf Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 17 May 2024 19:07:51 +0400 Subject: [PATCH 21/24] skip ubuntu_genai_package --- .github/workflows/genai_package.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/genai_package.yml b/.github/workflows/genai_package.yml index 3f3ee5082e..b6f1647c7a 100644 --- a/.github/workflows/genai_package.yml +++ b/.github/workflows/genai_package.yml @@ -2,6 +2,7 @@ name: genai_package on: pull_request jobs: ubuntu_genai_package: + if: false runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v4 From 3e9609295fc59d4deb975c8064458f1bd52a143b Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 17 May 2024 19:19:46 +0400 Subject: [PATCH 22/24] put archive back --- src/cpp/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 9ad71424d7..ffe28a81df 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -91,6 +91,7 @@ if(MSVC OR APPLE) endif() install(TARGETS ${TARGET_NAME} EXPORT openvino_genaiTargets LIBRARY DESTINATION runtime/lib/${ARCH_DIR} COMPONENT core_genai_dev + ARCHIVE DESTINATION runtime/lib/${ARCH_DIR} COMPONENT core_genai_dev RUNTIME DESTINATION runtime/bin/${ARCH_DIR} COMPONENT core_genai_dev INCLUDES DESTINATION runtime/include) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION runtime/include COMPONENT core_genai_dev) From a8aac662445abc2d43014b2ccdae17304625cac1 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Sat, 18 May 2024 11:46:16 +0400 Subject: [PATCH 23/24] openvino_genai->openvino/genai --- .../genai}/generation_config.hpp | 4 ++-- .../{openvino_genai => openvino/genai}/llm_pipeline.hpp | 8 ++++---- .../{openvino_genai => openvino/genai}/streamer_base.hpp | 2 +- .../{openvino_genai => openvino/genai}/tokenizer.hpp | 4 ++-- .../{openvino_genai => openvino/genai}/visibility.hpp | 4 ++-- src/cpp/src/generation_config.cpp | 2 +- src/cpp/src/generation_config_helper.hpp | 2 +- src/cpp/src/greedy_decoding.cpp | 2 +- src/cpp/src/group_beam_searcher.hpp | 4 ++-- src/cpp/src/llm_pipeline.cpp | 4 ++-- src/cpp/src/text_callback_streamer.hpp | 4 ++-- src/cpp/src/tokenizer.cpp | 2 +- src/python/py_generate_pipeline.cpp | 2 +- text_generation/causal_lm/cpp/beam_search_causal_lm.cpp | 2 +- .../causal_lm/cpp/generate_pipeline/chat_sample.cpp | 2 +- .../causal_lm/cpp/generate_pipeline/generate_sample.cpp | 2 +- text_generation/causal_lm/cpp/greedy_causal_lm.cpp | 2 +- 17 files changed, 26 insertions(+), 26 deletions(-) rename src/cpp/include/{openvino_genai => openvino/genai}/generation_config.hpp (98%) rename src/cpp/include/{openvino_genai => openvino/genai}/llm_pipeline.hpp (97%) rename src/cpp/include/{openvino_genai => openvino/genai}/streamer_base.hpp (94%) rename src/cpp/include/{openvino_genai => openvino/genai}/tokenizer.hpp (96%) rename src/cpp/include/{openvino_genai => openvino/genai}/visibility.hpp (60%) diff --git a/src/cpp/include/openvino_genai/generation_config.hpp b/src/cpp/include/openvino/genai/generation_config.hpp similarity index 98% rename from src/cpp/include/openvino_genai/generation_config.hpp rename to src/cpp/include/openvino/genai/generation_config.hpp index 45bef36574..73584cf60a 100644 --- a/src/cpp/include/openvino_genai/generation_config.hpp +++ b/src/cpp/include/openvino/genai/generation_config.hpp @@ -9,7 +9,7 @@ #include "openvino/runtime/compiled_model.hpp" #include "openvino/runtime/infer_request.hpp" -#include "openvino_genai/tokenizer.hpp" +#include "openvino/genai/tokenizer.hpp" namespace ov { @@ -54,7 +54,7 @@ enum class StopCriteria { early, heuristic, never }; * @param eos_token token string representation * @param draft_model draft model for assitive decoding */ -class OPENVINO_GENAI_EXPORTS GenerationConfig { +class openvino/genai_EXPORTS GenerationConfig { public: GenerationConfig() = default; GenerationConfig(std::string json_path); diff --git a/src/cpp/include/openvino_genai/llm_pipeline.hpp b/src/cpp/include/openvino/genai/llm_pipeline.hpp similarity index 97% rename from src/cpp/include/openvino_genai/llm_pipeline.hpp rename to src/cpp/include/openvino/genai/llm_pipeline.hpp index 68348b3ed6..54c9704748 100644 --- a/src/cpp/include/openvino_genai/llm_pipeline.hpp +++ b/src/cpp/include/openvino/genai/llm_pipeline.hpp @@ -7,9 +7,9 @@ #include #include -#include "openvino_genai/generation_config.hpp" -#include "openvino_genai/tokenizer.hpp" -#include "openvino_genai/streamer_base.hpp" +#include "openvino/genai/generation_config.hpp" +#include "openvino/genai/tokenizer.hpp" +#include "openvino/genai/streamer_base.hpp" namespace ov { @@ -44,7 +44,7 @@ class DecodedResults { /** * @brief This class is used for generation with LLMs. */ -class OPENVINO_GENAI_EXPORTS LLMPipeline { +class openvino/genai_EXPORTS LLMPipeline { public: /** * @brief Constructs a LLMPipeline when convert model xml/bin files, tokenizers and configuration and in the same dir. diff --git a/src/cpp/include/openvino_genai/streamer_base.hpp b/src/cpp/include/openvino/genai/streamer_base.hpp similarity index 94% rename from src/cpp/include/openvino_genai/streamer_base.hpp rename to src/cpp/include/openvino/genai/streamer_base.hpp index 46587b3e74..3f0879d702 100644 --- a/src/cpp/include/openvino_genai/streamer_base.hpp +++ b/src/cpp/include/openvino/genai/streamer_base.hpp @@ -3,7 +3,7 @@ #pragma once -#include "openvino_genai/tokenizer.hpp" +#include "openvino/genai/tokenizer.hpp" namespace ov { diff --git a/src/cpp/include/openvino_genai/tokenizer.hpp b/src/cpp/include/openvino/genai/tokenizer.hpp similarity index 96% rename from src/cpp/include/openvino_genai/tokenizer.hpp rename to src/cpp/include/openvino/genai/tokenizer.hpp index ce90784bf6..6a9ccb90da 100644 --- a/src/cpp/include/openvino_genai/tokenizer.hpp +++ b/src/cpp/include/openvino/genai/tokenizer.hpp @@ -7,14 +7,14 @@ #include #include #include -#include "openvino_genai/visibility.hpp" +#include "openvino/genai/visibility.hpp" namespace ov { /** * @brief class is used to encode prompts and decode resulting tokens */ -class OPENVINO_GENAI_EXPORTS Tokenizer { +class openvino/genai_EXPORTS Tokenizer { public: /** * @brief ov::Tokenizer constructor. diff --git a/src/cpp/include/openvino_genai/visibility.hpp b/src/cpp/include/openvino/genai/visibility.hpp similarity index 60% rename from src/cpp/include/openvino_genai/visibility.hpp rename to src/cpp/include/openvino/genai/visibility.hpp index 6a8cf756e0..0317d35676 100644 --- a/src/cpp/include/openvino_genai/visibility.hpp +++ b/src/cpp/include/openvino/genai/visibility.hpp @@ -4,7 +4,7 @@ #include "openvino/core/visibility.hpp" #ifdef genai_EXPORTS -# define OPENVINO_GENAI_EXPORTS OPENVINO_CORE_EXPORTS +# define openvino/genai_EXPORTS OPENVINO_CORE_EXPORTS #else -# define OPENVINO_GENAI_EXPORTS OPENVINO_CORE_IMPORTS +# define openvino/genai_EXPORTS OPENVINO_CORE_IMPORTS #endif // genai_EXPORTS diff --git a/src/cpp/src/generation_config.cpp b/src/cpp/src/generation_config.cpp index 82aa1268c8..b392e44b3b 100644 --- a/src/cpp/src/generation_config.cpp +++ b/src/cpp/src/generation_config.cpp @@ -7,7 +7,7 @@ #include #include -#include "openvino_genai/generation_config.hpp" +#include "openvino/genai/generation_config.hpp" #include "generation_config_helper.hpp" diff --git a/src/cpp/src/generation_config_helper.hpp b/src/cpp/src/generation_config_helper.hpp index cfd6e295d9..f4e5839990 100644 --- a/src/cpp/src/generation_config_helper.hpp +++ b/src/cpp/src/generation_config_helper.hpp @@ -3,7 +3,7 @@ #pragma once -#include "openvino_genai/generation_config.hpp" +#include "openvino/genai/generation_config.hpp" namespace ov { diff --git a/src/cpp/src/greedy_decoding.cpp b/src/cpp/src/greedy_decoding.cpp index 19f028c54c..3298553a76 100644 --- a/src/cpp/src/greedy_decoding.cpp +++ b/src/cpp/src/greedy_decoding.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #include "generation_config_helper.hpp" -#include "openvino_genai/llm_pipeline.hpp" +#include "openvino/genai/llm_pipeline.hpp" #include "utils.hpp" namespace ov { diff --git a/src/cpp/src/group_beam_searcher.hpp b/src/cpp/src/group_beam_searcher.hpp index fa4ed632f4..91f3ef4096 100644 --- a/src/cpp/src/group_beam_searcher.hpp +++ b/src/cpp/src/group_beam_searcher.hpp @@ -4,8 +4,8 @@ #pragma once #include -#include "openvino_genai/generation_config.hpp" -#include "openvino_genai/llm_pipeline.hpp" +#include "openvino/genai/generation_config.hpp" +#include "openvino/genai/llm_pipeline.hpp" namespace ov { EncodedResults beam_search(ov::InferRequest& lm, ov::Tensor prompts, ov::Tensor attentin_mask, GenerationConfig sampling_params); diff --git a/src/cpp/src/llm_pipeline.cpp b/src/cpp/src/llm_pipeline.cpp index 0618633e24..9d4161f859 100644 --- a/src/cpp/src/llm_pipeline.cpp +++ b/src/cpp/src/llm_pipeline.cpp @@ -10,8 +10,8 @@ #include #include -#include "openvino_genai/generation_config.hpp" -#include "openvino_genai/llm_pipeline.hpp" +#include "openvino/genai/generation_config.hpp" +#include "openvino/genai/llm_pipeline.hpp" #include "utils.hpp" #include "generation_config_helper.hpp" #include "group_beam_searcher.hpp" diff --git a/src/cpp/src/text_callback_streamer.hpp b/src/cpp/src/text_callback_streamer.hpp index cb9b9af124..d9c1ba3ee5 100644 --- a/src/cpp/src/text_callback_streamer.hpp +++ b/src/cpp/src/text_callback_streamer.hpp @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#include "openvino_genai/streamer_base.hpp" -#include "openvino_genai/tokenizer.hpp" +#include "openvino/genai/streamer_base.hpp" +#include "openvino/genai/tokenizer.hpp" namespace ov { diff --git a/src/cpp/src/tokenizer.cpp b/src/cpp/src/tokenizer.cpp index c7b1b9e35a..75c18734d3 100644 --- a/src/cpp/src/tokenizer.cpp +++ b/src/cpp/src/tokenizer.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include "openvino_genai/tokenizer.hpp" +#include "openvino/genai/tokenizer.hpp" #include "utils.hpp" namespace { diff --git a/src/python/py_generate_pipeline.cpp b/src/python/py_generate_pipeline.cpp index 3c522c1761..74cbe7e27d 100644 --- a/src/python/py_generate_pipeline.cpp +++ b/src/python/py_generate_pipeline.cpp @@ -4,7 +4,7 @@ #include #include #include -#include "openvino_genai/llm_pipeline.hpp" +#include "openvino/genai/llm_pipeline.hpp" namespace py = pybind11; using namespace ov; diff --git a/text_generation/causal_lm/cpp/beam_search_causal_lm.cpp b/text_generation/causal_lm/cpp/beam_search_causal_lm.cpp index 59a2ee7d18..1afc5f93ed 100644 --- a/text_generation/causal_lm/cpp/beam_search_causal_lm.cpp +++ b/text_generation/causal_lm/cpp/beam_search_causal_lm.cpp @@ -1,7 +1,7 @@ // Copyright (C) 2023-2024 Intel Corporation // SPDX-License-Identifier: Apache-2.0 -#include +#include namespace { enum SPECIAL_TOKEN { PAD_TOKEN = 2 }; diff --git a/text_generation/causal_lm/cpp/generate_pipeline/chat_sample.cpp b/text_generation/causal_lm/cpp/generate_pipeline/chat_sample.cpp index e1a92b346b..b1ecb5f5f4 100644 --- a/text_generation/causal_lm/cpp/generate_pipeline/chat_sample.cpp +++ b/text_generation/causal_lm/cpp/generate_pipeline/chat_sample.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include "openvino_genai/llm_pipeline.hpp" +#include "openvino/genai/llm_pipeline.hpp" using namespace std; diff --git a/text_generation/causal_lm/cpp/generate_pipeline/generate_sample.cpp b/text_generation/causal_lm/cpp/generate_pipeline/generate_sample.cpp index 744c3899f2..84e07c394b 100644 --- a/text_generation/causal_lm/cpp/generate_pipeline/generate_sample.cpp +++ b/text_generation/causal_lm/cpp/generate_pipeline/generate_sample.cpp @@ -1,7 +1,7 @@ // Copyright (C) 2023-2024 Intel Corporation // SPDX-License-Identifier: Apache-2.0 -#include "openvino_genai/llm_pipeline.hpp" +#include "openvino/genai/llm_pipeline.hpp" using std::cout; using std::endl; diff --git a/text_generation/causal_lm/cpp/greedy_causal_lm.cpp b/text_generation/causal_lm/cpp/greedy_causal_lm.cpp index 54e0b31f50..7b1dde4dc8 100644 --- a/text_generation/causal_lm/cpp/greedy_causal_lm.cpp +++ b/text_generation/causal_lm/cpp/greedy_causal_lm.cpp @@ -1,7 +1,7 @@ // Copyright (C) 2023-2024 Intel Corporation // SPDX-License-Identifier: Apache-2.0 -#include "openvino_genai/llm_pipeline.hpp" +#include "openvino/genai/llm_pipeline.hpp" int main(int argc, char* argv[]) try { if (3 > argc || argc > 4) From b223989d58e84811ef577184fb245adbee286f9c Mon Sep 17 00:00:00 2001 From: Wovchena Date: Sat, 18 May 2024 11:49:21 +0400 Subject: [PATCH 24/24] don't modify macro --- src/cpp/include/openvino/genai/generation_config.hpp | 2 +- src/cpp/include/openvino/genai/llm_pipeline.hpp | 2 +- src/cpp/include/openvino/genai/tokenizer.hpp | 2 +- src/cpp/include/openvino/genai/visibility.hpp | 4 ++-- text_generation/causal_lm/cpp/CMakeLists.txt | 2 -- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/cpp/include/openvino/genai/generation_config.hpp b/src/cpp/include/openvino/genai/generation_config.hpp index 73584cf60a..e1f2151d49 100644 --- a/src/cpp/include/openvino/genai/generation_config.hpp +++ b/src/cpp/include/openvino/genai/generation_config.hpp @@ -54,7 +54,7 @@ enum class StopCriteria { early, heuristic, never }; * @param eos_token token string representation * @param draft_model draft model for assitive decoding */ -class openvino/genai_EXPORTS GenerationConfig { +class OPENVINO_GENAI_EXPORTS GenerationConfig { public: GenerationConfig() = default; GenerationConfig(std::string json_path); diff --git a/src/cpp/include/openvino/genai/llm_pipeline.hpp b/src/cpp/include/openvino/genai/llm_pipeline.hpp index 54c9704748..b25d11ecd4 100644 --- a/src/cpp/include/openvino/genai/llm_pipeline.hpp +++ b/src/cpp/include/openvino/genai/llm_pipeline.hpp @@ -44,7 +44,7 @@ class DecodedResults { /** * @brief This class is used for generation with LLMs. */ -class openvino/genai_EXPORTS LLMPipeline { +class OPENVINO_GENAI_EXPORTS LLMPipeline { public: /** * @brief Constructs a LLMPipeline when convert model xml/bin files, tokenizers and configuration and in the same dir. diff --git a/src/cpp/include/openvino/genai/tokenizer.hpp b/src/cpp/include/openvino/genai/tokenizer.hpp index 6a9ccb90da..0d55d9b0fe 100644 --- a/src/cpp/include/openvino/genai/tokenizer.hpp +++ b/src/cpp/include/openvino/genai/tokenizer.hpp @@ -14,7 +14,7 @@ namespace ov { /** * @brief class is used to encode prompts and decode resulting tokens */ -class openvino/genai_EXPORTS Tokenizer { +class OPENVINO_GENAI_EXPORTS Tokenizer { public: /** * @brief ov::Tokenizer constructor. diff --git a/src/cpp/include/openvino/genai/visibility.hpp b/src/cpp/include/openvino/genai/visibility.hpp index 0317d35676..6a8cf756e0 100644 --- a/src/cpp/include/openvino/genai/visibility.hpp +++ b/src/cpp/include/openvino/genai/visibility.hpp @@ -4,7 +4,7 @@ #include "openvino/core/visibility.hpp" #ifdef genai_EXPORTS -# define openvino/genai_EXPORTS OPENVINO_CORE_EXPORTS +# define OPENVINO_GENAI_EXPORTS OPENVINO_CORE_EXPORTS #else -# define openvino/genai_EXPORTS OPENVINO_CORE_IMPORTS +# define OPENVINO_GENAI_EXPORTS OPENVINO_CORE_IMPORTS #endif // genai_EXPORTS diff --git a/text_generation/causal_lm/cpp/CMakeLists.txt b/text_generation/causal_lm/cpp/CMakeLists.txt index 82132a1aad..07d91e6d3b 100644 --- a/text_generation/causal_lm/cpp/CMakeLists.txt +++ b/text_generation/causal_lm/cpp/CMakeLists.txt @@ -57,5 +57,3 @@ target_link_libraries(chat_sample PRIVATE openvino::genai) target_include_directories(chat_sample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") set_target_properties(chat_sample PROPERTIES CXX_STANDARD 17) set_target_properties(chat_sample PROPERTIES CXX_STANDARD_REQUIRED ON) - -# TODO: install samples