Skip to content

Commit 486b4b7

Browse files
authored
docs: connect native Transformers guides to tested CUDA recipe (#3697)
Connect bilingual source guides to the tested canonical GPU example without changing CPU recipes or model capabilities. Signed-off-by: LauraGPT <18321252+LauraGPT@users.noreply.github.com>
1 parent 2f0de0e commit 486b4b7

3 files changed

Lines changed: 56 additions & 0 deletions

File tree

‎docs/transformers_native.md‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,30 @@ truncation; increasing the limit does not prove coverage of a long recording.
103103
The CLI reports `reached_eos` and exits unsuccessfully for missing EOS or empty
104104
text. EOS itself is not proof that all words were recognized.
105105

106+
## Run the CLI on CUDA
107+
108+
Follow the [isolated CUDA installation](https://github.com/QwenAudio/Fun-ASR/tree/main/examples/transformers#cuda-an-isolated-tested-recipe),
109+
including its separate `requirements-gpu.txt`, before running this from the
110+
QwenAudio/Fun-ASR code repository with your local audio files:
111+
112+
```bash
113+
python examples/transformers/transcribe.py chinese.wav english.wav --language zh en --device cuda --dtype bfloat16
114+
```
115+
116+
On **2026-09-10**, Linux/Python 3.12, H100 80 GB, driver **550.127.08**,
117+
torch/torchaudio **2.11.0+cu128** and Transformers **5.17.0** passed eight
118+
float32/BF16 English, Chinese, keyword and padded mixed-batch functional cases.
119+
The updated CLI also passed GPU single-file/batch and default CPU regression.
120+
These are not accuracy, minimum-VRAM or serving-capacity benchmarks; the Chinese
121+
keyword error described above remains. Other GPUs and float16 were not tested.
122+
123+
No device flags still means CPU float32. Explicit CUDA fails when unavailable,
124+
and BF16 requires device support; no silent CPU fallback. The model and inputs
125+
move together without casting integer token IDs. Output records device and dtype.
126+
An attention-dispatch warning was observed; successful inference does not verify
127+
every component's kernel or imply Flash Attention performance. Hosted GPU
128+
Space/Colab execution has not been verified by these local checks.
129+
106130
## From an example to a service
107131

108132
| Need | Checkpoint and interface |

‎docs/transformers_native_zh.md‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,28 @@ python examples/transformers/transcribe.py chinese.wav english.wav --language zh
9494
上限不等于长录音已完整覆盖。CLI 输出 `reached_eos`,缺少 EOS 或文本为空时
9595
以非零状态结束;出现 EOS 也不代表每个字都识别正确。
9696

97+
## 用 CUDA 运行 CLI
98+
99+
先按[独立 CUDA 安装指南](https://github.com/QwenAudio/Fun-ASR/tree/main/examples/transformers#cuda-an-isolated-tested-recipe)
100+
安装专用的 `requirements-gpu.txt`,不要混入 CPU 环境。在 QwenAudio/Fun-ASR
101+
代码仓库根目录,用自己的本地录音运行:
102+
103+
```bash
104+
python examples/transformers/transcribe.py chinese.wav english.wav --language zh en --device cuda --dtype bfloat16
105+
```
106+
107+
**2026-09-10** 在 Linux/Python 3.12、H100 80 GB、驱动 **550.127.08**、
108+
torch/torchaudio **2.11.0+cu128**、Transformers **5.17.0** 上完成八项功能检查:
109+
float32/BF16 各覆盖英文、中文、关键词和中英 padding 批次。修改后的 CLI 也通过
110+
GPU 单文件、批次与默认 CPU 回归。这不是准确率、最低显存或服务容量评测;
111+
前述中文关键词识别错误仍存在。其他 GPU 和 float16 尚未测试。
112+
113+
不传设备参数仍使用 CPU float32。显式请求 CUDA 但设备不可用时直接报错,
114+
BF16 也会检查设备支持,不会静默回退 CPU。模型和输入一起迁移设备,不把整数
115+
token ID 转成浮点数;输出记录实际设备与精度。测试中出现过 attention 分派警告,
116+
功能通过不代表每个组件的内核已验证,也不意味着 Flash Attention 性能已验证。
117+
这些本地检查不覆盖托管 GPU Space 或 Colab 的实际运行。
118+
97119
## 从示例走向服务
98120

99121
| 需求 | checkpoint 与接口 |

‎web-pages/product-site/tests/test_native_transformers_docs.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,16 @@ def test_all_language_entry_points_reach_native_examples(suffix):
9595
assert "fun_asr_nano_transformers.ipynb" in text
9696

9797

98+
@pytest.mark.parametrize("suffix", ["", "_zh"])
99+
def test_cuda_route_is_explicit_bounded_and_reaches_canonical_recipe(suffix):
100+
text = guide(suffix)
101+
for expected in ("--device cuda --dtype bfloat16", "H100", "550.127.08",
102+
"2.11.0+cu128", "2026-09-10", "requirements-gpu.txt"):
103+
assert expected in text
104+
assert "https://github.com/QwenAudio/Fun-ASR/tree/main/examples/transformers#cuda-an-isolated-tested-recipe" in text
105+
assert "torch==2.10.0+cpu" in text
106+
107+
98108
def test_hf_catalogue_and_sphinx_reach_native_model():
99109
text = (ROOT / "model_zoo/huggingface_models.md").read_text()
100110
assert MODEL in text and "transformers_native.md" in text

0 commit comments

Comments
 (0)