| Crates.io | aha |
| lib.rs | aha |
| version | 0.1.8 |
| created_at | 2025-09-21 02:21:00.332957+00 |
| updated_at | 2026-01-17 04:22:49.601076+00 |
| description | aha model inference library, now supports Qwen2.5VL, MiniCPM4, VoxCPM, Qwen3VL, DeepSeek-OCR, Hunyuan-OCR, PaddleOCR-VL, VoxCPM1.5, RMBG2.0, GLM-ASR-Nano-2512, Fun-ASR-Nano-2512, Qwen3 |
| homepage | |
| repository | https://github.com/jhqxxx/aha |
| max_upload_size | |
| id | 1848357 |
| size | 4,352,762 |
一个基于 Candle 框架的 Rust 模型推理库,提供高效、易用的多模态模型推理能力。
我们持续扩展支持的模型列表,欢迎贡献!
⭐ 如果这个项目对你有帮助,请给我们一个 Star!
sudo apt-get update
sudo apt-get install -y clang pkg-config ffmpeg libavutil-dev libavcodec-dev libavformat-dev libavfilter-dev libavdevice-dev libswresample-dev libswscale-dev
项目提供了几个可选的功能特性,您可以根据需要启用它们:
cargo build -r --features flash-attn
cargo build -r --features cuda
cargo build -r --features ffmpeg
# 同时启用 CUDA 和 Flash Attention 以获得最佳性能
cargo build -r --features "cuda,flash-attn"
# 启用所有功能特性
cargo build -r --features "cuda,flash-attn,ffmpeg"
git clone https://github.com/jhqxxx/aha.git
cd aha
cargo run -F cuda -r -- [参数]
-p, --port <PORT>
-m, --model <MODEL>
--weight-path <WEIGHT_PATH>
--save-dir <SAVE_DIR>
--download-retries <DOWNLOAD_RETRIES>
项目提供基于 OpenAI API 兼容的 RESTful 接口,支持多种模型推理任务。
POST /chat/completionsPOST /images/remove_backgroundPOST /audio/speech[dependencies]
aha = { git = "https://github.com/jhqxxx/aha.git" }
# 启用 CUDA 支持(可选)
aha = { git = "https://github.com/jhqxxx/aha.git", features = ["cuda"] }
# 启用Flash Attention 支持(可选)
aha = { git = "https://github.com/jhqxxx/aha.git", features = ["cuda", "flash-attn"] }
use aha::models::voxcpm::generate::VoxCPMGenerate;
use aha::utils::audio_utils::save_wav;
use anyhow::Result;
fn main() -> Result<()> {
let model_path = "xxx/openbmb/VoxCPM-0.5B/";
let mut voxcpm_generate = VoxCPMGenerate::init(model_path, None, None)?;
let generate = voxcpm_generate.generate(
"太阳当空照,花儿对我笑,小鸟说早早早".to_string(),
None,
None,
2,
100,
10,
2.0,
false,
6.0,
)?;
let _ = save_wav(&generate, "voxcpm.wav")?;
Ok(())
}
git clone https://github.com/jhqxxx/aha.git
cd aha
# 修改测试用例中模型路径
# 运行 PaddleOCR-Vl 示例
cargo test -F cuda paddleocr_vl_generate -r -- --nocapture
# 运行 Hunyuan-OCR 示例
cargo test -F cuda hunyuan_ocr_generate -r -- --nocapture
# 运行 DeepSeek-OCR 示例
cargo test -F cuda deepseek_ocr_generate -r -- --nocapture
# 运行 Qwen3VL 示例
cargo test -F cuda qwen3vl_generate -r -- --nocapture
# 运行 MiniCPM4 示例
cargo test -F cuda minicpm_generate -r -- --nocapture
# 运行 VoxCPM 示例
cargo test -F cuda voxcpm_generate -r -- --nocapture
.
├── Cargo.toml
├── README.md
├── src
│ ├── chat_template
│ ├── models
│ │ ├── common
│ │ ├── deepseek_ocr
│ │ ├── hunyuan_ocr
│ │ ├── minicpm4
│ │ ├── paddleocr_vl
│ │ ├── qwen2_5vl
│ │ ├── qwen3vl
│ │ ├── voxcpm
│ │ └── mod.rs
│ ├── position_embed
│ ├── tokenizer
│ ├── utils
│ ├── api.rs
│ └── lib.rs
└── tests
├── test_hunyuan_ocr.rs
├── test_deepseek_ocr.rs
├── test_minicpm4.rs
├── test_paddleocr_vl.rs
├── test_qwen2_5vl.rs
└── test_voxcpm.rs
本项目采用 Apache License, Version 2.0 许可证 - 查看 LICENSE 文件了解详情。
初始版本发布
支持 Qwen2.5VL, MiniCPM4, VoxCPM 模型