Skip to content

Commit

Permalink
remove group_beam_searcher.hpp; copy fast_tokenizer
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-esir committed May 22, 2024
1 parent 82a9449 commit 75b7c37
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 18 deletions.
9 changes: 7 additions & 2 deletions src/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ add_library(${TARGET_NAME} SHARED ${SOURCE_FILES})
add_library(openvino::${TARGET_NAME} ALIAS ${TARGET_NAME})

target_include_directories(${TARGET_NAME}
# TODO: remove it, because beam_search algo should not be exposed to end users
PRIVATE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../text_generation/causal_lm/cpp/>"
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" "$<INSTALL_INTERFACE:runtime/include>")

target_link_libraries(${TARGET_NAME} PUBLIC openvino::runtime PRIVATE nlohmann_json::nlohmann_json jinja2cpp)
Expand All @@ -66,6 +64,13 @@ add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
"${CMAKE_CURRENT_SOURCE_DIR}/../python/openvino_genai/$<TARGET_FILE_NAME:${TARGET_NAME}>"
COMMENT "Copy ${TARGET_NAME} to src/python/openvino_genai")

# Copy libcore_tokenizers.so to build_dir/openvino_tokenizers/src/
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy
"${CMAKE_BINARY_DIR}/_deps/fast_tokenizer-src/lib/libcore_tokenizers.so"
"${CMAKE_BINARY_DIR}/openvino_tokenizers/src/"
COMMENT "Copy libcore_tokenizers.so to build_dir/openvino_tokenizers/src/")

install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION . COMPONENT core_genai RUNTIME DESTINATION . COMPONENT core_genai)

# - Windows: `<openvino_dir>\runtime\bin\intel64\Release\`
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/src/group_beam_searcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// SPDX-License-Identifier: Apache-2.0

#include <openvino/runtime/tensor.hpp>
#include "group_beam_searcher.hpp"
#include "generation_config_helper.hpp"
#include "openvino/genai/llm_pipeline.hpp"
#include "utils.hpp"

namespace {
Expand Down
12 changes: 0 additions & 12 deletions src/cpp/src/group_beam_searcher.hpp

This file was deleted.

3 changes: 2 additions & 1 deletion src/cpp/src/llm_pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "openvino/genai/llm_pipeline.hpp"
#include "utils.hpp"
#include "generation_config_helper.hpp"
#include "group_beam_searcher.hpp"
#include "text_callback_streamer.hpp"


Expand All @@ -29,6 +28,8 @@ ov::EncodedResults greedy_decoding(
bool is_chat_conversation = false
);

EncodedResults beam_search(ov::InferRequest& lm, ov::Tensor prompts, ov::Tensor attentin_mask, GenerationConfig config);


class LLMPipeline::LLMPipelineImpl {
public:
Expand Down
4 changes: 2 additions & 2 deletions tests/python_tests/test_generate_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ def run_hf_ov_genai_comparison(model_fixture, generation_config, prompt):
hf_output = tokenizer.decode(hf_encoded_output[0, encoded_prompt.shape[1]:])

device = 'CPU'
ov_tokenziers_path = '../../build/openvino_tokenizers/src/'
ov_tokenizers_path = '../../build/openvino_tokenizers/src/'
import openvino_genai as ov_genai

pipe = ov_genai.LLMPipeline(path, device, {}, ov_tokenziers_path)
pipe = ov_genai.LLMPipeline(path, device, {}, ov_tokenizers_path)
ov_output = pipe.generate(prompt, **generation_config)

if hf_output != ov_output:
Expand Down

0 comments on commit 75b7c37

Please sign in to comment.