add PaddleOCR-VL-1.6

This commit is contained in:
jhqxxx
2026-06-06 18:41:29 +08:00
parent cb2fe57359
commit a2d0f64c5b
11 changed files with 74 additions and 12 deletions
+4 -3
View File
@@ -35,7 +35,7 @@ aha is a high-performance, cross-platform AI inference engine built with Rust an
|----------|--------|
| **Text** | Qwen3, MiniCPM4, MiniCPM5, LFM2, LFM2.5 |
| **Vision** | Qwen2.5-VL, Qwen3-VL, Qwen3.5, <br> LFM2.5-VL, LFM2-VL |
| **OCR** | DeepSeek-OCR, DeepSeek-OCR-2 , PaddleOCR-VL <br> PaddleOCR-VL1.5, Hunyuan-OCR, GLM-OCR |
| **OCR** | DeepSeek-OCR, DeepSeek-OCR-2 , PaddleOCR-VL <br> PaddleOCR-VL1.5, PaddleOCR-VL1.5, Hunyuan-OCR <br> GLM-OCR |
| **ASR** | GLM-ASR-Nano, Fun-ASR-Nano, Qwen3-ASR |
| **TTS** | VoxCPM, VoxCPM1.5, VoxCPM2, Moss-TTS-Nano |
| **Image** | RMBG-2.0 (background removal) |
@@ -43,6 +43,9 @@ aha is a high-performance, cross-platform AI inference engine built with Rust an
| **Reranker** | Qwen3-Reranker |
## Changelog
### 2026-06-06
- add PaddleOCR-VL-1.6
### 2026-05-29
- generate code refactored
@@ -58,8 +61,6 @@ aha is a high-performance, cross-platform AI inference engine built with Rust an
### 2026-05-11
- add Moss-TTS-Nanoits performance is worse than the original Python version
### 2026-05-09
- merge pr/eastgold15/46, add aha-ui
**[View full changelog](docs/changelog.md)** →
+3 -4
View File
@@ -42,6 +42,9 @@ aha 是一款基于 Rust 和 Candle 框架构建的高性能跨平台 AI 推理
| **重排序** | Qwen3-Reranker |
## 更新日志
### 2026-06-06
- 新增 PaddleOCR-VL-1.6
### 2026-05-29
- generate代码重构完成
@@ -57,10 +60,6 @@ aha 是一款基于 Rust 和 Candle 框架构建的高性能跨平台 AI 推理
### 2026-05-11
- 添加Moss-TTS-Nano,该模型比较小,计算误差影响较大,效果比python原版差
### 2026-05-09
- 合并 pr/eastgold15/46, 添加 aha-ui
**[查看完整更新日志](docs/changelog.zh-CN.md)** →
Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

After

Width:  |  Height:  |  Size: 153 KiB

+3
View File
@@ -5,6 +5,9 @@ All notable changes to aha will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### 2026-06-06
- add PaddleOCR-VL-1.6
### 2026-05-29
- generate code refactored
+3
View File
@@ -5,6 +5,9 @@
格式基于 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.0.0/)
本项目遵循 [语义化版本](https://semver.org/lang/zh-CN/spec/v2.0.0.html)。
### 2026-06-06
- 新增 PaddleOCR-VL-1.6
### 2026-05-29
- generate代码重构完成
+1 -1
View File
@@ -3,7 +3,7 @@
#### Options prompt:
"OCR:" | "Table Recognition:" | "Formula Recognition:" | "Chart Recognition:"
## PaddleOCR-VL1.5
## PaddleOCR-VL1.5/1.6
#### Options prompt:
"OCR:" | "Table Recognition:" | "Formula Recognition:" | "Chart Recognition:" | "Spotting:" | "Seal Recognition:"
+1 -1
View File
@@ -3,7 +3,7 @@
#### 可选提示词:
"OCR:" | "Table Recognition:" | "Formula Recognition:" | "Chart Recognition:"
## PaddleOCR-VL1.5
## PaddleOCR-VL1.5/1.6
#### 可选提示词:
"OCR:" | "Table Recognition:" | "Formula Recognition:" | "Chart Recognition:" | "Spotting:" | "Seal Recognition:"
+3 -1
View File
@@ -298,7 +298,9 @@ pub(crate) fn run_run(args: RunArgs) -> anyhow::Result<()> {
WhichModel::HunyuanOCR => {
hunyuan_ocr::HunyuanORExec::run(&input, output.as_deref(), &weight_path)?;
}
WhichModel::PaddleOCRVL | WhichModel::PaddleOCRVL1_5 => {
WhichModel::PaddleOCRVL
| WhichModel::PaddleOCRVL1_5
| WhichModel::PaddleOCRVL1_6 => {
paddleocr_vl::PaddleOVLExec::run(&input, output.as_deref(), &weight_path)?;
}
WhichModel::RMBG2_0 => {
+4 -1
View File
@@ -72,6 +72,8 @@ pub enum WhichModel {
PaddleOCRVL,
#[value(name = "PaddlePaddle/PaddleOCR-VL-1.5")]
PaddleOCRVL1_5,
#[value(name = "PaddlePaddle/PaddleOCR-VL-1.6")]
PaddleOCRVL1_6,
#[value(name = "AI-ModelScope/RMBG-2.0")]
RMBG2_0,
#[value(name = "OpenBMB/VoxCPM-0.5B")]
@@ -165,7 +167,8 @@ impl WhichModel {
| WhichModel::HunyuanOCR
| WhichModel::GlmOCR
| WhichModel::PaddleOCRVL
| WhichModel::PaddleOCRVL1_5 => "ocr",
| WhichModel::PaddleOCRVL1_5
| WhichModel::PaddleOCRVL1_6 => "ocr",
// ASR models
WhichModel::Qwen3ASR0_6B
| WhichModel::Qwen3ASR1_7B
+3 -1
View File
@@ -284,7 +284,9 @@ pub fn load_model<'a>(
let model = HunyuanOCRGenerateModel::init(path, device, dtype)?;
ModelInstance::HunyuanOCR(model)
}
WhichModel::PaddleOCRVL | WhichModel::PaddleOCRVL1_5 => {
WhichModel::PaddleOCRVL
| WhichModel::PaddleOCRVL1_5
| WhichModel::PaddleOCRVL1_6 => {
let model = PaddleOCRVLGenerateModel::init(path, device, dtype)?;
ModelInstance::PaddleOCRVL(Box::new(model))
}
+49
View File
@@ -5,6 +5,55 @@ use aha::params::chat::ChatCompletionParameters;
use anyhow::Result;
use rocket::futures::StreamExt;
#[test]
fn paddleocr_vl_1_6_generate() -> Result<()> {
// RUST_BACKTRACE=1 cargo test -F cuda --test test_paddleocr_vl paddleocr_vl_1_6_generate -r -- --nocapture
let message = r#"
{
"model": "paddleocr_vl1.6",
"messages": [
{
"role": "user",
"content": [
{
"type": "image",
"image_url":
{
"url": "file://./assets/img/ocr_test1.png"
}
},
{
"type": "text",
"text": "Spotting:"
}
]
}
],
"stream": false
}
"#;
let save_dir =
aha::utils::get_default_save_dir().ok_or(anyhow::anyhow!("Failed to get save dir"))?;
let model_path = format!("{}/PaddlePaddle/PaddleOCR-VL-1.6/", save_dir);
let mes: ChatCompletionParameters = serde_json::from_str(message)?;
let i_start = Instant::now();
let mut model = PaddleOCRVLGenerateModel::init(&model_path, None, None)?;
let i_duration = i_start.elapsed();
println!("Time elapsed in load model is: {:?}", i_duration);
let i_start = Instant::now();
let res = model.generate(mes)?;
let i_duration = i_start.elapsed();
println!("generate: \n {:?}", res);
if let Some(usage) = &res.usage {
let num_token = usage.total_tokens;
let duration_secs = i_duration.as_secs_f64();
let tps = num_token as f64 / duration_secs;
println!("Tokens per second (TPS): {:.2}", tps);
}
println!("Time elapsed in generate is: {:?}", i_duration);
Ok(())
}
#[test]
fn paddleocr_vl_1_5_generate() -> Result<()> {
// RUST_BACKTRACE=1 cargo test -F cuda --test test_paddleocr_vl paddleocr_vl_1_5_generate -r -- --nocapture