update init

This commit is contained in:
jhqxxx
2025-09-25 12:44:17 +08:00
parent b28b6aa25d
commit ae36194a4b
6 changed files with 70 additions and 8 deletions
+5 -2
View File
@@ -31,8 +31,8 @@ pub struct Qwen2_5VLGenerateModel<'a> {
im_end_id: u32,
}
impl<'a> GenerateModel for Qwen2_5VLGenerateModel<'a> {
fn init(path: &str, device: Option<&Device>, dtype: Option<DType>) -> Result<Self> {
impl<'a> Qwen2_5VLGenerateModel<'a> {
pub fn init(path: &str, device: Option<&Device>, dtype: Option<DType>) -> Result<Self> {
let chat_template = ChatTemplate::init(path)?;
let tokenizer = TokenizerModel::init(path)?;
let config_path = path.to_string() + "/config.json";
@@ -57,6 +57,9 @@ impl<'a> GenerateModel for Qwen2_5VLGenerateModel<'a> {
im_end_id,
})
}
}
impl<'a> GenerateModel for Qwen2_5VLGenerateModel<'a> {
fn generate(&mut self, mes: ChatCompletionParameters) -> Result<ChatCompletionResponse> {
let mut logit_processor = get_logit_processor(mes.temperature, mes.top_p);