fix error

This commit is contained in:
wxg
2025-09-25 12:25:24 +08:00
parent 4fdab3e7cd
commit b28b6aa25d
2 changed files with 8 additions and 6 deletions
+3 -3
View File
@@ -18,15 +18,15 @@ impl ModelType {
model_path: &str, model_path: &str,
device: Option<&Device>, device: Option<&Device>,
dtype: Option<DType>, dtype: Option<DType>,
) -> Result<Box<impl GenerateModel>> { ) -> Result<Box<dyn GenerateModel>> {
match model_type { match model_type {
ModelType::Qwen2_5VL => { ModelType::Qwen2_5VL => {
let model = Qwen2_5VLGenerateModel::init(model_path, device, dtype)?; let model = Qwen2_5VLGenerateModel::init(model_path, device, dtype)?;
Ok(Box::new(model)) Ok(Box::new(model) as Box<dyn GenerateModel>)
}, },
ModelType::MiniCPM4 => { ModelType::MiniCPM4 => {
let model = MiniCPMGenerateModel::init(model_path, device, dtype)?; let model = MiniCPMGenerateModel::init(model_path, device, dtype)?;
Ok(Box::new(model)) Ok(Box::new(model)as Box<dyn GenerateModel>)
} }
} }
} }
+5 -3
View File
@@ -1,6 +1,6 @@
pub mod qwen2_5vl;
pub mod minicpm4;
pub mod base_modules; pub mod base_modules;
pub mod minicpm4;
pub mod qwen2_5vl;
use anyhow::Result; use anyhow::Result;
use candle_core::{DType, Device}; use candle_core::{DType, Device};
@@ -17,5 +17,7 @@ pub trait GenerateModel {
fn generate_stream( fn generate_stream(
&mut self, &mut self,
mes: ChatCompletionParameters, mes: ChatCompletionParameters,
) -> Result<impl Stream<Item = Result<ChatCompletionChunkResponse, anyhow::Error>>>; ) -> Result<impl Stream<Item = Result<ChatCompletionChunkResponse, anyhow::Error>>>
where
Self: Sized;
} }