update fmt

This commit is contained in:
jhqxxx
2026-02-14 16:34:12 +08:00
14 changed files with 1702 additions and 84 deletions
+10 -10
View File
@@ -1,17 +1,17 @@
// use std::io::Cursor;
use std::fs::File;
// use std::fs::File;
// use symphonia::core::io::MediaSourceStream;
use std::io::{Read, Seek};
use std::{io::Cursor, time::Instant};
// use std::io::{Read, Seek};
// use std::{io::Cursor, time::Instant};
use aha::utils::{load_tensor_from_pt, tensor_utils::interpolate_nearest_1d};
use aha_openai_dive::v1::resources::chat::ChatCompletionParameters;
use anyhow::{Result, anyhow};
use byteorder::{LittleEndian, ReadBytesExt};
use candle_core::{Shape, Tensor};
use sentencepiece::SentencePieceProcessor;
use zip::ZipArchive;
use aha::utils::load_tensor_from_pt;
// use aha_openai_dive::v1::resources::chat::ChatCompletionParameters;
use anyhow::Result;
// use byteorder::{LittleEndian, ReadBytesExt};
use candle_core::Shape;
// use sentencepiece::SentencePieceProcessor;
// use zip::ZipArchive;
#[test]
fn messy_test() -> Result<()> {
+76
View File
@@ -0,0 +1,76 @@
use aha::models::WhichModel;
// Import helper functions from api module - these will need to be made public
// or tested through integration testing
#[test]
fn test_model_type_classification() {
// Since get_model_type and get_model_id are private to api.rs,
// we document the expected behavior here for reference:
//
// LLM models: MiniCPM4_0_5B, Qwen2_5vl3B, Qwen2_5vl7B, Qwen3_0_6B,
// Qwen3vl2B, Qwen3vl4B, Qwen3vl8B, Qwen3vl32B
// OCR models: DeepSeekOCR, HunyuanOCR, PaddleOCRVL
// ASR models: Qwen3ASR0_6B, Qwen3ASR1_7B, GlmASRNano2512, FunASRNano2512
// Image models: RMBG2_0, VoxCPM, VoxCPM1_5
// This test documents the expected model type classification
let llm_models = vec![
WhichModel::MiniCPM4_0_5B,
WhichModel::Qwen2_5vl3B,
WhichModel::Qwen2_5vl7B,
WhichModel::Qwen3_0_6B,
WhichModel::Qwen3vl2B,
WhichModel::Qwen3vl4B,
WhichModel::Qwen3vl8B,
WhichModel::Qwen3vl32B,
];
let ocr_models = vec![
WhichModel::DeepSeekOCR,
WhichModel::HunyuanOCR,
WhichModel::PaddleOCRVL,
];
let asr_models = vec![
WhichModel::Qwen3ASR0_6B,
WhichModel::Qwen3ASR1_7B,
WhichModel::GlmASRNano2512,
WhichModel::FunASRNano2512,
];
let image_models = vec![
WhichModel::RMBG2_0,
WhichModel::VoxCPM,
WhichModel::VoxCPM1_5,
];
// Verify counts
assert_eq!(llm_models.len(), 8);
assert_eq!(ocr_models.len(), 3);
assert_eq!(asr_models.len(), 4);
assert_eq!(image_models.len(), 3);
// Total models
assert_eq!(
llm_models.len() + ocr_models.len() + asr_models.len() + image_models.len(),
18
);
}
// Note: Integration tests for the /health and /models endpoints
// should be done with a running server. These would typically:
//
// 1. Start the server with a test model
// 2. Make HTTP requests to /health and /models
// 3. Verify the response format and status codes
//
// Example (pseudo-code):
//
// #[tokio::test]
// async fn test_health_endpoint() {
// let resp = reqwest::get("http://localhost:10100/health").await.unwrap();
// assert_eq!(resp.status(), 200);
// let json: serde_json::Value = resp.json().await.unwrap();
// assert_eq!(json["status"], "ok");
// }
+3 -7
View File
@@ -1,12 +1,8 @@
use std::collections::HashMap;
use aha::utils::{find_type_files, get_device, read_pth_tensor_info_cycle};
use aha::utils::{find_type_files, get_device};
use anyhow::Result;
use candle_core::{
Device,
pickle::{read_all_with_key, read_pth_tensor_info},
safetensors,
};
use candle_core::{Device, pickle::read_all_with_key, safetensors};
use candle_nn::VarBuilder;
#[test]
@@ -207,7 +203,7 @@ fn index_tts2_weight() -> Result<()> {
// RUST_BACKTRACE=1 cargo test -F cuda index_tts2_weight -r -- --nocapture
let save_dir: String =
aha::utils::get_default_save_dir().ok_or(anyhow::anyhow!("Failed to get save dir"))?;
let model_path = format!("{}/IndexTeam/IndexTTS-2/", save_dir);
// let model_path = format!("{}/IndexTeam/IndexTTS-2/", save_dir);
let bigvgan_path = format!(
"{}/nv-community/bigvgan_v2_22khz_80band_256x/bigvgan_generator.pt",
save_dir