Files
aha/tests/config_tests.rs
T

142 lines
5.5 KiB
Rust
Raw Normal View History

2025-10-15 21:03:49 +08:00
use aha::models::{
2026-05-11 16:27:17 +08:00
deepseek_ocr::config::DeepseekOCRConfig,
hunyuan_ocr::config::HunYuanVLConfig,
lfm2::config::Lfm2Config,
lfm2vl::config::{Lfm2ProcessorConfig, Lfm2VLConfig},
minicpm4::config::MiniCPM4Config,
moss_audio_tokenizer_nano::config::MossAudioTokenizerConfig,
moss_tts_nano::config::MossTTSConfig,
paddleocr_vl::config::PaddleOCRVLConfig,
qwen2_5vl::config::Qwen2_5VLConfig,
qwen3vl::config::Qwen3VLConfig,
voxcpm::config::VoxCPMConfig,
2025-10-15 21:03:49 +08:00
};
2025-09-22 23:58:08 +08:00
use anyhow::Result;
2025-09-22 16:38:12 +08:00
#[test]
2025-09-25 12:09:25 +08:00
fn qwen2_5_vl_config() -> Result<()> {
2025-11-22 23:27:14 +08:00
// cargo test -F cuda,flash-attn qwen2_5vl_config -r -- --nocapture
2025-09-22 16:38:12 +08:00
let model_path = "/home/jhq/huggingface_model/Qwen/Qwen2.5-VL-3B-Instruct/";
let config_path = model_path.to_string() + "/config.json";
2025-09-25 12:09:25 +08:00
let config: Qwen2_5VLConfig = serde_json::from_slice(&std::fs::read(config_path)?)?;
2025-09-22 16:38:12 +08:00
println!("{:?}", config);
Ok(())
2025-09-22 23:58:08 +08:00
}
2025-09-25 12:09:25 +08:00
#[test]
fn minicpm4_config() -> Result<()> {
2025-11-22 23:27:14 +08:00
// cargo test -F cuda,flash-attn minicpm4_config -r -- --nocapture
2025-09-25 12:09:25 +08:00
let model_path = "/home/jhq/huggingface_model/OpenBMB/MiniCPM4-0.5B/";
let config_path = model_path.to_string() + "/config.json";
let config: MiniCPM4Config = serde_json::from_slice(&std::fs::read(config_path)?)?;
println!("{:?}", config);
Ok(())
2025-10-03 22:25:58 +08:00
}
#[test]
fn voxcpm_config() -> Result<()> {
2025-12-11 18:33:35 +08:00
// cargo test -F cuda,flash-attn voxcpm_config -r -- --nocapture
// cargo test -F cuda voxcpm_config -r -- --nocapture
2025-10-03 22:25:58 +08:00
let model_path = "/home/jhq/huggingface_model/openbmb/VoxCPM-0.5B/";
let config_path = model_path.to_string() + "/config.json";
let config: VoxCPMConfig = serde_json::from_slice(&std::fs::read(config_path)?)?;
println!("{:?}", config);
Ok(())
2025-10-15 21:03:49 +08:00
}
2025-10-26 21:39:23 +08:00
2025-12-11 18:33:35 +08:00
#[test]
fn voxcpm1_5_config() -> Result<()> {
// cargo test -F cuda voxcpm1_5_config -r -- --nocapture
let model_path = "/home/jhq/huggingface_model/OpenBMB/VoxCPM1.5/";
let config_path = model_path.to_string() + "/config.json";
let config: VoxCPMConfig = serde_json::from_slice(&std::fs::read(config_path)?)?;
println!("{:?}", config);
Ok(())
}
2025-10-26 21:39:23 +08:00
#[test]
fn qwen3vl_config() -> Result<()> {
2025-11-22 23:27:14 +08:00
// cargo test -F cuda qwen3vl_config -r -- --nocapture
2025-10-26 21:39:23 +08:00
let model_path = "/home/jhq/huggingface_model/Qwen/Qwen3-VL-4B-Instruct/";
let config_path = model_path.to_string() + "/config.json";
let config: Qwen3VLConfig = serde_json::from_slice(&std::fs::read(config_path)?)?;
println!("{:?}", config);
Ok(())
}
2025-11-22 23:27:14 +08:00
#[test]
fn deepseek_ocr_config() -> Result<()> {
2025-12-03 17:21:01 +08:00
// cargo test -F cuda deepseek_ocr_config -r -- --nocapture
2025-11-22 23:27:14 +08:00
let model_path = "/home/jhq/huggingface_model/deepseek-ai/DeepSeek-OCR/";
let config_path = model_path.to_string() + "/config.json";
let config: DeepseekOCRConfig = serde_json::from_slice(&std::fs::read(config_path)?)?;
println!("{:?}", config);
Ok(())
}
2025-12-03 17:21:01 +08:00
#[test]
fn hunyuan_ocr_config() -> Result<()> {
// cargo test -F cuda hunyuan_ocr_config -r -- --nocapture
let model_path = "/home/jhq/huggingface_model/Tencent-Hunyuan/HunyuanOCR/";
let config_path = model_path.to_string() + "/config.json";
let config: HunYuanVLConfig = serde_json::from_slice(&std::fs::read(config_path)?)?;
println!("{:?}", config);
Ok(())
}
2025-12-09 00:41:30 +08:00
#[test]
fn paddleocr_vl_config() -> Result<()> {
// cargo test -F cuda paddleocr_vl_config -r -- --nocapture
let model_path = "/home/jhq/huggingface_model/PaddlePaddle/PaddleOCR-VL/";
let config_path = model_path.to_string() + "/config.json";
let config: PaddleOCRVLConfig = serde_json::from_slice(&std::fs::read(config_path)?)?;
println!("{:?}", config);
Ok(())
}
2026-03-23 22:07:41 +08:00
#[test]
fn lfm2_config() -> Result<()> {
// cargo test -F cuda --test config_tests lfm2_config -r -- --nocapture
let model_path = "/home/jhq/.aha/LiquidAI/LFM2-1.2B/";
// let model_path = "/home/jhq/.aha/LiquidAI/LFM2.5-1.2B-Instruct/";
let config_path = model_path.to_string() + "/config.json";
let mut config: Lfm2Config = serde_json::from_slice(&std::fs::read(config_path)?)?;
println!("{:?}", config);
config.full_attn_idx2layer_type();
println!("{:?}", config);
Ok(())
}
2026-03-27 11:16:31 +08:00
#[test]
fn lfm2vl_config() -> Result<()> {
// cargo test -F cuda --test config_tests lfm2vl_config -r -- --nocapture
let model_path = "/home/jhq/.aha/LiquidAI/LFM2.5-VL-1.6B/";
let config_path = model_path.to_string() + "/config.json";
let config: Lfm2VLConfig = serde_json::from_slice(&std::fs::read(config_path)?)?;
println!("{:?}", config);
let processor_config_path = model_path.to_string() + "/processor_config.json";
2026-03-30 00:44:41 +08:00
let processor_config: Lfm2ProcessorConfig =
serde_json::from_slice(&std::fs::read(processor_config_path)?)?;
2026-03-27 11:16:31 +08:00
println!("{:?}", processor_config);
Ok(())
2026-03-30 00:44:41 +08:00
}
2026-05-09 12:18:16 +08:00
#[test]
fn moss_audio_tokenizer_config() -> Result<()> {
// cargo test -F cuda --test config_tests moss_audio_tokenizer_config -r -- --nocapture
let model_path = "/home/jhq/.aha/openmoss/MOSS-Audio-Tokenizer-Nano/";
let config_path = model_path.to_string() + "/config.json";
let config: MossAudioTokenizerConfig = serde_json::from_slice(&std::fs::read(config_path)?)?;
println!("{:?}", config);
Ok(())
}
#[test]
fn moss_tts_config() -> Result<()> {
// cargo test -F cuda --test config_tests moss_tts_config -r -- --nocapture
let model_path = "/home/jhq/.aha/openmoss/MOSS-TTS-Nano/";
let config_path = model_path.to_string() + "/config.json";
let config: MossTTSConfig = serde_json::from_slice(&std::fs::read(config_path)?)?;
println!("{:?}", config);
Ok(())
2026-05-11 16:15:09 +08:00
}