Skip to content

Commit bbb8a13

Browse files
Llm runner msvc (pytorch#15250)
### Test plan existing ci for no regression. Working on MSVC CI
1 parent 8be08b9 commit bbb8a13

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();
@@ -233,8 +239,10 @@ Error TextLLMRunner::generate(
233239

234240
Error TextLLMRunner::warmup(const std::string& prompt, int32_t max_new_tokens) {
235241
// Create a GenerationConfig for warmup
236-
GenerationConfig config{
237-
.echo = false, .max_new_tokens = max_new_tokens, .warming = true};
242+
GenerationConfig config;
243+
config.echo = false;
244+
config.max_new_tokens = max_new_tokens;
245+
config.warming = true;
238246

239247
// Call generate with the warmup config
240248
Error err = generate(prompt, config);

0 commit comments

Comments
 (0)