diff --git a/extension/llm/runner/text_llm_runner.cpp b/extension/llm/runner/text_llm_runner.cpp index 738951ebb95..626c888f3a2 100644 --- a/extension/llm/runner/text_llm_runner.cpp +++ b/extension/llm/runner/text_llm_runner.cpp @@ -116,8 +116,14 @@ Error TextLLMRunner::generate( /*bos=*/config.num_bos, /*eos=*/config.num_eos); - ET_CHECK_TK_OK_OR_RETURN_ERROR( - encode_res.error(), "Failed to encode prompt %s", prompt.c_str()); + if (!encode_res.ok()) { + ET_LOG( + Error, + "Failed to encode prompt %s. Tokenizers error code %d", + prompt.c_str(), + static_cast(encode_res.error())); + return Error::InvalidArgument; + } // encode the (string) prompt into tokens sequence std::vector prompt_tokens = encode_res.get(); @@ -232,8 +238,10 @@ Error TextLLMRunner::generate( Error TextLLMRunner::warmup(const std::string& prompt, int32_t max_new_tokens) { // Create a GenerationConfig for warmup - GenerationConfig config{ - .echo = false, .max_new_tokens = max_new_tokens, .warming = true}; + GenerationConfig config; + config.echo = false; + config.max_new_tokens = max_new_tokens; + config.warming = true; // Call generate with the warmup config Error err = generate(prompt, config);