add hunyuan_ocr

This commit is contained in:
jhqxxx
2025-12-03 17:21:01 +08:00
parent 7d72cb3baf
commit 697484cf23
29 changed files with 1756 additions and 190 deletions
+4 -2
View File
@@ -33,6 +33,7 @@ pub struct Qwen3VLGenerateModel<'a> {
eos_token_id1: u32,
eos_token_id2: u32,
generation_config: Qwen3VLGenerationConfig,
model_name: String,
}
impl<'a> Qwen3VLGenerateModel<'a> {
@@ -60,6 +61,7 @@ impl<'a> Qwen3VLGenerateModel<'a> {
eos_token_id1: generation_config.eos_token_id[0] as u32,
eos_token_id2: generation_config.eos_token_id[1] as u32,
generation_config,
model_name: "qwen3vl".to_string(),
})
}
}
@@ -120,7 +122,7 @@ impl<'a> GenerateModel for Qwen3VLGenerateModel<'a> {
}
let res = self.tokenizer.token_decode(generate)?;
self.qwen3_vl.clear_kv_cache();
let response = build_completion_response(res, "qwen3vl");
let response = build_completion_response(res, &self.model_name);
Ok(response)
}
@@ -201,7 +203,7 @@ impl<'a> GenerateModel for Qwen3VLGenerateModel<'a> {
continue;
}
error_tokens.clear();
let chunk = build_completion_chunk_response(decoded_token, "qwen3vl", None, None);
let chunk = build_completion_chunk_response(decoded_token, &self.model_name, None, None);
yield Ok(chunk);
if next_token == self.eos_token_id1 || next_token == self.eos_token_id2 {
break;