Skip to content

Commit ec0ad2d

Browse files
committed
text_llm_runner msvc
1 parent 98baab7 commit ec0ad2d

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

extension/llm/runner/text_llm_runner.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,14 @@ Error TextLLMRunner::generate(
116116
/*bos=*/config.num_bos,
117117
/*eos=*/config.num_eos);
118118

119-
ET_CHECK_TK_OK_OR_RETURN_ERROR(
120-
encode_res.error(), "Failed to encode prompt %s", prompt.c_str());
119+
if (!encode_res.ok()) {
120+
ET_LOG(
121+
Error,
122+
"Failed to encode prompt %s. Tokenizers error code %d",
123+
prompt.c_str(),
124+
static_cast<uint32_t>(encode_res.error()));
125+
return Error::InvalidArgument;
126+
}
121127

122128
// encode the (string) prompt into tokens sequence
123129
std::vector<uint64_t> prompt_tokens = encode_res.get();
@@ -230,8 +236,10 @@ Error TextLLMRunner::generate(
230236

231237
Error TextLLMRunner::warmup(const std::string& prompt, int32_t max_new_tokens) {
232238
// Create a GenerationConfig for warmup
233-
GenerationConfig config{
234-
.echo = false, .max_new_tokens = max_new_tokens, .warming = true};
239+
GenerationConfig config;
240+
config.echo = false;
241+
config.max_new_tokens = max_new_tokens;
242+
config.warming = true;
235243

236244
// Call generate with the warmup config
237245
Error err = generate(prompt, config);

0 commit comments

Comments
 (0)