From 5543cee68d8289ae30cdd8f1fe28637dfc5720db Mon Sep 17 00:00:00 2001 From: Wovchena Date: Mon, 6 May 2024 18:22:39 +0400 Subject: [PATCH 01/37] init --- .../generate_pipeline/python/CMakeLists.txt | 22 +++++ .../cpp/generate_pipeline/python/__init__.py | 0 .../generate_pipeline/python/pyproject.toml | 97 +++++++++++++++++++ .../cpp/generate_pipeline/python/python.cpp | 26 +++++ 4 files changed, 145 insertions(+) create mode 100644 text_generation/causal_lm/cpp/generate_pipeline/python/CMakeLists.txt create mode 100644 text_generation/causal_lm/cpp/generate_pipeline/python/__init__.py create mode 100644 text_generation/causal_lm/cpp/generate_pipeline/python/pyproject.toml create mode 100644 text_generation/causal_lm/cpp/generate_pipeline/python/python.cpp diff --git a/text_generation/causal_lm/cpp/generate_pipeline/python/CMakeLists.txt b/text_generation/causal_lm/cpp/generate_pipeline/python/CMakeLists.txt new file mode 100644 index 0000000000..b16294c320 --- /dev/null +++ b/text_generation/causal_lm/cpp/generate_pipeline/python/CMakeLists.txt @@ -0,0 +1,22 @@ + +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.15) +project(py_continuous_batching) + +include(FetchContent) +FetchContent_Declare( + pybind11 + GIT_REPOSITORY https://github.com/pybind/pybind11 + GIT_TAG v2.12.0 +) + +FetchContent_GetProperties(pybind11) +if(NOT pybind11_POPULATED) + FetchContent_Populate(pybind11) + add_subdirectory(${pybind11_SOURCE_DIR} ${pybind11_BINARY_DIR}) +endif() + +pybind11_add_module(py_continuous_batching python.cpp) +# TODO: how to link with tokenizers \ No newline at end of file diff --git a/text_generation/causal_lm/cpp/generate_pipeline/python/__init__.py b/text_generation/causal_lm/cpp/generate_pipeline/python/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/text_generation/causal_lm/cpp/generate_pipeline/python/pyproject.toml b/text_generation/causal_lm/cpp/generate_pipeline/python/pyproject.toml new file mode 100644 index 0000000000..33b4edda5c --- /dev/null +++ b/text_generation/causal_lm/cpp/generate_pipeline/python/pyproject.toml @@ -0,0 +1,97 @@ +[project] +name = "py_continuous_batching" +version = "2024.2.0.0" +description = "Convert tokenizers into OpenVINO models" +requires-python = ">=3.8" +readme = {file = "../../../../../README.md", content-type="text/markdown"} +license = {text = "OSI Approved :: Apache Software License"} + +authors = [ + { name = "OpenVINO Developers", email = "openvino@intel.com" }, +] + +classifiers = [ + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", +] + +dependencies = [ + # support of nightly openvino packages with dev suffix + "openvino~=2024.1.0.0" +] + +[project.optional-dependencies] +transformers = [ + "transformers[sentencepiece] >= 4.36.0", + "tiktoken" +] +# chatglm2 custom tokenizer file imports torch, have to add torch dependency for tests +torch = [ + 'torch' +] +dev = [ + "ruff", + "bandit", + "pytest", + "pytest_harvest", + "pandas", + "openvino_tokenizers[transformers, torch]" +] +benchmark = [ + "pandas", + "seaborn", + "tqdm", + "openvino_tokenizers[transformers]" +] +# don't include fuzzing to avoid windows CI issues +fuzzing = [ + "atheris", + "openvino_tokenizers[transformers]" +] +all = [ + "openvino_tokenizers[dev, transformers]" +] + + +[tool.ruff] +line-length = 119 + +[tool.ruff.lint] +ignore = ["C901", "E501", "E741", "W605"] +select = ["C", "E", "F", "I", "W"] + +[tool.ruff.lint.per-file-ignores] +"__init__.py" = ["F401"] +"openvino_tokenizers/hf_parser.py" = ["F821"] + +[tool.ruff.lint.isort] +lines-after-imports = 2 + +[tool.scikit-build] +cmake.build-type = "Release" +#cmake.args = [ +# "-DCMAKE_INSTALL_BINDIR=lib", +# "-DCMAKE_INSTALL_LIBDIR=lib" +#] +cmake.targets = ["py_continuous_batching"] +wheel.build-tag = "000" +#wheel.packages = ["py_continuous_batching"] # my python files +wheel.install-dir = "py_continuous_batching" +wheel.py-api = "py3" +# TODO: how to get files from top folders +#wheel.license-files = ["../../../../../LICENSE", "../../../../../third-party-programs.txt", "../../../../../SECURITY.md"] +sdist.exclude = ["dist", "tests", "examples", "python/tests"] +sdist.cmake = true + +[[tool.scikit-build.generate]] +path = "__version__.py" +template = ''' +__version__ = "${version}" +''' + +[build-system] +requires = ["scikit-build-core~=0.8.0"] +build-backend = "scikit_build_core.build" \ No newline at end of file diff --git a/text_generation/causal_lm/cpp/generate_pipeline/python/python.cpp b/text_generation/causal_lm/cpp/generate_pipeline/python/python.cpp new file mode 100644 index 0000000000..7485a503ec --- /dev/null +++ b/text_generation/causal_lm/cpp/generate_pipeline/python/python.cpp @@ -0,0 +1,26 @@ +// Copyright (C) 2024 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include +#include +#include + +#include "pybind11/pybind11.h" +#include + +struct GenerationConfig { + bool do_sample; + +}; + +namespace py = pybind11; + + +PYBIND11_MODULE(py_continuous_batching, m) { + py::class_(m, "GenerationConfig") + .def(py::init<>()) + .def_readwrite("do_sample", &GenerationConfig::do_sample); + +} From abb8835aacc005af866c70b583019742ea3329a9 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Tue, 7 May 2024 18:19:46 +0400 Subject: [PATCH 02/37] add_subdirectory --- text_generation/causal_lm/cpp/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/text_generation/causal_lm/cpp/CMakeLists.txt b/text_generation/causal_lm/cpp/CMakeLists.txt index 1d9cbd66be..aad9a1e9b7 100644 --- a/text_generation/causal_lm/cpp/CMakeLists.txt +++ b/text_generation/causal_lm/cpp/CMakeLists.txt @@ -79,3 +79,5 @@ target_link_libraries(${TARGET_NAME} PRIVATE generate_pipeline_lib) target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") set_target_properties(${TARGET_NAME} PROPERTIES CXX_STANDARD 17) set_target_properties(${TARGET_NAME} PROPERTIES CXX_STANDARD_REQUIRED ON) + +add_subdirectory(generate_pipeline/python-bindings) From 0998abc151a9b40f0989d27e00a32367c6d32365 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Wed, 8 May 2024 12:36:07 +0400 Subject: [PATCH 03/37] add files --- .../python/pyproject.toml => pyproject.toml | 30 ++++---- .../python-bindings/CMakeLists.txt | 20 ++++++ .../python-bindings/openvino/__init__.py | 70 +++++++++++++++++++ .../openvino_genai_bindings.cpp | 26 +++++++ third-party-programs.txt | 1 + 5 files changed, 133 insertions(+), 14 deletions(-) rename text_generation/causal_lm/cpp/generate_pipeline/python/pyproject.toml => pyproject.toml (67%) create mode 100644 text_generation/causal_lm/cpp/generate_pipeline/python-bindings/CMakeLists.txt create mode 100644 text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino/__init__.py create mode 100644 text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino_genai_bindings.cpp create mode 100644 third-party-programs.txt diff --git a/text_generation/causal_lm/cpp/generate_pipeline/python/pyproject.toml b/pyproject.toml similarity index 67% rename from text_generation/causal_lm/cpp/generate_pipeline/python/pyproject.toml rename to pyproject.toml index 33b4edda5c..71c85319bd 100644 --- a/text_generation/causal_lm/cpp/generate_pipeline/python/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,9 @@ [project] -name = "py_continuous_batching" +name = "openvino.genai" version = "2024.2.0.0" -description = "Convert tokenizers into OpenVINO models" +description = "Python bindings for https://github.com/openvinotoolkit/openvino.genai" requires-python = ">=3.8" -readme = {file = "../../../../../README.md", content-type="text/markdown"} +readme = {file = "text_generation/causal_lm/cpp/README.md", content-type="text/markdown"} license = {text = "OSI Approved :: Apache Software License"} authors = [ @@ -19,11 +19,11 @@ classifiers = [ ] dependencies = [ - # support of nightly openvino packages with dev suffix - "openvino~=2024.1.0.0" + "openvino_tokenizers~=2024.1.0.0" ] [project.optional-dependencies] +# TODO: do I need to propagate all this to openvino_tokenizers transformers = [ "transformers[sentencepiece] >= 4.36.0", "tiktoken" @@ -71,27 +71,29 @@ select = ["C", "E", "F", "I", "W"] lines-after-imports = 2 [tool.scikit-build] +install.components = ["openvino_genai_bindings_install_target"] +cmake.source-dir = "text_generation/causal_lm/cpp" cmake.build-type = "Release" -#cmake.args = [ +cmake.args = [ + "-DBUILD_SHARED_LIBS=NO" # "-DCMAKE_INSTALL_BINDIR=lib", # "-DCMAKE_INSTALL_LIBDIR=lib" -#] -cmake.targets = ["py_continuous_batching"] +] +cmake.targets = ["openvino_genai_bindings"] wheel.build-tag = "000" -#wheel.packages = ["py_continuous_batching"] # my python files -wheel.install-dir = "py_continuous_batching" +wheel.packages = ["text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino"] +wheel.install-dir = "openvino/genai" wheel.py-api = "py3" -# TODO: how to get files from top folders -#wheel.license-files = ["../../../../../LICENSE", "../../../../../third-party-programs.txt", "../../../../../SECURITY.md"] +wheel.license-files = ["LICENSE", "SECURITY.md"] # TODO: Do we need third-party-programs.txt like openvino_tokenizers? sdist.exclude = ["dist", "tests", "examples", "python/tests"] sdist.cmake = true [[tool.scikit-build.generate]] -path = "__version__.py" +path = "openvino/genai/__version__.py" template = ''' __version__ = "${version}" ''' [build-system] requires = ["scikit-build-core~=0.8.0"] -build-backend = "scikit_build_core.build" \ No newline at end of file +build-backend = "scikit_build_core.build" diff --git a/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/CMakeLists.txt b/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/CMakeLists.txt new file mode 100644 index 0000000000..41dabe43b5 --- /dev/null +++ b/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/CMakeLists.txt @@ -0,0 +1,20 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +include(FetchContent) +FetchContent_Declare( + pybind11 + GIT_REPOSITORY https://github.com/pybind/pybind11 + GIT_TAG v2.12.0 +) + +FetchContent_GetProperties(pybind11) +if(NOT pybind11_POPULATED) + FetchContent_Populate(pybind11) + add_subdirectory(${pybind11_SOURCE_DIR} ${pybind11_BINARY_DIR}) +endif() + +pybind11_add_module(openvino_genai_bindings openvino_genai_bindings.cpp) +target_link_libraries(openvino_genai_bindings PRIVATE generate_pipeline_lib) +# TODO: how to link with tokenizers and openvino +install(TARGETS openvino_genai_bindings LIBRARY DESTINATION . COMPONENT openvino_genai_bindings_install_target) diff --git a/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino/__init__.py b/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino/__init__.py new file mode 100644 index 0000000000..24a0ee92ec --- /dev/null +++ b/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino/__init__.py @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2018-2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +__path__ = __import__("pkgutil").extend_path(__path__, __name__) + +# Required for Windows OS platforms +# Note: always top-level +try: + from openvino.utils import _add_openvino_libs_to_search_path + _add_openvino_libs_to_search_path() +except ImportError: + pass + +# # +# # OpenVINO API +# # This __init__.py forces checking of runtime modules to propagate errors. +# # It is not compared with init files from openvino-dev package. +# # +# Import all public modules +from openvino import runtime as runtime +from openvino import frontend as frontend +from openvino import helpers as helpers +from openvino import preprocess as preprocess +from openvino import utils as utils +from openvino import properties as properties + +# Import most important classes and functions from openvino.runtime +from openvino.runtime import Model +from openvino.runtime import Core +from openvino.runtime import CompiledModel +from openvino.runtime import InferRequest +from openvino.runtime import AsyncInferQueue + +from openvino.runtime import Symbol +from openvino.runtime import Dimension +from openvino.runtime import Strides +from openvino.runtime import PartialShape +from openvino.runtime import Shape +from openvino.runtime import Layout +from openvino.runtime import Type +from openvino.runtime import Tensor +from openvino.runtime import OVAny + +from openvino.runtime import compile_model +from openvino.runtime import get_batch +from openvino.runtime import set_batch +from openvino.runtime import serialize +from openvino.runtime import shutdown +from openvino.runtime import tensor_from_file +from openvino.runtime import save_model +from openvino.runtime import layout_helpers + +from openvino._pyopenvino import RemoteContext +from openvino._pyopenvino import RemoteTensor + +# libva related: +from openvino._pyopenvino import VAContext +from openvino._pyopenvino import VASurfaceTensor + +# Set version for openvino package +from openvino.runtime import get_version +__version__ = get_version() + +# Tools +try: + # Model Conversion API - ovc should reside in the main namespace + from openvino.tools.ovc import convert_model +except ImportError: + pass diff --git a/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino_genai_bindings.cpp b/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino_genai_bindings.cpp new file mode 100644 index 0000000000..7485a503ec --- /dev/null +++ b/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino_genai_bindings.cpp @@ -0,0 +1,26 @@ +// Copyright (C) 2024 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include +#include +#include + +#include "pybind11/pybind11.h" +#include + +struct GenerationConfig { + bool do_sample; + +}; + +namespace py = pybind11; + + +PYBIND11_MODULE(py_continuous_batching, m) { + py::class_(m, "GenerationConfig") + .def(py::init<>()) + .def_readwrite("do_sample", &GenerationConfig::do_sample); + +} diff --git a/third-party-programs.txt b/third-party-programs.txt new file mode 100644 index 0000000000..60d40abdd0 --- /dev/null +++ b/third-party-programs.txt @@ -0,0 +1 @@ +TODO: do I need it? \ No newline at end of file From 15492c4a0e73b230908a3a337146b2f7f848a109 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Wed, 8 May 2024 13:37:20 +0400 Subject: [PATCH 04/37] add __init__.py --- .../generate_pipeline/python-bindings/openvino/genai/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino/genai/__init__.py diff --git a/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino/genai/__init__.py b/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino/genai/__init__.py new file mode 100644 index 0000000000..e69de29bb2 From 95c1bfbfc76facec8f83cda7d843ed59e4f8b897 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Thu, 9 May 2024 12:56:38 +0400 Subject: [PATCH 05/37] rm generate_pipeline/python --- .../generate_pipeline/python/CMakeLists.txt | 22 ---------------- .../cpp/generate_pipeline/python/__init__.py | 0 .../cpp/generate_pipeline/python/python.cpp | 26 ------------------- 3 files changed, 48 deletions(-) delete mode 100644 text_generation/causal_lm/cpp/generate_pipeline/python/CMakeLists.txt delete mode 100644 text_generation/causal_lm/cpp/generate_pipeline/python/__init__.py delete mode 100644 text_generation/causal_lm/cpp/generate_pipeline/python/python.cpp diff --git a/text_generation/causal_lm/cpp/generate_pipeline/python/CMakeLists.txt b/text_generation/causal_lm/cpp/generate_pipeline/python/CMakeLists.txt deleted file mode 100644 index b16294c320..0000000000 --- a/text_generation/causal_lm/cpp/generate_pipeline/python/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ - -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.15) -project(py_continuous_batching) - -include(FetchContent) -FetchContent_Declare( - pybind11 - GIT_REPOSITORY https://github.com/pybind/pybind11 - GIT_TAG v2.12.0 -) - -FetchContent_GetProperties(pybind11) -if(NOT pybind11_POPULATED) - FetchContent_Populate(pybind11) - add_subdirectory(${pybind11_SOURCE_DIR} ${pybind11_BINARY_DIR}) -endif() - -pybind11_add_module(py_continuous_batching python.cpp) -# TODO: how to link with tokenizers \ No newline at end of file diff --git a/text_generation/causal_lm/cpp/generate_pipeline/python/__init__.py b/text_generation/causal_lm/cpp/generate_pipeline/python/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/text_generation/causal_lm/cpp/generate_pipeline/python/python.cpp b/text_generation/causal_lm/cpp/generate_pipeline/python/python.cpp deleted file mode 100644 index 7485a503ec..0000000000 --- a/text_generation/causal_lm/cpp/generate_pipeline/python/python.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2024 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#include -#include -#include - -#include "pybind11/pybind11.h" -#include - -struct GenerationConfig { - bool do_sample; - -}; - -namespace py = pybind11; - - -PYBIND11_MODULE(py_continuous_batching, m) { - py::class_(m, "GenerationConfig") - .def(py::init<>()) - .def_readwrite("do_sample", &GenerationConfig::do_sample); - -} From be843457384e9c5c254a0efab75f45bda0272e2d Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 10 May 2024 16:35:58 +0400 Subject: [PATCH 06/37] align names --- pyproject.toml | 6 +++--- src/cpp/CMakeLists.txt | 1 + src/python-bindings/CMakeLists.txt | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 71c85319bd..bdad02b7f2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,7 +71,7 @@ select = ["C", "E", "F", "I", "W"] lines-after-imports = 2 [tool.scikit-build] -install.components = ["openvino_genai_bindings_install_target"] +install.components = ["py_generate_pipeline_install_target"] cmake.source-dir = "text_generation/causal_lm/cpp" cmake.build-type = "Release" cmake.args = [ @@ -79,9 +79,9 @@ cmake.args = [ # "-DCMAKE_INSTALL_BINDIR=lib", # "-DCMAKE_INSTALL_LIBDIR=lib" ] -cmake.targets = ["openvino_genai_bindings"] +cmake.targets = ["py_generate_pipeline"] wheel.build-tag = "000" -wheel.packages = ["text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino"] +wheel.packages = ["src/python-bindings/openvino"] wheel.install-dir = "openvino/genai" wheel.py-api = "py3" wheel.license-files = ["LICENSE", "SECURITY.md"] # TODO: Do we need third-party-programs.txt like openvino_tokenizers? diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index bbdea5b1ab..5276aac100 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -10,6 +10,7 @@ add_subdirectory(../../thirdparty/nlohmann_json/ "${CMAKE_CURRENT_BINARY_DIR}/nl # add_subdirectory(../../../thirdparty/Jinja2Cpp/ "${CMAKE_CURRENT_BINARY_DIR}/Jinja2Cpp/") # include_directories(../../../thirdparty/inja/include/Jinja2Cpp) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) set(TARGET_NAME generate_pipeline_lib) file(GLOB SOURCE_FILES "src/*.cpp") diff --git a/src/python-bindings/CMakeLists.txt b/src/python-bindings/CMakeLists.txt index a030fed156..9c9b8e9b3f 100644 --- a/src/python-bindings/CMakeLists.txt +++ b/src/python-bindings/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + include(FetchContent) FetchContent_Declare( pybind11 @@ -13,3 +16,4 @@ endif() pybind11_add_module(py_generate_pipeline py_generate_pipeline.cpp) target_link_libraries(py_generate_pipeline PRIVATE generate_pipeline_lib) +install(TARGETS py_generate_pipeline LIBRARY DESTINATION . COMPONENT py_generate_pipeline_install_target) From bced64a8963dd26904a189680e634ee1e0e8eb47 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 10 May 2024 16:37:11 +0400 Subject: [PATCH 07/37] Dont modify text_generation/causal_lm/cpp/CMakeLists.txt --- text_generation/causal_lm/cpp/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/text_generation/causal_lm/cpp/CMakeLists.txt b/text_generation/causal_lm/cpp/CMakeLists.txt index 731d19ba51..c659603fe3 100644 --- a/text_generation/causal_lm/cpp/CMakeLists.txt +++ b/text_generation/causal_lm/cpp/CMakeLists.txt @@ -55,5 +55,3 @@ target_link_libraries(${TARGET_NAME} PRIVATE generate_pipeline_lib) target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") set_target_properties(${TARGET_NAME} PROPERTIES CXX_STANDARD 17) set_target_properties(${TARGET_NAME} PROPERTIES CXX_STANDARD_REQUIRED ON) - -add_subdirectory(generate_pipeline/python-bindings) From f4e82b6fd957c126ee36f89cfb85c4eb001ead06 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 10 May 2024 16:38:01 +0400 Subject: [PATCH 08/37] rm -r text_generation/causal_lm/cpp/generate_pipeline/python-bindings/ --- .../python-bindings/CMakeLists.txt | 20 ------ .../python-bindings/openvino/__init__.py | 70 ------------------- .../openvino/genai/__init__.py | 0 .../openvino_genai_bindings.cpp | 26 ------- 4 files changed, 116 deletions(-) delete mode 100644 text_generation/causal_lm/cpp/generate_pipeline/python-bindings/CMakeLists.txt delete mode 100644 text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino/__init__.py delete mode 100644 text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino/genai/__init__.py delete mode 100644 text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino_genai_bindings.cpp diff --git a/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/CMakeLists.txt b/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/CMakeLists.txt deleted file mode 100644 index 41dabe43b5..0000000000 --- a/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -include(FetchContent) -FetchContent_Declare( - pybind11 - GIT_REPOSITORY https://github.com/pybind/pybind11 - GIT_TAG v2.12.0 -) - -FetchContent_GetProperties(pybind11) -if(NOT pybind11_POPULATED) - FetchContent_Populate(pybind11) - add_subdirectory(${pybind11_SOURCE_DIR} ${pybind11_BINARY_DIR}) -endif() - -pybind11_add_module(openvino_genai_bindings openvino_genai_bindings.cpp) -target_link_libraries(openvino_genai_bindings PRIVATE generate_pipeline_lib) -# TODO: how to link with tokenizers and openvino -install(TARGETS openvino_genai_bindings LIBRARY DESTINATION . COMPONENT openvino_genai_bindings_install_target) diff --git a/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino/__init__.py b/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino/__init__.py deleted file mode 100644 index 24a0ee92ec..0000000000 --- a/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino/__init__.py +++ /dev/null @@ -1,70 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2018-2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -__path__ = __import__("pkgutil").extend_path(__path__, __name__) - -# Required for Windows OS platforms -# Note: always top-level -try: - from openvino.utils import _add_openvino_libs_to_search_path - _add_openvino_libs_to_search_path() -except ImportError: - pass - -# # -# # OpenVINO API -# # This __init__.py forces checking of runtime modules to propagate errors. -# # It is not compared with init files from openvino-dev package. -# # -# Import all public modules -from openvino import runtime as runtime -from openvino import frontend as frontend -from openvino import helpers as helpers -from openvino import preprocess as preprocess -from openvino import utils as utils -from openvino import properties as properties - -# Import most important classes and functions from openvino.runtime -from openvino.runtime import Model -from openvino.runtime import Core -from openvino.runtime import CompiledModel -from openvino.runtime import InferRequest -from openvino.runtime import AsyncInferQueue - -from openvino.runtime import Symbol -from openvino.runtime import Dimension -from openvino.runtime import Strides -from openvino.runtime import PartialShape -from openvino.runtime import Shape -from openvino.runtime import Layout -from openvino.runtime import Type -from openvino.runtime import Tensor -from openvino.runtime import OVAny - -from openvino.runtime import compile_model -from openvino.runtime import get_batch -from openvino.runtime import set_batch -from openvino.runtime import serialize -from openvino.runtime import shutdown -from openvino.runtime import tensor_from_file -from openvino.runtime import save_model -from openvino.runtime import layout_helpers - -from openvino._pyopenvino import RemoteContext -from openvino._pyopenvino import RemoteTensor - -# libva related: -from openvino._pyopenvino import VAContext -from openvino._pyopenvino import VASurfaceTensor - -# Set version for openvino package -from openvino.runtime import get_version -__version__ = get_version() - -# Tools -try: - # Model Conversion API - ovc should reside in the main namespace - from openvino.tools.ovc import convert_model -except ImportError: - pass diff --git a/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino/genai/__init__.py b/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino/genai/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino_genai_bindings.cpp b/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino_genai_bindings.cpp deleted file mode 100644 index 7485a503ec..0000000000 --- a/text_generation/causal_lm/cpp/generate_pipeline/python-bindings/openvino_genai_bindings.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2024 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#include -#include -#include - -#include "pybind11/pybind11.h" -#include - -struct GenerationConfig { - bool do_sample; - -}; - -namespace py = pybind11; - - -PYBIND11_MODULE(py_continuous_batching, m) { - py::class_(m, "GenerationConfig") - .def(py::init<>()) - .def_readwrite("do_sample", &GenerationConfig::do_sample); - -} From 5b2b0cad4c2ae3913f0546a3bf78eafc92e78479 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 10 May 2024 16:53:16 +0400 Subject: [PATCH 09/37] fix build --- pyproject.toml | 2 +- src/python-bindings/CMakeLists.txt | 2 ++ text_generation/causal_lm/cpp/CMakeLists.txt | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index bdad02b7f2..35ac1f51d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -83,7 +83,7 @@ cmake.targets = ["py_generate_pipeline"] wheel.build-tag = "000" wheel.packages = ["src/python-bindings/openvino"] wheel.install-dir = "openvino/genai" -wheel.py-api = "py3" +wheel.py-api = "" wheel.license-files = ["LICENSE", "SECURITY.md"] # TODO: Do we need third-party-programs.txt like openvino_tokenizers? sdist.exclude = ["dist", "tests", "examples", "python/tests"] sdist.cmake = true diff --git a/src/python-bindings/CMakeLists.txt b/src/python-bindings/CMakeLists.txt index 9c9b8e9b3f..673a172587 100644 --- a/src/python-bindings/CMakeLists.txt +++ b/src/python-bindings/CMakeLists.txt @@ -15,5 +15,7 @@ if(NOT pybind11_POPULATED) endif() pybind11_add_module(py_generate_pipeline py_generate_pipeline.cpp) +set_target_properties(py_generate_pipeline PROPERTIES CXX_STANDARD 17) +set_target_properties(py_generate_pipeline PROPERTIES CXX_STANDARD_REQUIRED ON) target_link_libraries(py_generate_pipeline PRIVATE generate_pipeline_lib) install(TARGETS py_generate_pipeline LIBRARY DESTINATION . COMPONENT py_generate_pipeline_install_target) diff --git a/text_generation/causal_lm/cpp/CMakeLists.txt b/text_generation/causal_lm/cpp/CMakeLists.txt index c659603fe3..25215e9fdd 100644 --- a/text_generation/causal_lm/cpp/CMakeLists.txt +++ b/text_generation/causal_lm/cpp/CMakeLists.txt @@ -6,6 +6,8 @@ project(causal_lm) set(CMAKE_POSITION_INDEPENDENT_CODE ON) +add_subdirectory(../../../thirdparty/openvino_tokenizers/ "${CMAKE_CURRENT_BINARY_DIR}/openvino_tokenizers/") + set(TARGET_NAME greedy_causal_lm) add_executable(${TARGET_NAME} greedy_causal_lm.cpp) target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") From 0dd8f59583bb61c46e1224afe557c0b22d1a54aa Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 10 May 2024 16:58:18 +0400 Subject: [PATCH 10/37] add tokenizers only once --- CMakeLists.txt | 1 + src/cpp/CMakeLists.txt | 1 - text_generation/causal_lm/cpp/CMakeLists.txt | 2 -- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c55fba075..0caa8c0315 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,7 @@ cmake_minimum_required(VERSION 3.15) project(openvino_genai) +add_subdirectory(./thirdparty/openvino_tokenizers/ "${CMAKE_CURRENT_BINARY_DIR}/openvino_tokenizers/") add_subdirectory(src) add_subdirectory(text_generation/causal_lm/cpp) diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 5276aac100..0715e91b8e 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -2,7 +2,6 @@ set(JINJA2CPP_DEPS_MODE internal) -add_subdirectory(../../thirdparty/openvino_tokenizers/ "${CMAKE_CURRENT_BINARY_DIR}/openvino_tokenizers/") add_subdirectory(../../thirdparty/nlohmann_json/ "${CMAKE_CURRENT_BINARY_DIR}/nlohmann_json/") # todo: remove hardcodes and make submodule work diff --git a/text_generation/causal_lm/cpp/CMakeLists.txt b/text_generation/causal_lm/cpp/CMakeLists.txt index 25215e9fdd..c659603fe3 100644 --- a/text_generation/causal_lm/cpp/CMakeLists.txt +++ b/text_generation/causal_lm/cpp/CMakeLists.txt @@ -6,8 +6,6 @@ project(causal_lm) set(CMAKE_POSITION_INDEPENDENT_CODE ON) -add_subdirectory(../../../thirdparty/openvino_tokenizers/ "${CMAKE_CURRENT_BINARY_DIR}/openvino_tokenizers/") - set(TARGET_NAME greedy_causal_lm) add_executable(${TARGET_NAME} greedy_causal_lm.cpp) target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") From 23638ff00548b156552bd7beff47fb9b342c849d Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 10 May 2024 17:03:13 +0400 Subject: [PATCH 11/37] change cmake.source-dir --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 35ac1f51d6..478bb22194 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,7 +72,7 @@ lines-after-imports = 2 [tool.scikit-build] install.components = ["py_generate_pipeline_install_target"] -cmake.source-dir = "text_generation/causal_lm/cpp" +cmake.source-dir = "./" cmake.build-type = "Release" cmake.args = [ "-DBUILD_SHARED_LIBS=NO" From d8c534994416e5cb0fd554e5dd83f8870dae4d46 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 10 May 2024 17:08:38 +0400 Subject: [PATCH 12/37] restore openvino/genai inits --- src/python-bindings/openvino/__init__.py | 70 +++++++++++++++++++ .../openvino/genai/__init__.py | 0 2 files changed, 70 insertions(+) create mode 100644 src/python-bindings/openvino/__init__.py create mode 100644 src/python-bindings/openvino/genai/__init__.py diff --git a/src/python-bindings/openvino/__init__.py b/src/python-bindings/openvino/__init__.py new file mode 100644 index 0000000000..24a0ee92ec --- /dev/null +++ b/src/python-bindings/openvino/__init__.py @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2018-2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +__path__ = __import__("pkgutil").extend_path(__path__, __name__) + +# Required for Windows OS platforms +# Note: always top-level +try: + from openvino.utils import _add_openvino_libs_to_search_path + _add_openvino_libs_to_search_path() +except ImportError: + pass + +# # +# # OpenVINO API +# # This __init__.py forces checking of runtime modules to propagate errors. +# # It is not compared with init files from openvino-dev package. +# # +# Import all public modules +from openvino import runtime as runtime +from openvino import frontend as frontend +from openvino import helpers as helpers +from openvino import preprocess as preprocess +from openvino import utils as utils +from openvino import properties as properties + +# Import most important classes and functions from openvino.runtime +from openvino.runtime import Model +from openvino.runtime import Core +from openvino.runtime import CompiledModel +from openvino.runtime import InferRequest +from openvino.runtime import AsyncInferQueue + +from openvino.runtime import Symbol +from openvino.runtime import Dimension +from openvino.runtime import Strides +from openvino.runtime import PartialShape +from openvino.runtime import Shape +from openvino.runtime import Layout +from openvino.runtime import Type +from openvino.runtime import Tensor +from openvino.runtime import OVAny + +from openvino.runtime import compile_model +from openvino.runtime import get_batch +from openvino.runtime import set_batch +from openvino.runtime import serialize +from openvino.runtime import shutdown +from openvino.runtime import tensor_from_file +from openvino.runtime import save_model +from openvino.runtime import layout_helpers + +from openvino._pyopenvino import RemoteContext +from openvino._pyopenvino import RemoteTensor + +# libva related: +from openvino._pyopenvino import VAContext +from openvino._pyopenvino import VASurfaceTensor + +# Set version for openvino package +from openvino.runtime import get_version +__version__ = get_version() + +# Tools +try: + # Model Conversion API - ovc should reside in the main namespace + from openvino.tools.ovc import convert_model +except ImportError: + pass diff --git a/src/python-bindings/openvino/genai/__init__.py b/src/python-bindings/openvino/genai/__init__.py new file mode 100644 index 0000000000..e69de29bb2 From 598dda3db198b46b58e4f1476e2b0e87c8c03a37 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 10 May 2024 18:05:05 +0400 Subject: [PATCH 13/37] install genai lib --- pyproject.toml | 4 ++-- src/cpp/CMakeLists.txt | 2 ++ src/python-bindings/openvino/genai/__init__.py | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 478bb22194..7e0a940dfa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,7 +71,7 @@ select = ["C", "E", "F", "I", "W"] lines-after-imports = 2 [tool.scikit-build] -install.components = ["py_generate_pipeline_install_target"] +install.components = ["py_generate_pipeline_install_target", "generate_pipeline_lib_install_target"] cmake.source-dir = "./" cmake.build-type = "Release" cmake.args = [ @@ -79,7 +79,7 @@ cmake.args = [ # "-DCMAKE_INSTALL_BINDIR=lib", # "-DCMAKE_INSTALL_LIBDIR=lib" ] -cmake.targets = ["py_generate_pipeline"] +cmake.targets = ["py_generate_pipeline", "generate_pipeline_lib"] wheel.build-tag = "000" wheel.packages = ["src/python-bindings/openvino"] wheel.install-dir = "openvino/genai" diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 0715e91b8e..0341b9c4d2 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -23,3 +23,5 @@ target_compile_definitions(${TARGET_NAME} PRIVATE OPENVINO_TOKENIZERS_PATH=\"$ Date: Fri, 10 May 2024 18:08:03 +0400 Subject: [PATCH 14/37] import openvino for win and lin --- src/python-bindings/openvino/genai/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python-bindings/openvino/genai/__init__.py b/src/python-bindings/openvino/genai/__init__.py index a00c04f6e7..07b8c0e67e 100644 --- a/src/python-bindings/openvino/genai/__init__.py +++ b/src/python-bindings/openvino/genai/__init__.py @@ -1,8 +1,8 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 +import openvino # add_dll_directory for openvino lib import os if hasattr(os, "add_dll_directory"): os.add_dll_directory(os.path.dirname(__file__)) - import openvino # add_dll_directory for openvino lib From a27c5a7149ea49070df0affd8b76871801e66dbb Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 10 May 2024 18:15:22 +0400 Subject: [PATCH 15/37] put the line back --- src/cpp/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 287c350ed2..8a3861bcb2 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -54,6 +54,7 @@ target_include_directories(${TARGET_NAME} target_link_libraries(${TARGET_NAME} PUBLIC openvino::runtime PRIVATE nlohmann_json::nlohmann_json jinja2cpp) target_compile_definitions(${TARGET_NAME} PRIVATE OPENVINO_TOKENIZERS_PATH=\"$\") + set_target_properties(${TARGET_NAME} PROPERTIES CXX_STANDARD_REQUIRED ON CXX_STANDARD 17) From 34cddff80ca72c8f1e6f3e2e1965a9c218628ac0 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 10 May 2024 18:18:27 +0400 Subject: [PATCH 16/37] one line properties --- src/python/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 33475b45a5..81f6bf1658 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -16,7 +16,8 @@ if(NOT pybind11_POPULATED) endif() pybind11_add_module(py_generate_pipeline py_generate_pipeline.cpp) -set_target_properties(py_generate_pipeline PROPERTIES CXX_STANDARD 17) -set_target_properties(py_generate_pipeline PROPERTIES CXX_STANDARD_REQUIRED ON) +set_target_properties(${TARGET_NAME} PROPERTIES + CXX_STANDARD_REQUIRED ON + CXX_STANDARD 17) target_link_libraries(py_generate_pipeline PRIVATE generate_pipeline_lib) install(TARGETS py_generate_pipeline LIBRARY DESTINATION . COMPONENT py_generate_pipeline_install_target) From 9ef488c51684cf5d8a729a28e3ee78ad43884cf3 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 10 May 2024 19:56:29 +0400 Subject: [PATCH 17/37] rename --- pyproject.toml | 72 +- src/cpp/CMakeLists.txt | 3 +- src/python/CMakeLists.txt | 6 +- .../openvino/__init__.py | 0 .../openvino/genai/__init__.py | 0 third-party-programs.txt | 1181 ++++++++++++++++- 6 files changed, 1190 insertions(+), 72 deletions(-) rename src/{python-bindings => python}/openvino/__init__.py (100%) rename src/{python-bindings => python}/openvino/genai/__init__.py (100%) diff --git a/pyproject.toml b/pyproject.toml index 7e0a940dfa..2d60b44e30 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,15 +1,13 @@ [project] -name = "openvino.genai" +name = "openvino_genai" version = "2024.2.0.0" description = "Python bindings for https://github.com/openvinotoolkit/openvino.genai" requires-python = ">=3.8" readme = {file = "text_generation/causal_lm/cpp/README.md", content-type="text/markdown"} license = {text = "OSI Approved :: Apache Software License"} - authors = [ { name = "OpenVINO Developers", email = "openvino@intel.com" }, ] - classifiers = [ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", @@ -17,76 +15,20 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", ] - dependencies = [ - "openvino_tokenizers~=2024.1.0.0" -] - -[project.optional-dependencies] -# TODO: do I need to propagate all this to openvino_tokenizers -transformers = [ - "transformers[sentencepiece] >= 4.36.0", - "tiktoken" -] -# chatglm2 custom tokenizer file imports torch, have to add torch dependency for tests -torch = [ - 'torch' -] -dev = [ - "ruff", - "bandit", - "pytest", - "pytest_harvest", - "pandas", - "openvino_tokenizers[transformers, torch]" -] -benchmark = [ - "pandas", - "seaborn", - "tqdm", - "openvino_tokenizers[transformers]" -] -# don't include fuzzing to avoid windows CI issues -fuzzing = [ - "atheris", - "openvino_tokenizers[transformers]" + "openvino_tokenizers==2024.1.0.0" ] -all = [ - "openvino_tokenizers[dev, transformers]" -] - - -[tool.ruff] -line-length = 119 - -[tool.ruff.lint] -ignore = ["C901", "E501", "E741", "W605"] -select = ["C", "E", "F", "I", "W"] - -[tool.ruff.lint.per-file-ignores] -"__init__.py" = ["F401"] -"openvino_tokenizers/hf_parser.py" = ["F821"] - -[tool.ruff.lint.isort] -lines-after-imports = 2 [tool.scikit-build] -install.components = ["py_generate_pipeline_install_target", "generate_pipeline_lib_install_target"] cmake.source-dir = "./" cmake.build-type = "Release" -cmake.args = [ - "-DBUILD_SHARED_LIBS=NO" -# "-DCMAKE_INSTALL_BINDIR=lib", -# "-DCMAKE_INSTALL_LIBDIR=lib" -] cmake.targets = ["py_generate_pipeline", "generate_pipeline_lib"] -wheel.build-tag = "000" -wheel.packages = ["src/python-bindings/openvino"] +install.components = ["genai", "genai_python"] +sdist.cmake = true +wheel.packages = ["src/python/openvino"] wheel.install-dir = "openvino/genai" wheel.py-api = "" -wheel.license-files = ["LICENSE", "SECURITY.md"] # TODO: Do we need third-party-programs.txt like openvino_tokenizers? -sdist.exclude = ["dist", "tests", "examples", "python/tests"] -sdist.cmake = true +wheel.license-files = ["LICENSE", "SECURITY.md", "third-party-programs.txt"] [[tool.scikit-build.generate]] path = "openvino/genai/__version__.py" @@ -95,5 +37,5 @@ __version__ = "${version}" ''' [build-system] -requires = ["scikit-build-core~=0.8.0"] +requires = ["scikit-build-core>=0.8.0"] build-backend = "scikit_build_core.build" diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 2825955a3c..8bcaf8ab13 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -52,5 +52,4 @@ target_link_libraries(${TARGET_NAME} PUBLIC openvino::runtime PRIVATE nlohmann_j target_compile_definitions(${TARGET_NAME} PRIVATE OPENVINO_TOKENIZERS_PATH=\"$\") target_compile_features(${TARGET_NAME} PUBLIC cxx_std_17) -install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION . COMPONENT generate_pipeline_lib_install_target - RUNTIME DESTINATION . COMPONENT generate_pipeline_lib_install_target) +install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION . COMPONENT genai RUNTIME DESTINATION . COMPONENT genai) diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 81f6bf1658..6261cd9bc7 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -16,8 +16,6 @@ if(NOT pybind11_POPULATED) endif() pybind11_add_module(py_generate_pipeline py_generate_pipeline.cpp) -set_target_properties(${TARGET_NAME} PROPERTIES - CXX_STANDARD_REQUIRED ON - CXX_STANDARD 17) +target_compile_features(py_generate_pipeline PUBLIC cxx_std_17) target_link_libraries(py_generate_pipeline PRIVATE generate_pipeline_lib) -install(TARGETS py_generate_pipeline LIBRARY DESTINATION . COMPONENT py_generate_pipeline_install_target) +install(TARGETS py_generate_pipeline LIBRARY DESTINATION . COMPONENT genai_python) diff --git a/src/python-bindings/openvino/__init__.py b/src/python/openvino/__init__.py similarity index 100% rename from src/python-bindings/openvino/__init__.py rename to src/python/openvino/__init__.py diff --git a/src/python-bindings/openvino/genai/__init__.py b/src/python/openvino/genai/__init__.py similarity index 100% rename from src/python-bindings/openvino/genai/__init__.py rename to src/python/openvino/genai/__init__.py diff --git a/third-party-programs.txt b/third-party-programs.txt index 60d40abdd0..146aea0684 100644 --- a/third-party-programs.txt +++ b/third-party-programs.txt @@ -1 +1,1180 @@ -TODO: do I need it? \ No newline at end of file +OpenVINO Tokenizers Third Party Programs File + +This file contains the list of third party software ("third party programs") +contained in the Intel software and their required notices and/or license +terms. This third party software, even if included with the distribution of +the Intel software, may be governed by separate license terms, including +without limitation, third party license terms, other Intel software license +terms, and open source software license terms. These separate license terms +govern your use of the third party programs as set forth in the +"third-party-programs.txt" or other similarly-named text file. + +Third party programs and their corresponding required notices and/or license +terms are listed below. + +------------------------------------------------------------- + +transformers + +Copyright 2018- The Hugging Face team. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +------------------------------------------------------------- + +fast_tokenizer + +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, +and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by +the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all +other entities that control, are controlled by, or are under common +control with that entity. For the purposes of this definition, +"control" means (i) the power, direct or indirect, to cause the +direction or management of such entity, whether by contract or +otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity +exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, +including but not limited to software source code, documentation +source, and configuration files. + +"Object" form shall mean any form resulting from mechanical +transformation or translation of a Source form, including but +not limited to compiled object code, generated documentation, +and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or +Object form, made available under the License, as indicated by a +copyright notice that is included in or attached to the work +(an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object +form, that is based on (or derived from) the Work and for which the +editorial revisions, annotations, elaborations, or other modifications +represent, as a whole, an original work of authorship. For the purposes +of this License, Derivative Works shall not include works that remain +separable from, or merely link (or bind by name) to the interfaces of, +the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including +the original version of the Work and any modifications or additions +to that Work or Derivative Works thereof, that is intentionally +submitted to Licensor for inclusion in the Work by the copyright owner +or by an individual or Legal Entity authorized to submit on behalf of +the copyright owner. For the purposes of this definition, "submitted" +means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, +and issue tracking systems that are managed by, or on behalf of, the +Licensor for the purpose of discussing and improving the Work, but +excluding communication that is conspicuously marked or otherwise +designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity +on behalf of whom a Contribution has been received by Licensor and +subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the +Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +(except as stated in this section) patent license to make, have made, +use, offer to sell, sell, import, and otherwise transfer the Work, +where such license applies only to those patent claims licensable +by such Contributor that are necessarily infringed by their +Contribution(s) alone or by combination of their Contribution(s) +with the Work to which such Contribution(s) was submitted. If You +institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work +or a Contribution incorporated within the Work constitutes direct +or contributory patent infringement, then any patent licenses +granted to You under this License for that Work shall terminate +as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the +Work or Derivative Works thereof in any medium, with or without +modifications, and in Source or Object form, provided that You +meet the following conditions: + +(a) You must give any other recipients of the Work or +Derivative Works a copy of this License; and + +(b) You must cause any modified files to carry prominent notices +stating that You changed the files; and + +(c) You must retain, in the Source form of any Derivative Works +that You distribute, all copyright, patent, trademark, and +attribution notices from the Source form of the Work, +excluding those notices that do not pertain to any part of +the Derivative Works; and + +(d) If the Work includes a "NOTICE" text file as part of its +distribution, then any Derivative Works that You distribute must +include a readable copy of the attribution notices contained +within such NOTICE file, excluding those notices that do not +pertain to any part of the Derivative Works, in at least one +of the following places: within a NOTICE text file distributed +as part of the Derivative Works; within the Source form or +documentation, if provided along with the Derivative Works; or, +within a display generated by the Derivative Works, if and +wherever such third-party notices normally appear. The contents +of the NOTICE file are for informational purposes only and +do not modify the License. You may add Your own attribution +notices within Derivative Works that You distribute, alongside +or as an addendum to the NOTICE text from the Work, provided +that such additional attribution notices cannot be construed +as modifying the License. + +You may add Your own copyright statement to Your modifications and +may provide additional or different license terms and conditions +for use, reproduction, or distribution of Your modifications, or +for any such Derivative Works as a whole, provided Your use, +reproduction, and distribution of the Work otherwise complies with +the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, +any Contribution intentionally submitted for inclusion in the Work +by You to the Licensor shall be under the terms and conditions of +this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify +the terms of any separate license agreement you may have executed +with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade +names, trademarks, service marks, or product names of the Licensor, +except as required for reasonable and customary use in describing the +origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or +agreed to in writing, Licensor provides the Work (and each +Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied, including, without limitation, any warranties or conditions +of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +PARTICULAR PURPOSE. You are solely responsible for determining the +appropriateness of using or redistributing the Work and assume any +risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, +whether in tort (including negligence), contract, or otherwise, +unless required by applicable law (such as deliberate and grossly +negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, +incidental, or consequential damages of any character arising as a +result of this License or out of the use or inability to use the +Work (including but not limited to damages for loss of goodwill, +work stoppage, computer failure or malfunction, or any and all +other commercial damages or losses), even if such Contributor +has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing +the Work or Derivative Works thereof, You may choose to offer, +and charge a fee for, acceptance of support, warranty, indemnity, +or other liability obligations and/or rights consistent with this +License. However, in accepting such obligations, You may act only +on Your own behalf and on Your sole responsibility, not on behalf +of any other Contributor, and only if You agree to indemnify, +defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason +of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + +To apply the Apache License to your work, attach the following +boilerplate notice, with the fields enclosed by brackets "[]" +replaced with your own identifying information. (Don't include +the brackets!) The text should be enclosed in the appropriate +comment syntax for the file format. We also recommend that a +file or class name and description of purpose be included on the +same "printed page" as the copyright notice for easier +identification within third-party archives. + +Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +------------------------------------------------------------- + +re2 + +// Copyright (c) 2009 The RE2 Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------- + +icu4c + +UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE + +See Terms of Use +for definitions of Unicode Inc.’s Data Files and Software. + +NOTICE TO USER: Carefully read the following legal agreement. +BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S +DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), +YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE +TERMS AND CONDITIONS OF THIS AGREEMENT. +IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE +THE DATA FILES OR SOFTWARE. + +COPYRIGHT AND PERMISSION NOTICE + +Copyright © 1991-2022 Unicode, Inc. All rights reserved. +Distributed under the Terms of Use in https://www.unicode.org/copyright.html. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Unicode data files and any associated documentation +(the "Data Files") or Unicode software and any associated documentation +(the "Software") to deal in the Data Files or Software +without restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, and/or sell copies of +the Data Files or Software, and to permit persons to whom the Data Files +or Software are furnished to do so, provided that either +(a) this copyright and permission notice appear with all copies +of the Data Files or Software, or +(b) this copyright and permission notice appear in associated +Documentation. + +THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT OF THIRD PARTY RIGHTS. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS +NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL +DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THE DATA FILES OR SOFTWARE. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, +use or other dealings in these Data Files or Software without prior +written authorization of the copyright holder. + +------------------------------------------------------------- + +sentencepiece + +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, +and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by +the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all +other entities that control, are controlled by, or are under common +control with that entity. For the purposes of this definition, +"control" means (i) the power, direct or indirect, to cause the +direction or management of such entity, whether by contract or +otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity +exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, +including but not limited to software source code, documentation +source, and configuration files. + +"Object" form shall mean any form resulting from mechanical +transformation or translation of a Source form, including but +not limited to compiled object code, generated documentation, +and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or +Object form, made available under the License, as indicated by a +copyright notice that is included in or attached to the work +(an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object +form, that is based on (or derived from) the Work and for which the +editorial revisions, annotations, elaborations, or other modifications +represent, as a whole, an original work of authorship. For the purposes +of this License, Derivative Works shall not include works that remain +separable from, or merely link (or bind by name) to the interfaces of, +the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including +the original version of the Work and any modifications or additions +to that Work or Derivative Works thereof, that is intentionally +submitted to Licensor for inclusion in the Work by the copyright owner +or by an individual or Legal Entity authorized to submit on behalf of +the copyright owner. For the purposes of this definition, "submitted" +means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, +and issue tracking systems that are managed by, or on behalf of, the +Licensor for the purpose of discussing and improving the Work, but +excluding communication that is conspicuously marked or otherwise +designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity +on behalf of whom a Contribution has been received by Licensor and +subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the +Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +(except as stated in this section) patent license to make, have made, +use, offer to sell, sell, import, and otherwise transfer the Work, +where such license applies only to those patent claims licensable +by such Contributor that are necessarily infringed by their +Contribution(s) alone or by combination of their Contribution(s) +with the Work to which such Contribution(s) was submitted. If You +institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work +or a Contribution incorporated within the Work constitutes direct +or contributory patent infringement, then any patent licenses +granted to You under this License for that Work shall terminate +as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the +Work or Derivative Works thereof in any medium, with or without +modifications, and in Source or Object form, provided that You +meet the following conditions: + +(a) You must give any other recipients of the Work or +Derivative Works a copy of this License; and + +(b) You must cause any modified files to carry prominent notices +stating that You changed the files; and + +(c) You must retain, in the Source form of any Derivative Works +that You distribute, all copyright, patent, trademark, and +attribution notices from the Source form of the Work, +excluding those notices that do not pertain to any part of +the Derivative Works; and + +(d) If the Work includes a "NOTICE" text file as part of its +distribution, then any Derivative Works that You distribute must +include a readable copy of the attribution notices contained +within such NOTICE file, excluding those notices that do not +pertain to any part of the Derivative Works, in at least one +of the following places: within a NOTICE text file distributed +as part of the Derivative Works; within the Source form or +documentation, if provided along with the Derivative Works; or, +within a display generated by the Derivative Works, if and +wherever such third-party notices normally appear. The contents +of the NOTICE file are for informational purposes only and +do not modify the License. You may add Your own attribution +notices within Derivative Works that You distribute, alongside +or as an addendum to the NOTICE text from the Work, provided +that such additional attribution notices cannot be construed +as modifying the License. + +You may add Your own copyright statement to Your modifications and +may provide additional or different license terms and conditions +for use, reproduction, or distribution of Your modifications, or +for any such Derivative Works as a whole, provided Your use, +reproduction, and distribution of the Work otherwise complies with +the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, +any Contribution intentionally submitted for inclusion in the Work +by You to the Licensor shall be under the terms and conditions of +this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify +the terms of any separate license agreement you may have executed +with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade +names, trademarks, service marks, or product names of the Licensor, +except as required for reasonable and customary use in describing the +origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or +agreed to in writing, Licensor provides the Work (and each +Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied, including, without limitation, any warranties or conditions +of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +PARTICULAR PURPOSE. You are solely responsible for determining the +appropriateness of using or redistributing the Work and assume any +risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, +whether in tort (including negligence), contract, or otherwise, +unless required by applicable law (such as deliberate and grossly +negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, +incidental, or consequential damages of any character arising as a +result of this License or out of the use or inability to use the +Work (including but not limited to damages for loss of goodwill, +work stoppage, computer failure or malfunction, or any and all +other commercial damages or losses), even if such Contributor +has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing +the Work or Derivative Works thereof, You may choose to offer, +and charge a fee for, acceptance of support, warranty, indemnity, +or other liability obligations and/or rights consistent with this +License. However, in accepting such obligations, You may act only +on Your own behalf and on Your sole responsibility, not on behalf +of any other Contributor, and only if You agree to indemnify, +defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason +of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + +To apply the Apache License to your work, attach the following +boilerplate notice, with the fields enclosed by brackets "[]" +replaced with your own identifying information. (Don't include +the brackets!) The text should be enclosed in the appropriate +comment syntax for the file format. We also recommend that a +file or class name and description of purpose be included on the +same "printed page" as the copyright notice for easier +identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +------------------------------------------------------------- + +tensorflow + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +## Some of TensorFlow's code is derived from Caffe, which is subject to the following copyright notice: + +COPYRIGHT + +All contributions by the University of California: + +Copyright (c) 2014, The Regents of the University of California (Regents) +All rights reserved. + +All other contributions: + +Copyright (c) 2014, the respective contributors +All rights reserved. + +Caffe uses a shared copyright model: each contributor holds copyright over +their contributions to Caffe. The project versioning records all such +contribution and copyright details. If a contributor wants to further mark +their specific copyright on a particular contribution, they should indicate +their copyright solely in the commit message of the change when it is +committed. + +LICENSE + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +CONTRIBUTION AGREEMENT + +By contributing to the BVLC/caffe repository through pull-request, comment, +or otherwise, the contributor releases their content to the +license and copyright terms herein. + +------------------------------------------------------------- + +tensorflow-text + +Copyright 2018 The TensorFlow Authors. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2017, The TensorFlow Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From 4fad7d534df4aad5f01c03551e9f0cbf1bff7fb1 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 10 May 2024 19:58:35 +0400 Subject: [PATCH 18/37] add .github/workflows/genai_lib.yml --- .github/workflows/genai_lib.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/genai_lib.yml diff --git a/.github/workflows/genai_lib.yml b/.github/workflows/genai_lib.yml new file mode 100644 index 0000000000..e14e3b0315 --- /dev/null +++ b/.github/workflows/genai_lib.yml @@ -0,0 +1,14 @@ +name: genai_lib +jobs: + genai_lib: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: actions/setup-python@v4 + with: + python-version: 3.8 + - run: python -m pip install scikit-build + - run: python -m pip isntall . + - run: python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" From 51e03a272cdf79819b4f0df7a4a71b0d437d1689 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 10 May 2024 19:59:50 +0400 Subject: [PATCH 19/37] on: pull_request --- .github/workflows/genai_lib.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/genai_lib.yml b/.github/workflows/genai_lib.yml index e14e3b0315..c53a531b98 100644 --- a/.github/workflows/genai_lib.yml +++ b/.github/workflows/genai_lib.yml @@ -1,4 +1,5 @@ name: genai_lib +on: pull_request jobs: genai_lib: runs-on: ubuntu-20.04 From e23a7bb427dfe09a83e28ce17cf6158b328a8df6 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 10 May 2024 20:00:48 +0400 Subject: [PATCH 20/37] spelling --- .github/workflows/genai_lib.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/genai_lib.yml b/.github/workflows/genai_lib.yml index c53a531b98..8c0202fe2f 100644 --- a/.github/workflows/genai_lib.yml +++ b/.github/workflows/genai_lib.yml @@ -11,5 +11,5 @@ jobs: with: python-version: 3.8 - run: python -m pip install scikit-build - - run: python -m pip isntall . + - run: python -m pip install . - run: python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" From fc5b7539536eb226073596659151c0375c28c450 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Fri, 10 May 2024 20:02:15 +0400 Subject: [PATCH 21/37] install openvino --- .github/workflows/genai_lib.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/genai_lib.yml b/.github/workflows/genai_lib.yml index 8c0202fe2f..c7c711b4e5 100644 --- a/.github/workflows/genai_lib.yml +++ b/.github/workflows/genai_lib.yml @@ -10,6 +10,11 @@ jobs: - uses: actions/setup-python@v4 with: python-version: 3.8 + - name: Install OpenVINO + run: | + mkdir ./ov/ + curl https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.1.0-14645-e6dc0865128/l_openvino_toolkit_ubuntu20_2024.1.0.dev20240304_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz + sudo ./ov/install_dependencies/install_openvino_dependencies.sh - run: python -m pip install scikit-build - - run: python -m pip install . + - run: source ./ov/setupvars.sh && python -m pip install . - run: python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" From e7db7e819e236a3ad1a5eec65728c733a6414003 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Mon, 13 May 2024 14:15:06 +0400 Subject: [PATCH 22/37] update --- .github/workflows/genai_lib.yml | 18 +- pyproject.toml | 5 +- src/python/CMakeLists.txt | 1 - src/python/openvino/genai/__init__.py | 2 + third-party-programs.txt | 1541 +++++++------------------ 5 files changed, 410 insertions(+), 1157 deletions(-) diff --git a/.github/workflows/genai_lib.yml b/.github/workflows/genai_lib.yml index c7c711b4e5..3127fe42b4 100644 --- a/.github/workflows/genai_lib.yml +++ b/.github/workflows/genai_lib.yml @@ -1,7 +1,7 @@ name: genai_lib on: pull_request jobs: - genai_lib: + genai_lib_ubuntu: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v4 @@ -15,6 +15,20 @@ jobs: mkdir ./ov/ curl https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.1.0-14645-e6dc0865128/l_openvino_toolkit_ubuntu20_2024.1.0.dev20240304_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz sudo ./ov/install_dependencies/install_openvino_dependencies.sh - - run: python -m pip install scikit-build - run: source ./ov/setupvars.sh && python -m pip install . - run: python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" + + genai_lib_windows: + runs-on: windows-latest + 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 && python -m pip install . + shell: cmd + - run: python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" diff --git a/pyproject.toml b/pyproject.toml index 2d60b44e30..7e497ecb06 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ classifiers = [ "Programming Language :: Python :: 3.12", ] dependencies = [ - "openvino_tokenizers==2024.1.0.0" + "openvino_tokenizers~=2024.1.0.0" ] [tool.scikit-build] @@ -27,6 +27,7 @@ install.components = ["genai", "genai_python"] sdist.cmake = true wheel.packages = ["src/python/openvino"] wheel.install-dir = "openvino/genai" +wheel.build-tag = "000" wheel.py-api = "" wheel.license-files = ["LICENSE", "SECURITY.md", "third-party-programs.txt"] @@ -37,5 +38,5 @@ __version__ = "${version}" ''' [build-system] -requires = ["scikit-build-core>=0.8.0"] +requires = ["scikit-build-core~=0.8.0"] # See https://github.com/openvinotoolkit/openvino_tokenizers/pull/123 build-backend = "scikit_build_core.build" diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 6261cd9bc7..708ff4d2d8 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -16,6 +16,5 @@ if(NOT pybind11_POPULATED) endif() pybind11_add_module(py_generate_pipeline py_generate_pipeline.cpp) -target_compile_features(py_generate_pipeline PUBLIC cxx_std_17) target_link_libraries(py_generate_pipeline PRIVATE generate_pipeline_lib) install(TARGETS py_generate_pipeline LIBRARY DESTINATION . COMPONENT genai_python) diff --git a/src/python/openvino/genai/__init__.py b/src/python/openvino/genai/__init__.py index 07b8c0e67e..f604e03e84 100644 --- a/src/python/openvino/genai/__init__.py +++ b/src/python/openvino/genai/__init__.py @@ -3,6 +3,8 @@ import openvino # add_dll_directory for openvino lib import os +from .__version__ import __version__ + if hasattr(os, "add_dll_directory"): os.add_dll_directory(os.path.dirname(__file__)) diff --git a/third-party-programs.txt b/third-party-programs.txt index 146aea0684..e418d7b5e3 100644 --- a/third-party-programs.txt +++ b/third-party-programs.txt @@ -1,4 +1,4 @@ -OpenVINO Tokenizers Third Party Programs File +OpenVINO GenAI Third Party Programs File This file contains the list of third party software ("third party programs") contained in the Intel software and their required notices and/or license @@ -14,1167 +14,404 @@ terms are listed below. ------------------------------------------------------------- -transformers - -Copyright 2018- The Hugging Face team. All rights reserved. - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +Jinja2Cpp -------------------------------------------------------------- +Mozilla Public License Version 2.0 +================================== -fast_tokenizer - -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, -and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by -the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all -other entities that control, are controlled by, or are under common -control with that entity. For the purposes of this definition, -"control" means (i) the power, direct or indirect, to cause the -direction or management of such entity, whether by contract or -otherwise, or (ii) ownership of fifty percent (50%) or more of the -outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity -exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, -including but not limited to software source code, documentation -source, and configuration files. - -"Object" form shall mean any form resulting from mechanical -transformation or translation of a Source form, including but -not limited to compiled object code, generated documentation, -and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or -Object form, made available under the License, as indicated by a -copyright notice that is included in or attached to the work -(an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object -form, that is based on (or derived from) the Work and for which the -editorial revisions, annotations, elaborations, or other modifications -represent, as a whole, an original work of authorship. For the purposes -of this License, Derivative Works shall not include works that remain -separable from, or merely link (or bind by name) to the interfaces of, -the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including -the original version of the Work and any modifications or additions -to that Work or Derivative Works thereof, that is intentionally -submitted to Licensor for inclusion in the Work by the copyright owner -or by an individual or Legal Entity authorized to submit on behalf of -the copyright owner. For the purposes of this definition, "submitted" -means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, -and issue tracking systems that are managed by, or on behalf of, the -Licensor for the purpose of discussing and improving the Work, but -excluding communication that is conspicuously marked or otherwise -designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity -on behalf of whom a Contribution has been received by Licensor and -subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of -this License, each Contributor hereby grants to You a perpetual, -worldwide, non-exclusive, no-charge, royalty-free, irrevocable -copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the -Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of -this License, each Contributor hereby grants to You a perpetual, -worldwide, non-exclusive, no-charge, royalty-free, irrevocable -(except as stated in this section) patent license to make, have made, -use, offer to sell, sell, import, and otherwise transfer the Work, -where such license applies only to those patent claims licensable -by such Contributor that are necessarily infringed by their -Contribution(s) alone or by combination of their Contribution(s) -with the Work to which such Contribution(s) was submitted. If You -institute patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Work -or a Contribution incorporated within the Work constitutes direct -or contributory patent infringement, then any patent licenses -granted to You under this License for that Work shall terminate -as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the -Work or Derivative Works thereof in any medium, with or without -modifications, and in Source or Object form, provided that You -meet the following conditions: - -(a) You must give any other recipients of the Work or -Derivative Works a copy of this License; and - -(b) You must cause any modified files to carry prominent notices -stating that You changed the files; and - -(c) You must retain, in the Source form of any Derivative Works -that You distribute, all copyright, patent, trademark, and -attribution notices from the Source form of the Work, -excluding those notices that do not pertain to any part of -the Derivative Works; and - -(d) If the Work includes a "NOTICE" text file as part of its -distribution, then any Derivative Works that You distribute must -include a readable copy of the attribution notices contained -within such NOTICE file, excluding those notices that do not -pertain to any part of the Derivative Works, in at least one -of the following places: within a NOTICE text file distributed -as part of the Derivative Works; within the Source form or -documentation, if provided along with the Derivative Works; or, -within a display generated by the Derivative Works, if and -wherever such third-party notices normally appear. The contents -of the NOTICE file are for informational purposes only and -do not modify the License. You may add Your own attribution -notices within Derivative Works that You distribute, alongside -or as an addendum to the NOTICE text from the Work, provided -that such additional attribution notices cannot be construed -as modifying the License. - -You may add Your own copyright statement to Your modifications and -may provide additional or different license terms and conditions -for use, reproduction, or distribution of Your modifications, or -for any such Derivative Works as a whole, provided Your use, -reproduction, and distribution of the Work otherwise complies with -the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, -any Contribution intentionally submitted for inclusion in the Work -by You to the Licensor shall be under the terms and conditions of -this License, without any additional terms or conditions. -Notwithstanding the above, nothing herein shall supersede or modify -the terms of any separate license agreement you may have executed -with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade -names, trademarks, service marks, or product names of the Licensor, -except as required for reasonable and customary use in describing the -origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or -agreed to in writing, Licensor provides the Work (and each -Contributor provides its Contributions) on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -implied, including, without limitation, any warranties or conditions -of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A -PARTICULAR PURPOSE. You are solely responsible for determining the -appropriateness of using or redistributing the Work and assume any -risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, -whether in tort (including negligence), contract, or otherwise, -unless required by applicable law (such as deliberate and grossly -negligent acts) or agreed to in writing, shall any Contributor be -liable to You for damages, including any direct, indirect, special, -incidental, or consequential damages of any character arising as a -result of this License or out of the use or inability to use the -Work (including but not limited to damages for loss of goodwill, -work stoppage, computer failure or malfunction, or any and all -other commercial damages or losses), even if such Contributor -has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing -the Work or Derivative Works thereof, You may choose to offer, -and charge a fee for, acceptance of support, warranty, indemnity, -or other liability obligations and/or rights consistent with this -License. However, in accepting such obligations, You may act only -on Your own behalf and on Your sole responsibility, not on behalf -of any other Contributor, and only if You agree to indemnify, -defend, and hold each Contributor harmless for any liability -incurred by, or claims asserted against, such Contributor by reason -of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - -To apply the Apache License to your work, attach the following -boilerplate notice, with the fields enclosed by brackets "[]" -replaced with your own identifying information. (Don't include -the brackets!) The text should be enclosed in the appropriate -comment syntax for the file format. We also recommend that a -file or class name and description of purpose be included on the -same "printed page" as the copyright notice for easier -identification within third-party archives. - -Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +1. Definitions +-------------- -------------------------------------------------------------- +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. -re2 - -// Copyright (c) 2009 The RE2 Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. -------------------------------------------------------------- +1.3. "Contribution" + means Covered Software of a particular Contributor. -icu4c - -UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE - -See Terms of Use -for definitions of Unicode Inc.’s Data Files and Software. - -NOTICE TO USER: Carefully read the following legal agreement. -BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S -DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), -YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE -TERMS AND CONDITIONS OF THIS AGREEMENT. -IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE -THE DATA FILES OR SOFTWARE. - -COPYRIGHT AND PERMISSION NOTICE - -Copyright © 1991-2022 Unicode, Inc. All rights reserved. -Distributed under the Terms of Use in https://www.unicode.org/copyright.html. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of the Unicode data files and any associated documentation -(the "Data Files") or Unicode software and any associated documentation -(the "Software") to deal in the Data Files or Software -without restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, and/or sell copies of -the Data Files or Software, and to permit persons to whom the Data Files -or Software are furnished to do so, provided that either -(a) this copyright and permission notice appear with all copies -of the Data Files or Software, or -(b) this copyright and permission notice appear in associated -Documentation. - -THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT OF THIRD PARTY RIGHTS. -IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS -NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL -DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THE DATA FILES OR SOFTWARE. - -Except as contained in this notice, the name of a copyright holder -shall not be used in advertising or otherwise to promote the sale, -use or other dealings in these Data Files or Software without prior -written authorization of the copyright holder. +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. -------------------------------------------------------------- +1.5. "Incompatible With Secondary Licenses" + means -sentencepiece - -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, -and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by -the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all -other entities that control, are controlled by, or are under common -control with that entity. For the purposes of this definition, -"control" means (i) the power, direct or indirect, to cause the -direction or management of such entity, whether by contract or -otherwise, or (ii) ownership of fifty percent (50%) or more of the -outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity -exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, -including but not limited to software source code, documentation -source, and configuration files. - -"Object" form shall mean any form resulting from mechanical -transformation or translation of a Source form, including but -not limited to compiled object code, generated documentation, -and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or -Object form, made available under the License, as indicated by a -copyright notice that is included in or attached to the work -(an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object -form, that is based on (or derived from) the Work and for which the -editorial revisions, annotations, elaborations, or other modifications -represent, as a whole, an original work of authorship. For the purposes -of this License, Derivative Works shall not include works that remain -separable from, or merely link (or bind by name) to the interfaces of, -the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including -the original version of the Work and any modifications or additions -to that Work or Derivative Works thereof, that is intentionally -submitted to Licensor for inclusion in the Work by the copyright owner -or by an individual or Legal Entity authorized to submit on behalf of -the copyright owner. For the purposes of this definition, "submitted" -means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, -and issue tracking systems that are managed by, or on behalf of, the -Licensor for the purpose of discussing and improving the Work, but -excluding communication that is conspicuously marked or otherwise -designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity -on behalf of whom a Contribution has been received by Licensor and -subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of -this License, each Contributor hereby grants to You a perpetual, -worldwide, non-exclusive, no-charge, royalty-free, irrevocable -copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the -Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of -this License, each Contributor hereby grants to You a perpetual, -worldwide, non-exclusive, no-charge, royalty-free, irrevocable -(except as stated in this section) patent license to make, have made, -use, offer to sell, sell, import, and otherwise transfer the Work, -where such license applies only to those patent claims licensable -by such Contributor that are necessarily infringed by their -Contribution(s) alone or by combination of their Contribution(s) -with the Work to which such Contribution(s) was submitted. If You -institute patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Work -or a Contribution incorporated within the Work constitutes direct -or contributory patent infringement, then any patent licenses -granted to You under this License for that Work shall terminate -as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the -Work or Derivative Works thereof in any medium, with or without -modifications, and in Source or Object form, provided that You -meet the following conditions: - -(a) You must give any other recipients of the Work or -Derivative Works a copy of this License; and - -(b) You must cause any modified files to carry prominent notices -stating that You changed the files; and - -(c) You must retain, in the Source form of any Derivative Works -that You distribute, all copyright, patent, trademark, and -attribution notices from the Source form of the Work, -excluding those notices that do not pertain to any part of -the Derivative Works; and - -(d) If the Work includes a "NOTICE" text file as part of its -distribution, then any Derivative Works that You distribute must -include a readable copy of the attribution notices contained -within such NOTICE file, excluding those notices that do not -pertain to any part of the Derivative Works, in at least one -of the following places: within a NOTICE text file distributed -as part of the Derivative Works; within the Source form or -documentation, if provided along with the Derivative Works; or, -within a display generated by the Derivative Works, if and -wherever such third-party notices normally appear. The contents -of the NOTICE file are for informational purposes only and -do not modify the License. You may add Your own attribution -notices within Derivative Works that You distribute, alongside -or as an addendum to the NOTICE text from the Work, provided -that such additional attribution notices cannot be construed -as modifying the License. - -You may add Your own copyright statement to Your modifications and -may provide additional or different license terms and conditions -for use, reproduction, or distribution of Your modifications, or -for any such Derivative Works as a whole, provided Your use, -reproduction, and distribution of the Work otherwise complies with -the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, -any Contribution intentionally submitted for inclusion in the Work -by You to the Licensor shall be under the terms and conditions of -this License, without any additional terms or conditions. -Notwithstanding the above, nothing herein shall supersede or modify -the terms of any separate license agreement you may have executed -with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade -names, trademarks, service marks, or product names of the Licensor, -except as required for reasonable and customary use in describing the -origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or -agreed to in writing, Licensor provides the Work (and each -Contributor provides its Contributions) on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -implied, including, without limitation, any warranties or conditions -of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A -PARTICULAR PURPOSE. You are solely responsible for determining the -appropriateness of using or redistributing the Work and assume any -risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, -whether in tort (including negligence), contract, or otherwise, -unless required by applicable law (such as deliberate and grossly -negligent acts) or agreed to in writing, shall any Contributor be -liable to You for damages, including any direct, indirect, special, -incidental, or consequential damages of any character arising as a -result of this License or out of the use or inability to use the -Work (including but not limited to damages for loss of goodwill, -work stoppage, computer failure or malfunction, or any and all -other commercial damages or losses), even if such Contributor -has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing -the Work or Derivative Works thereof, You may choose to offer, -and charge a fee for, acceptance of support, warranty, indemnity, -or other liability obligations and/or rights consistent with this -License. However, in accepting such obligations, You may act only -on Your own behalf and on Your sole responsibility, not on behalf -of any other Contributor, and only if You agree to indemnify, -defend, and hold each Contributor harmless for any liability -incurred by, or claims asserted against, such Contributor by reason -of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - -To apply the Apache License to your work, attach the following -boilerplate notice, with the fields enclosed by brackets "[]" -replaced with your own identifying information. (Don't include -the brackets!) The text should be enclosed in the appropriate -comment syntax for the file format. We also recommend that a -file or class name and description of purpose be included on the -same "printed page" as the copyright notice for easier -identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or -------------------------------------------------------------- + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. -tensorflow - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -## Some of TensorFlow's code is derived from Caffe, which is subject to the following copyright notice: - -COPYRIGHT - -All contributions by the University of California: - -Copyright (c) 2014, The Regents of the University of California (Regents) -All rights reserved. - -All other contributions: - -Copyright (c) 2014, the respective contributors -All rights reserved. - -Caffe uses a shared copyright model: each contributor holds copyright over -their contributions to Caffe. The project versioning records all such -contribution and copyright details. If a contributor wants to further mark -their specific copyright on a particular contribution, they should indicate -their copyright solely in the commit message of the change when it is -committed. - -LICENSE - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -CONTRIBUTION AGREEMENT - -By contributing to the BVLC/caffe repository through pull-request, comment, -or otherwise, the contributor releases their content to the -license and copyright terms herein. +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. ------------------------------------------------------------- -tensorflow-text - -Copyright 2018 The TensorFlow Authors. All rights reserved. - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2017, The TensorFlow Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +JSON for Modern C++ (https://github.com/nlohmann/json) + +MIT License + +Copyright (c) 2013-2022 Niels Lohmann + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From f2793634db0b16babc7861b697f4292d59bdb706 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Mon, 13 May 2024 14:34:30 +0400 Subject: [PATCH 23/37] add rpath --- src/python/CMakeLists.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 708ff4d2d8..ce87ed99ec 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -18,3 +18,20 @@ endif() pybind11_add_module(py_generate_pipeline py_generate_pipeline.cpp) target_link_libraries(py_generate_pipeline PRIVATE generate_pipeline_lib) install(TARGETS py_generate_pipeline LIBRARY DESTINATION . COMPONENT genai_python) + +# setting RPATH / LC_RPATH depending on platform +if(LINUX) + # to find libgenerate_pipeline_lib.so in the same folder + set(rpaths "$ORIGIN") +elseif(APPLE) + # to find libgenerate_pipeline_lib.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 + list(APPEND rpaths "@loader_path/../../openvino/libs") + endif() +endif() + +if(rpaths) + set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "${rpaths}") +endif() From 83d77c8dff6fb884c167055c7255cda40bafa262 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Mon, 13 May 2024 14:40:36 +0400 Subject: [PATCH 24/37] add rpath to libopenvino.so --- src/python/CMakeLists.txt | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index ce87ed99ec..f8a7a24597 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -21,17 +21,21 @@ install(TARGETS py_generate_pipeline LIBRARY DESTINATION . COMPONENT genai_pytho # setting RPATH / LC_RPATH depending on platform if(LINUX) - # to find libgenerate_pipeline_lib.so in the same folder - set(rpaths "$ORIGIN") + # to find libgenerate_pipeline_lib.so in the same folder + set(rpaths "$ORIGIN") + if(DEFINED SKBUILD) + # in case we build pip package, we need to refer to libopenvino.so from 'openvino' package + list(APPEND rpaths "@ORIGIN/../../openvino/libs") + endif() elseif(APPLE) - # to find libgenerate_pipeline_lib.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 - list(APPEND rpaths "@loader_path/../../openvino/libs") - endif() + # to find libgenerate_pipeline_lib.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 + list(APPEND rpaths "@loader_path/../../openvino/libs") + endif() endif() if(rpaths) - set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "${rpaths}") + set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "${rpaths}") endif() From 167f9244e76df906f87e0754a3ef30d6a3c67966 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Mon, 13 May 2024 14:43:26 +0400 Subject: [PATCH 25/37] py_generate_pipeline --- src/python/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index f8a7a24597..c430b165c8 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -37,5 +37,5 @@ elseif(APPLE) endif() if(rpaths) - set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "${rpaths}") + set_target_properties(py_generate_pipeline PROPERTIES INSTALL_RPATH "${rpaths}") endif() From 813d80abd08f9554f4cef0a48ab0891891ce7bf0 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Mon, 13 May 2024 16:42:12 +0400 Subject: [PATCH 26/37] install centos7 --- .github/workflows/genai_lib.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/genai_lib.yml b/.github/workflows/genai_lib.yml index 3127fe42b4..dbf966aa8d 100644 --- a/.github/workflows/genai_lib.yml +++ b/.github/workflows/genai_lib.yml @@ -10,11 +10,9 @@ jobs: - uses: actions/setup-python@v4 with: python-version: 3.8 - - name: Install OpenVINO - run: | - mkdir ./ov/ - curl https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2024.1.0-14645-e6dc0865128/l_openvino_toolkit_ubuntu20_2024.1.0.dev20240304_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz - sudo ./ov/install_dependencies/install_openvino_dependencies.sh + - run: mkdir ./ov/ + - run: curl https://storage.openvinotoolkit.org/repositories/openvino/packages/2024.1/linux/l_openvino_toolkit_centos7_2024.1.0.15008.f4afc983258_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz # Install centos instead of ubuntu to match PyPI distribution ABI + - run: sudo ./ov/install_dependencies/install_openvino_dependencies.sh - run: source ./ov/setupvars.sh && python -m pip install . - run: python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" From 6227b6576871e3a9c4d08deff93a674feaa51360 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Mon, 13 May 2024 16:52:09 +0400 Subject: [PATCH 27/37] install nightly --- .github/workflows/genai_lib.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/genai_lib.yml b/.github/workflows/genai_lib.yml index dbf966aa8d..1e6e5ccc2a 100644 --- a/.github/workflows/genai_lib.yml +++ b/.github/workflows/genai_lib.yml @@ -11,9 +11,9 @@ jobs: with: python-version: 3.8 - run: mkdir ./ov/ - - run: curl https://storage.openvinotoolkit.org/repositories/openvino/packages/2024.1/linux/l_openvino_toolkit_centos7_2024.1.0.15008.f4afc983258_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz # Install centos 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 centos instead of ubuntu to match PyPI distribution ABI - run: sudo ./ov/install_dependencies/install_openvino_dependencies.sh - - run: source ./ov/setupvars.sh && python -m pip install . + - 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: From 9b83a7e84b0d781cb7d3b815bd810a0de978f1e4 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Mon, 13 May 2024 19:05:24 +0400 Subject: [PATCH 28/37] propagate _GLIBCXX_USE_CXX11_ABI --- .github/workflows/genai_lib.yml | 2 +- src/cpp/CMakeLists.txt | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/genai_lib.yml b/.github/workflows/genai_lib.yml index 1e6e5ccc2a..2519871f11 100644 --- a/.github/workflows/genai_lib.yml +++ b/.github/workflows/genai_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.1.0-14758-22bd6ff0494/l_openvino_toolkit_centos7_2024.1.0.dev20240315_x86_64.tgz | tar --directory ./ov/ --strip-components 1 -xz # Install centos 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 && 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" diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 8bcaf8ab13..97acd8785d 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -30,6 +30,11 @@ function(ov_genai_build_jinja2cpp) set(JINJA2CPP_PIC ON CACHE BOOL "") add_subdirectory("${jinja2cpp_SOURCE_DIR}" "${jinja2cpp_BINARY_DIR}" EXCLUDE_FROM_ALL) + # openvino::runtime exports _GLIBCXX_USE_CXX11_ABI=0 on CenOS7. + # It needs to be propagated to every lib GenAI links with. It's + # enough to propagate it to fmt, because fmt propagates to + # jinja2cpp. + target_link_libraries(fmt PUBLIC openvino::runtime) endif() endfunction() From 2d157526cdf9967b9f856f60e46a04f4158f303c Mon Sep 17 00:00:00 2001 From: Wovchena Date: Mon, 13 May 2024 19:57:15 +0400 Subject: [PATCH 29/37] Populate python with the libraries to allow skipping wheel installation --- .github/workflows/genai_lib.yml | 10 +++++++++- src/cpp/CMakeLists.txt | 14 +++++++++++--- src/python/CMakeLists.txt | 12 ++++++++---- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/.github/workflows/genai_lib.yml b/.github/workflows/genai_lib.yml index 2519871f11..2e0a3c6bec 100644 --- a/.github/workflows/genai_lib.yml +++ b/.github/workflows/genai_lib.yml @@ -13,11 +13,17 @@ jobs: - 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: cmake --build ./build/ -j + - run: source ./ov/setupvars.sh && PYTHONPATH=./src/python:$PYTHONPATH python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" - 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: runs-on: windows-latest + defaults: + run: + shell: cmd steps: - uses: actions/checkout@v4 with: @@ -27,6 +33,8 @@ jobs: 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: cmake --build ./build/ -j + - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && set PYTHONPATH=./src/python:$PYTHONPATH && python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && python -m pip install . - shell: cmd - run: python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 97acd8785d..33f300fc51 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -31,10 +31,10 @@ function(ov_genai_build_jinja2cpp) add_subdirectory("${jinja2cpp_SOURCE_DIR}" "${jinja2cpp_BINARY_DIR}" EXCLUDE_FROM_ALL) # openvino::runtime exports _GLIBCXX_USE_CXX11_ABI=0 on CenOS7. - # It needs to be propagated to every lib GenAI links with. It's - # enough to propagate it to fmt, because fmt propagates to + # It needs to be propagated to every library GenAI links with. + # It's enough to propagate to fmt, because fmt propagates to # jinja2cpp. - target_link_libraries(fmt PUBLIC openvino::runtime) + target_compile_definitions(fmt PUBLIC $) endif() endfunction() @@ -57,4 +57,12 @@ target_link_libraries(${TARGET_NAME} PUBLIC openvino::runtime PRIVATE nlohmann_j target_compile_definitions(${TARGET_NAME} PRIVATE OPENVINO_TOKENIZERS_PATH=\"$\") target_compile_features(${TARGET_NAME} PUBLIC cxx_std_17) + install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION . COMPONENT genai RUNTIME DESTINATION . COMPONENT genai) + +# Populate python with the libraries to allow skipping wheel installation +add_custom_command(TARGET generate_pipeline_lib POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy + "$" + "${CMAKE_CURRENT_SOURCE_DIR}/../python/openvino/genai/$" + COMMENT "Copy generate_pipeline_lib to src/python/openvino/genai") diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 406cbe4ba1..da01b0e194 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -17,16 +17,13 @@ endif() pybind11_add_module(py_generate_pipeline py_generate_pipeline.cpp) target_link_libraries(py_generate_pipeline PRIVATE generate_pipeline_lib) + install(TARGETS py_generate_pipeline LIBRARY DESTINATION . COMPONENT genai_python) # setting RPATH / LC_RPATH depending on platform if(LINUX) # to find libgenerate_pipeline_lib.so in the same folder set(rpaths "$ORIGIN") - if(DEFINED SKBUILD) - # in case we build pip package, we need to refer to libopenvino.so from 'openvino' package - list(APPEND rpaths "@ORIGIN/../../openvino/libs") - endif() elseif(APPLE) # to find libgenerate_pipeline_lib.dylib in the same folder set(rpaths "@loader_path") @@ -39,3 +36,10 @@ endif() if(rpaths) set_target_properties(py_generate_pipeline PROPERTIES INSTALL_RPATH "${rpaths}") endif() + +# Populate python with the libraries to allow skipping wheel installation +add_custom_command(TARGET py_generate_pipeline POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy + "$" + "${CMAKE_CURRENT_SOURCE_DIR}/openvino/genai/$" + COMMENT "Copy py_generate_pipeline to src/python/openvino/genai") From 8025554bb925ca1db8eba2902978418acb33e6e2 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Mon, 13 May 2024 20:00:55 +0400 Subject: [PATCH 30/37] run setupvars --- .github/workflows/genai_lib.yml | 4 ++-- src/python/openvino/genai/__version__.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 src/python/openvino/genai/__version__.py diff --git a/.github/workflows/genai_lib.yml b/.github/workflows/genai_lib.yml index 2e0a3c6bec..53b852a061 100644 --- a/.github/workflows/genai_lib.yml +++ b/.github/workflows/genai_lib.yml @@ -14,7 +14,7 @@ jobs: - 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: cmake --build ./build/ -j + - run: source ./ov/setupvars.sh && cmake --build ./build/ -j - run: source ./ov/setupvars.sh && PYTHONPATH=./src/python:$PYTHONPATH python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" - 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" @@ -34,7 +34,7 @@ jobs: - 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: cmake --build ./build/ -j + - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && cmake --build ./build/ -j - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && set PYTHONPATH=./src/python:$PYTHONPATH && python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" - 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/src/python/openvino/genai/__version__.py b/src/python/openvino/genai/__version__.py new file mode 100644 index 0000000000..dd095d7149 --- /dev/null +++ b/src/python/openvino/genai/__version__.py @@ -0,0 +1,2 @@ +# this property will be overwritten by value from pyproject.toml +__version__ = "0.0.0.0" From 2b142865dfe19b83f1e2dc17b4d5ab62a3063960 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Mon, 13 May 2024 20:09:57 +0400 Subject: [PATCH 31/37] update .gitignore, install numpy --- .github/workflows/genai_lib.yml | 2 ++ .gitignore | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/genai_lib.yml b/.github/workflows/genai_lib.yml index 53b852a061..fe82d7d58a 100644 --- a/.github/workflows/genai_lib.yml +++ b/.github/workflows/genai_lib.yml @@ -15,6 +15,7 @@ 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/ -j + - run: python -m pip install numpy<1.27 - run: source ./ov/setupvars.sh && PYTHONPATH=./src/python:$PYTHONPATH python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" - 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" @@ -35,6 +36,7 @@ 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/ -j + - run: python -m pip install numpy<1.27 - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && set PYTHONPATH=./src/python:$PYTHONPATH && python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" - 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/.gitignore b/.gitignore index ae479f4faa..931487b5e9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +# 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/py_generate_pipeline* + # build/artifact dirs _* [Bb]uild*/ From 1c11bc73ae9734974d9c9f046450759feecc820f Mon Sep 17 00:00:00 2001 From: Wovchena Date: Mon, 13 May 2024 20:14:17 +0400 Subject: [PATCH 32/37] quotes --- .github/workflows/genai_lib.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/genai_lib.yml b/.github/workflows/genai_lib.yml index fe82d7d58a..288ca84d84 100644 --- a/.github/workflows/genai_lib.yml +++ b/.github/workflows/genai_lib.yml @@ -15,7 +15,7 @@ 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/ -j - - run: python -m pip install numpy<1.27 + - run: python -m pip install "numpy<1.27" - run: source ./ov/setupvars.sh && PYTHONPATH=./src/python:$PYTHONPATH python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" - 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" @@ -36,7 +36,7 @@ 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/ -j - - run: python -m pip install numpy<1.27 + - run: python -m pip install "numpy<1.27" - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && set PYTHONPATH=./src/python:$PYTHONPATH && python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" - 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" From e7fce82dd92e37f024d1497ec859af41f5f8a507 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Mon, 13 May 2024 22:07:50 +0400 Subject: [PATCH 33/37] fix PYTHONPATH --- .github/workflows/genai_lib.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/genai_lib.yml b/.github/workflows/genai_lib.yml index 288ca84d84..25e3b1bb36 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/ -j - - run: python -m pip install "numpy<1.27" - - run: source ./ov/setupvars.sh && PYTHONPATH=./src/python:$PYTHONPATH python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" - - run: source ./ov/setupvars.sh && python -m pip install --pre . --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly + - run: python -m pip install openvino # Can't load CenOS libraries from the archive + - run: source ./ov/setupvars.sh && 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: python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" genai_lib_windows: @@ -37,6 +37,6 @@ 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/ -j - run: python -m pip install "numpy<1.27" - - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && set PYTHONPATH=./src/python:$PYTHONPATH && python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" + - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && set PYTHONPATH=./src/python;$PYTHONPATH && python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" - 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" From 64608d1c6669a7e3ea0e96e52fc978954aea3606 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Tue, 14 May 2024 00:13:04 +0400 Subject: [PATCH 34/37] fix PYTHONPATH --- .github/workflows/genai_lib.yml | 4 ++-- pyproject.toml | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/genai_lib.yml b/.github/workflows/genai_lib.yml index 25e3b1bb36..14db153304 100644 --- a/.github/workflows/genai_lib.yml +++ b/.github/workflows/genai_lib.yml @@ -16,7 +16,7 @@ jobs: - run: source ./ov/setupvars.sh && cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ - run: source ./ov/setupvars.sh && cmake --build ./build/ -j - run: python -m pip install openvino # Can't load CenOS libraries from the archive - - run: source ./ov/setupvars.sh && PYTHONPATH=./src/python/ python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" + - 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: python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" @@ -37,6 +37,6 @@ 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/ -j - run: python -m pip install "numpy<1.27" - - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && set PYTHONPATH=./src/python;$PYTHONPATH && python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" + - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && set PYTHONPATH=./src/python;%PYTHONPATH% && python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" - 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/pyproject.toml b/pyproject.toml index 7e497ecb06..c0b38545e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,6 @@ sdist.cmake = true wheel.packages = ["src/python/openvino"] wheel.install-dir = "openvino/genai" wheel.build-tag = "000" -wheel.py-api = "" wheel.license-files = ["LICENSE", "SECURITY.md", "third-party-programs.txt"] [[tool.scikit-build.generate]] From 43b87c7342e4ec607ff7a828040dd82f5b6a6772 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Tue, 14 May 2024 00:41:49 +0400 Subject: [PATCH 35/37] quotes --- .github/workflows/genai_lib.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/genai_lib.yml b/.github/workflows/genai_lib.yml index 14db153304..d9434e958f 100644 --- a/.github/workflows/genai_lib.yml +++ b/.github/workflows/genai_lib.yml @@ -14,7 +14,7 @@ jobs: - 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/ -j + - run: source ./ov/setupvars.sh && cmake --build ./build/ --config Release -j - run: python -m pip install openvino # Can't load CenOS 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 @@ -35,8 +35,8 @@ jobs: - 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/ -j + - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && cmake --build ./build/ --config Release -j - run: python -m pip install "numpy<1.27" - - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && set PYTHONPATH=./src/python;%PYTHONPATH% && python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" + - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && set "PYTHONPATH=./src/python;%PYTHONPATH%" && python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" - 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" From fef967421dca97aea36b18112fe3a8105e287298 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Tue, 14 May 2024 11:38:12 +0400 Subject: [PATCH 36/37] reorder vars --- .github/workflows/genai_lib.yml | 2 +- src/cpp/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/genai_lib.yml b/.github/workflows/genai_lib.yml index d9434e958f..582c91603a 100644 --- a/.github/workflows/genai_lib.yml +++ b/.github/workflows/genai_lib.yml @@ -37,6 +37,6 @@ 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 -j - run: python -m pip install "numpy<1.27" - - run: call w_openvino_toolkit_windows_2024.1.0.dev20240304_x86_64\setupvars.bat && set "PYTHONPATH=./src/python;%PYTHONPATH%" && python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" + - 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/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 33f300fc51..7b27f28399 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -30,7 +30,7 @@ function(ov_genai_build_jinja2cpp) set(JINJA2CPP_PIC ON CACHE BOOL "") add_subdirectory("${jinja2cpp_SOURCE_DIR}" "${jinja2cpp_BINARY_DIR}" EXCLUDE_FROM_ALL) - # openvino::runtime exports _GLIBCXX_USE_CXX11_ABI=0 on CenOS7. + # openvino::runtime exports _GLIBCXX_USE_CXX11_ABI=0 on CentOS7. # It needs to be propagated to every library GenAI links with. # It's enough to propagate to fmt, because fmt propagates to # jinja2cpp. From b21286c348f496b8032c3bced56877d04ef5d211 Mon Sep 17 00:00:00 2001 From: Wovchena Date: Tue, 14 May 2024 12:44:59 +0400 Subject: [PATCH 37/37] openvino.genai- --- .github/workflows/genai_lib.yml | 8 +-- pyproject.toml | 6 +- src/cpp/CMakeLists.txt | 4 +- src/python/CMakeLists.txt | 6 +- src/python/openvino/__init__.py | 70 ------------------- .../genai => openvino_genai}/__init__.py | 0 .../genai => openvino_genai}/__version__.py | 0 7 files changed, 12 insertions(+), 82 deletions(-) delete mode 100644 src/python/openvino/__init__.py rename src/python/{openvino/genai => openvino_genai}/__init__.py (100%) rename src/python/{openvino/genai => openvino_genai}/__version__.py (100%) diff --git a/.github/workflows/genai_lib.yml b/.github/workflows/genai_lib.yml index 582c91603a..57e1d8d36f 100644 --- a/.github/workflows/genai_lib.yml +++ b/.github/workflows/genai_lib.yml @@ -16,9 +16,9 @@ jobs: - 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 CenOS libraries from the archive - - run: PYTHONPATH=./src/python/ python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" + - 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: python -c "from openvino.genai.py_generate_pipeline import LLMPipeline" + - run: python -c "from openvino_genai.py_generate_pipeline import LLMPipeline" genai_lib_windows: runs-on: windows-latest @@ -37,6 +37,6 @@ 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 -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: 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: python -c "from openvino_genai.py_generate_pipeline import LLMPipeline" diff --git a/pyproject.toml b/pyproject.toml index c0b38545e2..007dcb11f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,13 +25,13 @@ cmake.build-type = "Release" cmake.targets = ["py_generate_pipeline", "generate_pipeline_lib"] install.components = ["genai", "genai_python"] sdist.cmake = true -wheel.packages = ["src/python/openvino"] -wheel.install-dir = "openvino/genai" +wheel.packages = ["src/python/openvino_genai"] +wheel.install-dir = "openvino_genai" wheel.build-tag = "000" wheel.license-files = ["LICENSE", "SECURITY.md", "third-party-programs.txt"] [[tool.scikit-build.generate]] -path = "openvino/genai/__version__.py" +path = "openvino_genai/__version__.py" template = ''' __version__ = "${version}" ''' diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 7b27f28399..d706d32356 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -64,5 +64,5 @@ install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION . COMPONENT genai RUNTIME DES add_custom_command(TARGET generate_pipeline_lib POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy "$" - "${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 generate_pipeline_lib to src/python/openvino_genai") diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index da01b0e194..b73950e828 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -29,7 +29,7 @@ elseif(APPLE) set(rpaths "@loader_path") if(DEFINED SKBUILD) # in case we build pip package, we need to refer to libopenvino.dylib from 'openvino' package - list(APPEND rpaths "@loader_path/../../openvino/libs") + list(APPEND rpaths "@loader_path/../openvino/libs") endif() endif() @@ -41,5 +41,5 @@ endif() add_custom_command(TARGET py_generate_pipeline POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy "$" - "${CMAKE_CURRENT_SOURCE_DIR}/openvino/genai/$" - COMMENT "Copy py_generate_pipeline to src/python/openvino/genai") + "${CMAKE_CURRENT_SOURCE_DIR}/openvino_genai/$" + COMMENT "Copy py_generate_pipeline to src/python/openvino_genai/") diff --git a/src/python/openvino/__init__.py b/src/python/openvino/__init__.py deleted file mode 100644 index 24a0ee92ec..0000000000 --- a/src/python/openvino/__init__.py +++ /dev/null @@ -1,70 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2018-2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -__path__ = __import__("pkgutil").extend_path(__path__, __name__) - -# Required for Windows OS platforms -# Note: always top-level -try: - from openvino.utils import _add_openvino_libs_to_search_path - _add_openvino_libs_to_search_path() -except ImportError: - pass - -# # -# # OpenVINO API -# # This __init__.py forces checking of runtime modules to propagate errors. -# # It is not compared with init files from openvino-dev package. -# # -# Import all public modules -from openvino import runtime as runtime -from openvino import frontend as frontend -from openvino import helpers as helpers -from openvino import preprocess as preprocess -from openvino import utils as utils -from openvino import properties as properties - -# Import most important classes and functions from openvino.runtime -from openvino.runtime import Model -from openvino.runtime import Core -from openvino.runtime import CompiledModel -from openvino.runtime import InferRequest -from openvino.runtime import AsyncInferQueue - -from openvino.runtime import Symbol -from openvino.runtime import Dimension -from openvino.runtime import Strides -from openvino.runtime import PartialShape -from openvino.runtime import Shape -from openvino.runtime import Layout -from openvino.runtime import Type -from openvino.runtime import Tensor -from openvino.runtime import OVAny - -from openvino.runtime import compile_model -from openvino.runtime import get_batch -from openvino.runtime import set_batch -from openvino.runtime import serialize -from openvino.runtime import shutdown -from openvino.runtime import tensor_from_file -from openvino.runtime import save_model -from openvino.runtime import layout_helpers - -from openvino._pyopenvino import RemoteContext -from openvino._pyopenvino import RemoteTensor - -# libva related: -from openvino._pyopenvino import VAContext -from openvino._pyopenvino import VASurfaceTensor - -# Set version for openvino package -from openvino.runtime import get_version -__version__ = get_version() - -# Tools -try: - # Model Conversion API - ovc should reside in the main namespace - from openvino.tools.ovc import convert_model -except ImportError: - pass diff --git a/src/python/openvino/genai/__init__.py b/src/python/openvino_genai/__init__.py similarity index 100% rename from src/python/openvino/genai/__init__.py rename to src/python/openvino_genai/__init__.py diff --git a/src/python/openvino/genai/__version__.py b/src/python/openvino_genai/__version__.py similarity index 100% rename from src/python/openvino/genai/__version__.py rename to src/python/openvino_genai/__version__.py