File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff 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
234240Error 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);
You can’t perform that action at this time.
0 commit comments