@@ -67,6 +67,20 @@ class LLMChatTemplateTest : public TestWithTempDir {
6767 }
6868
6969 void LoadTemplateProcessor () {
70+ servable = std::make_shared<ContinuousBatchingServable>();
71+ servable->getProperties ()->modelsPath = directoryPath;
72+ servable->getProperties ()->tokenizer = ov::genai::Tokenizer (directoryPath);
73+ std::cout << " Chat template to be used: \n "
74+ << servable->getProperties ()->tokenizer .get_original_chat_template () << std::endl;
75+ ExtraGenerationInfo extraGenInfo = GenAiServableInitializer::readExtraGenerationInfo (servable->getProperties (), directoryPath);
76+ GenAiServableInitializer::loadPyTemplateProcessor (servable->getProperties (), extraGenInfo);
77+ }
78+
79+ void SetUp () {
80+ TestWithTempDir::SetUp ();
81+ tokenizerConfigFilePath = directoryPath + " /tokenizer_config.json" ;
82+ jinjaConfigFilePath = directoryPath + " /chat_template.jinja" ;
83+
7084 // We need real model tokenizer and detokenizer as we rely on them to load chat template properly
7185 std::string realModelPath = getGenericFullPathForSrcTest (" /ovms/src/test/llm_testing/facebook/opt-125m" );
7286
@@ -85,23 +99,11 @@ class LLMChatTemplateTest : public TestWithTempDir {
8599 std::string srcDetokenizerBinPath = ovms::FileSystem::joinPath ({realModelPath, " openvino_detokenizer.bin" });
86100 std::string dstDetokenizerBinPath = ovms::FileSystem::joinPath ({directoryPath, " openvino_detokenizer.bin" });
87101 std::filesystem::copy_file (srcDetokenizerBinPath, dstDetokenizerBinPath, std::filesystem::copy_options::overwrite_existing);
88-
89- servable = std::make_shared<ContinuousBatchingServable>();
90- servable->getProperties ()->modelsPath = directoryPath;
91- servable->getProperties ()->tokenizer = ov::genai::Tokenizer (directoryPath);
92- std::cout << " Chat template to be used: \n "
93- << servable->getProperties ()->tokenizer .get_original_chat_template () << std::endl;
94- ExtraGenerationInfo extraGenInfo = GenAiServableInitializer::readExtraGenerationInfo (servable->getProperties (), directoryPath);
95- GenAiServableInitializer::loadPyTemplateProcessor (servable->getProperties (), extraGenInfo);
96- }
97-
98- void SetUp () {
99- TestWithTempDir::SetUp ();
100- tokenizerConfigFilePath = directoryPath + " /tokenizer_config.json" ;
101- jinjaConfigFilePath = directoryPath + " /chat_template.jinja" ;
102102 }
103103
104104 void TearDown () {
105+ servable.reset ();
106+ std::filesystem::remove_all (directoryPath);
105107 TestWithTempDir::TearDown ();
106108 }
107109
0 commit comments