update format
This commit is contained in:
+7
-3
@@ -1,7 +1,9 @@
|
||||
pub mod qwen2_5vl;
|
||||
use anyhow::Result;
|
||||
use candle_core::{DType, Device};
|
||||
use openai_dive::v1::resources::chat::{ChatCompletionChunkResponse, ChatCompletionParameters, ChatCompletionResponse};
|
||||
use openai_dive::v1::resources::chat::{
|
||||
ChatCompletionChunkResponse, ChatCompletionParameters, ChatCompletionResponse,
|
||||
};
|
||||
use rocket::futures::Stream;
|
||||
|
||||
pub trait GenerateModel {
|
||||
@@ -9,6 +11,8 @@ pub trait GenerateModel {
|
||||
where
|
||||
Self: Sized;
|
||||
fn generate(&mut self, mes: ChatCompletionParameters) -> Result<ChatCompletionResponse>;
|
||||
fn generate_stream(&mut self, mes: ChatCompletionParameters) -> Result<impl Stream<Item = Result<ChatCompletionChunkResponse, anyhow::Error>>>;
|
||||
fn generate_stream(
|
||||
&mut self,
|
||||
mes: ChatCompletionParameters,
|
||||
) -> Result<impl Stream<Item = Result<ChatCompletionChunkResponse, anyhow::Error>>>;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
pub mod config;
|
||||
pub mod generate;
|
||||
pub mod model;
|
||||
pub mod processor;
|
||||
pub mod generate;
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
pub mod img_utils;
|
||||
pub mod tensor_utils;
|
||||
pub mod utils;
|
||||
pub mod img_utils;
|
||||
pub mod video_utils;
|
||||
+3
-1
@@ -3,7 +3,9 @@ use candle_core::{DType, Device};
|
||||
use candle_transformers::generation::LogitsProcessor;
|
||||
use openai_dive::v1::resources::{
|
||||
chat::{
|
||||
ChatCompletionChoice, ChatCompletionChunkChoice, ChatCompletionChunkResponse, ChatCompletionResponse, ChatMessage, ChatMessageContent, DeltaChatMessage, DeltaFunction, DeltaToolCall, Function, ToolCall
|
||||
ChatCompletionChoice, ChatCompletionChunkChoice, ChatCompletionChunkResponse,
|
||||
ChatCompletionResponse, ChatMessage, ChatMessageContent, DeltaChatMessage, DeltaFunction,
|
||||
DeltaToolCall, Function, ToolCall,
|
||||
},
|
||||
shared::FinishReason,
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use anyhow::Result;
|
||||
use aha::models::qwen2_5vl::config::Config;
|
||||
use anyhow::Result;
|
||||
|
||||
#[test]
|
||||
fn qwen2_5vl_config() -> Result<()> {
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
use std::{pin::pin, time::Instant};
|
||||
|
||||
use aha::{models::{qwen2_5vl::generate::Qwen2_5VLGenerateModel, GenerateModel}, ModelType};
|
||||
use anyhow::{Result};
|
||||
use aha::{
|
||||
ModelType,
|
||||
models::{GenerateModel, qwen2_5vl::generate::Qwen2_5VLGenerateModel},
|
||||
};
|
||||
use anyhow::Result;
|
||||
use candle_core::{DType, Device};
|
||||
use openai_dive::v1::resources::chat::ChatCompletionParameters;
|
||||
use rocket::futures::StreamExt;
|
||||
|
||||
|
||||
#[test]
|
||||
fn qwen2_5vl_generate() -> Result<()> {
|
||||
// test with cpu :(太慢了, : RUST_BACKTRACE=1 cargo test qwen2_5vl_generate -- --nocapture
|
||||
@@ -53,7 +55,6 @@ fn qwen2_5vl_generate() -> Result<()> {
|
||||
let i_duration = i_start.elapsed();
|
||||
println!("Time elapsed in generate is: {:?}", i_duration);
|
||||
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user