File size: 7,136 Bytes
857f342
 
 
6026724
857f342
 
 
 
 
 
 
 
 
 
 
 
74a4e9c
857f342
7d6f9fc
857f342
 
 
74a4e9c
 
 
857f342
74a4e9c
 
 
 
 
857f342
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74a4e9c
 
 
 
857f342
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
---
license: apache-2.0
library_name: rkllm
pipeline_tag: automatic-speech-recognition
tags:
- rk182x
- rockchip
- rknpu
- llm
- qwen
- edge-ai
- asr
- speech-recognition
- multilingual
---

# Qwen3-ASR โ€” [ASR] Streaming Speech Recognition

[English](README.md) | [็ฎ€ไฝ“ไธญๆ–‡](README_CN.md)

## 1. Overview

Streaming speech recognition: feed in an audio clip, get back the
**detected language plus the transcript**, refreshed once per second
(the RK182x streaming deployment of Qwen3-ASR-0.6B).

The upstream Qwen3-ASR family supports **52 languages and dialects**
(30 languages + 22 Chinese dialects) and handles speech, singing and
songs with background music. This repository ships the **0.6B** variant
running on the **streaming path**: audio is decoded in 1-second chunks
and the committed text grows monotonically.

This repository ships the RK182x deployment artifacts (RKNN graphs +
weights) **together with the wdnwebui worker manifest**
(`qwen3-asr.json`).

| Item | Value |
| --- | --- |
| Model ID | `wardner/Qwen3-ASR` |
| Display name | Qwen3-ASR |
| Model type | ASR (speech โ†’ language + text) |
| Compute target | RK182x |
| Host platform | RK3588 |
| Runtime | RKLLM + RKNN |
| Capabilities | `swcap_audio_asr` |
| Worker factory | `qwen3_asr` |
| Memory estimate | ~1600 MB |
| Init time | ~25 s |
| Cards required | 1 |
| Total weight size | 1.05 GB |

## 2. Files

| Path | Description | Size |
| --- | --- | --- |
| `encoder_online.1828.rknn` | RKNN graph โ€” **streaming** audio encoder (RK182x compute card, 1.82 TOPS generation) | 3.0 MB |
| `encoder_online.weight` | Weights paired with the RKNN graph above | 357.5 MB |
| `llm.1828.rknn` | RKNN graph โ€” Qwen3-ASR-0.6B LLM | 45.3 MB |
| `llm.weight` | Weights paired with the RKNN graph above | 369.3 MB |
| `llm.embed.bin` | Token embedding table, fp16 (vocab 151936 ร— dim 1024) | 296.8 MB |
| `llm.tokenizer.gguf` | GPT-2 BPE vocabulary + ByteLevel | 5.7 MB |
| `mel_128_filters.txt` | Mel filterbank (128 mel ร— 202 fp32) โ€” **must stay next to the weights** | 653.3 KB |
| `qwen3-asr.json` | **worker manifest** โ€” deliberately plain text | 1847 B |

> `qwen3-asr.json` is **deliberately not** in Git LFS. It is the
> manual of this distribution unit and must stay plain text so it can be
> diffed, reviewed and previewed on the Hub.

## 3. Download

```bash
hf download wardner/Qwen3-ASR --local-dir ./Qwen3-ASR
```

Or with git (requires Git LFS):

```bash
git clone https://huggingface.co/wardner/Qwen3-ASR
```

If `huggingface.co` is unreachable from your network (DNS interception /
blocked access), point the client at a mirror instead:

```bash
HF_ENDPOINT=https://hf-mirror.com hf download wardner/Qwen3-ASR \
  --local-dir ./Qwen3-ASR
```

Note: with `git clone` the weights are Git LFS **pointers** until
`git lfs pull` completes. `hf download` fetches the real files directly, and
does not create a `.git` directory โ€” neither is required for the model to
work; see ยง4.

## 4. Installation (wdnwebui)

Clone the repository into the model root so the folder holds **both** the
weights and the worker manifest:

```bash
git clone https://huggingface.co/wardner/Qwen3-ASR /userdata/models/Qwen3-ASR
```

Then open the web UI โ†’ **Compute** โ†’ the card appears under "local compute"
(the backend rescans the model root every ~2 s, **no restart needed**) โ†’
click "enable".

The directory name does not have to match the model name: the SDK follows
"the folder the manifest was found in", located through the
`WDNAI_QWEN3_ASR_DIR` environment variable declared in the manifest.

The card itself is **Streaming Speech Recognition** (`qwen3-asr`) in the app
grid. It accepts an uploaded audio file, a video file with an audio track,
or live audio from the board microphone; the recognized text is pushed to
the browser over WebSocket as each 1-second chunk completes.

## 5. SHA-256 verification

```bash
cd ./Qwen3-ASR
sha256sum -c SHA256SUMS
```

All entries must report `OK` before deployment.

## 6. Caveats and limits

See the `notes` field of `qwen3-asr.json` โ€” it records the
per-model specifics (streaming strategy, capability layout, side effects).
The details that bite most often:

- **This build is the streaming one.** The model folder ships
  `encoder_online.*`, not `encoder.*`, so the spec runs the streaming path
  (`use_online_encoder=True`, the SDK default). The encoder choice is a
  **load-time** decision โ€” which RKNN file goes on the NPU โ€” so it lives in
  the SDK spec, not in the manifest. Switching to the one-shot path needs
  `encoder.1828.rknn` + `encoder.weight` and `use_online_encoder=False`.
- **Streaming strategy** (aligned with the C++ demo
  `examples/Qwen3_ASR/cpp/online_main.cc`): 1 s per chunk
  (`ONLINE_CHUNK_MS=1000`), at most 50 new tokens per chunk
  (`ONLINE_MAX_NEW_TOKENS=50`), the first 4 rounds commit nothing
  (`ONLINE_ROLLBACK_ROUNDS=4`), later rounds roll back the last 5 tokens
  (`ONLINE_ROLLBACK_TOKENS=5`). The last chunk commits everything.
- **Only the committed prefix is monotonic.** The trailing "unconfirmed
  tail" is rewritten by the next round โ€” that is by design, not a bug.
- **The language head comes from the model.** It emits `language <lang>`
  first (token `151704` is the separator); the SDK returns the language
  separately to the front end. With little context the first round can
  report the wrong language (e.g. `Chinese` for English speech) โ€” the
  final language is taken from the committed token stream.
- **Audio length.** The streaming demo caps at 60 s
  (`ONLINE_MAX_AUDIO_SECONDS`); the exported LLM context is 24k tokens
  (`MAX_CONTEXT_LEN = 1024*24`), which covers roughly 20 minutes of
  audio โ€” the offline demo caps at 20 minutes (`OFFLINE_MAX_AUDIO_SECONDS`).
- **`infer_timeout_s=120`.** One inference is N serial LLM rounds
  (15 s of audio = 16 rounds) โ€” the 60 s default budget is not enough.
- **`memory_estimate_mb=1600`**: encoder 375 MB + LLM 435 MB + embedding
  table 297 MB.
- **Input format.** Any sample rate is resampled to 16 kHz mono. The mel
  frame count must be truncated to `n_frame * hop` exactly like the C demo
  does โ€” without that truncation the model input width mismatches and the
  **first round already diverges**.
- **Do not "improve" the resampler.** Linear interpolation is what matches
  the C demo byte-for-byte; swapping in a Kaiser-sinc filter drops words.
- **Decoding must skip special tokens**, otherwise `<|im_end|>` leaks into
  the tail of the transcript.
- **`mel_128_filters.txt` must be in the same directory** as the weights
  (128 mel ร— 202 fp32; the SDK truncates to the first 128 ร— 201 =
  `N_FFT/2+1` values).
- **The tokenizer comes from another repo**: `llm.tokenizer.gguf` is
  exported from `Qwen/Qwen3-0.6B`, not from the Qwen3-ASR repository.
- Model not deployed โ†’ load raises `FileNotFoundError`, which the worker's
  load flow turns into an `errored` state.

## 7. License

The upstream model is released under the Apache License 2.0. The files here
are RKNN-converted derivatives, not unmodified upstream weights. See
[LICENSE](LICENSE) and [NOTICE](NOTICE).