Retrieve0 commited on
Commit
777f600
·
verified ·
1 Parent(s): f257021

Publish Qwen3-ASR model files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ encoder-window.bf16.onnx.data filter=lfs diff=lfs merge=lfs -text
37
+ encoder-window.fp16.onnx.data filter=lfs diff=lfs merge=lfs -text
38
+ encoder-window.int8.onnx_data filter=lfs diff=lfs merge=lfs -text
39
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: Qwen/Qwen3-ASR-1.7B-hf
4
+ library_name: onnxruntime
5
+ pipeline_tag: automatic-speech-recognition
6
+ tags:
7
+ - qwen3-asr
8
+ - tensorrt
9
+ - onnx
10
+ - bf16
11
+ - fp16
12
+ - int8
13
+ ---
14
+
15
+ <p align="center">
16
+ <a href="https://github.com/lost0427/Qwen3-ASR-TensorRT"><img src="https://img.shields.io/badge/GitHub-source-181717?logo=github" alt="GitHub source"></a>
17
+ <a href="https://huggingface.co/Retrieve0/Qwen3-ASR-1.7B-TensorRT-Encoder"><img src="https://img.shields.io/badge/Hugging_Face-model-yellow?logo=huggingface" alt="Hugging Face model"></a>
18
+ </p>
19
+
20
+ # Qwen3-ASR 1.7B TensorRT Encoder
21
+
22
+ ## English
23
+
24
+ ONNX exports of the audio encoder from [Qwen/Qwen3-ASR-1.7B-hf](https://huggingface.co/Qwen/Qwen3-ASR-1.7B-hf), prepared for TensorRT inference. Use an encoder export with a compatible Qwen3-ASR text decoder, such as the [EXL3 decoder](https://huggingface.co/Retrieve0/Qwen3-ASR-1.7B-EXL3-Decoder). The [Qwen3-ASR-TensorRT repository](https://github.com/lost0427/Qwen3-ASR-TensorRT) integrates the encoder and decoder for transcription.
25
+
26
+ ### Files
27
+
28
+ | Precision | Files | Use |
29
+ | --- | --- | --- |
30
+ | BF16 | `encoder-window.bf16.onnx`, `encoder-window.bf16.onnx.data` | Reference export for GPUs with BF16 support |
31
+ | FP16 | `encoder-window.fp16.onnx`, `encoder-window.fp16.onnx.data` | Compatibility export for older NVIDIA GPUs |
32
+ | INT8 Q/DQ | `encoder-window.int8.onnx`, `encoder-window.int8.onnx_data` | Calibrated quantized export |
33
+
34
+ TensorRT `.engine` files are not included because they depend on the target GPU architecture and TensorRT build environment. Build an engine locally with this project.
35
+
36
+ ### Precision and calibration
37
+
38
+ BF16 is the project reference precision. FP16 supports NVIDIA GPUs without BF16. INT8 applies symmetric Q/DQ quantization to Conv and MatMul operations; remaining operations use floating-point precision. Calibration used 32 audio files and produced 52 encoder windows.
39
+
40
+ ### Requirements
41
+
42
+ - NVIDIA GPU and CUDA
43
+ - Reference environment: CUDA 12.8, TensorRT 11.4.0.106, Python 3.10–3.13
44
+ - The [Qwen3-ASR-TensorRT repository](https://github.com/lost0427/Qwen3-ASR-TensorRT), which includes the encoder/decoder integration
45
+
46
+ Windows is tested and supported. Linux should work with compatible CUDA, TensorRT, PyTorch, and ExLlamaV3 packages.
47
+
48
+ ### Build
49
+
50
+ ```powershell
51
+ uv sync --extra quantization
52
+
53
+ uv run qwen3-asr --model Qwen/Qwen3-ASR-1.7B-hf build --encoder-precision bf16
54
+ uv run qwen3-asr --model Qwen/Qwen3-ASR-1.7B-hf build --encoder-precision fp16
55
+
56
+ uv run qwen3-asr --model Qwen/Qwen3-ASR-1.7B-hf quantize-encoder .\calibration-audio --max-audio-files 32
57
+ uv run qwen3-asr --model Qwen/Qwen3-ASR-1.7B-hf build --encoder-precision int8
58
+ ```
59
+
60
+ ### License and citation
61
+
62
+ This export is derived from `Qwen/Qwen3-ASR-1.7B-hf` and is published under Apache-2.0. Retain the upstream attribution and license. Please also cite the Qwen3-ASR work and the runtime project.
63
+
64
+ ## 中文
65
+
66
+ 本仓库提供 [Qwen/Qwen3-ASR-1.7B-hf](https://huggingface.co/Qwen/Qwen3-ASR-1.7B-hf) 音频编码器的 ONNX 导出,可用于 TensorRT 推理。使用时需配套兼容的 Qwen3-ASR 文本解码器,例如 [EXL3 解码器](https://huggingface.co/Retrieve0/Qwen3-ASR-1.7B-EXL3-Decoder)。[Qwen3-ASR-TensorRT 仓库](https://github.com/lost0427/Qwen3-ASR-TensorRT)已集成 encoder 和 decoder,可用于完整转写。
67
+
68
+ ### 文件
69
+
70
+ | 精度 | 文件 | 用途 |
71
+ | --- | --- | --- |
72
+ | BF16 | `encoder-window.bf16.onnx`、`encoder-window.bf16.onnx.data` | 支持 BF16 的 GPU 上的基准导出 |
73
+ | FP16 | `encoder-window.fp16.onnx`、`encoder-window.fp16.onnx.data` | 兼容不支持 BF16 的较旧 NVIDIA GPU |
74
+ | INT8 Q/DQ | `encoder-window.int8.onnx`、`encoder-window.int8.onnx_data` | 经校准的量化导出 |
75
+
76
+ 本仓库不提供 TensorRT `.engine` 文件,因为它们依赖目标 GPU 架构和 TensorRT 构建环境。请在目标设备上使用本项目构建 engine。
77
+
78
+ ### 精度与校准
79
+
80
+ BF16 是本项目的基准精度。FP16 用于不支持 BF16 的 NVIDIA GPU。INT8 对 Conv 和 MatMul 运算应用对称 Q/DQ 量化,其余运算保留浮点精度。校准使用了 32 个音频文件,生成 52 个 encoder window。
81
+
82
+ ### 运行要求
83
+
84
+ - NVIDIA GPU 与 CUDA
85
+ - 参考环境:CUDA 12.8、TensorRT 11.4.0.106、Python 3.10–3.13
86
+ - [Qwen3-ASR-TensorRT 仓库](https://github.com/lost0427/Qwen3-ASR-TensorRT),其中已包含 encoder/decoder 集成
87
+
88
+ 项目已在 Windows 上测试并可用。Linux 环境在 CUDA、TensorRT、PyTorch 和 ExLlamaV3 软件包版本兼容时也可运行。
89
+
90
+ ### 构建
91
+
92
+ ```powershell
93
+ uv sync --extra quantization
94
+
95
+ uv run qwen3-asr --model Qwen/Qwen3-ASR-1.7B-hf build --encoder-precision bf16
96
+ uv run qwen3-asr --model Qwen/Qwen3-ASR-1.7B-hf build --encoder-precision fp16
97
+
98
+ uv run qwen3-asr --model Qwen/Qwen3-ASR-1.7B-hf quantize-encoder .\calibration-audio --max-audio-files 32
99
+ uv run qwen3-asr --model Qwen/Qwen3-ASR-1.7B-hf build --encoder-precision int8
100
+ ```
101
+
102
+ ### 许可证与引用
103
+
104
+ 本导出基于 `Qwen/Qwen3-ASR-1.7B-hf`,以 Apache-2.0 发布。请保留上游归属说明和许可证,并引用 Qwen3-ASR 工作及本运行时项目。
chat_template.jinja ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {%- set ns = namespace(system_text='') -%}{%- for m in messages -%}{%- if m.role == 'system' -%}{%- if m.content is string -%}{%- set ns.system_text = ns.system_text + m.content -%}{%- else -%}{%- for c in m.content -%}{%- if c.type == 'text' and (c.text is defined) -%}{%- set ns.system_text = ns.system_text + c.text -%}{%- endif -%}{%- endfor -%}{%- endif -%}{%- endif -%}{%- endfor -%}{%- set ns2 = namespace(audio_tokens='') -%}{%- for m in messages -%}{%- if m.content is not string -%}{%- for c in m.content -%}{%- if c.type == 'audio' or ('audio' in c) or ('audio_url' in c) -%}{%- set ns2.audio_tokens = ns2.audio_tokens + '<|audio_start|><|audio_pad|><|audio_end|>' -%}{%- endif -%}{%- endfor -%}{%- endif -%}{%- endfor -%}{{- '<|im_start|>system
2
+ ' + ns.system_text + '<|im_end|>
3
+ ' -}}{{- '<|im_start|>user
4
+ ' + ns2.audio_tokens + '<|im_end|>
5
+ ' -}}{%- for m in messages -%}{%- if m.role == 'assistant' -%}{%- set ns3 = namespace(assistant_text='') -%}{%- if m.content is string -%}{%- set ns3.assistant_text = m.content -%}{%- else -%}{%- for c in m.content -%}{%- if c.type == 'text' and (c.text is defined) -%}{%- set ns3.assistant_text = ns3.assistant_text + c.text -%}{%- endif -%}{%- endfor -%}{%- endif -%}{{- '<|im_start|>assistant
6
+ ' -}}{% generation %}{{- ns3.assistant_text + '<|im_end|>
7
+ ' -}}{% endgeneration %}{%- endif -%}{%- endfor -%}{%- if add_generation_prompt -%}{{- '<|im_start|>assistant
8
+ ' -}}{%- endif -%}
config.json ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3ASRForConditionalGeneration"
4
+ ],
5
+ "audio_config": {
6
+ "activation_dropout": 0,
7
+ "activation_function": "gelu",
8
+ "attention_dropout": 0,
9
+ "conv_chunksize": 500,
10
+ "d_model": 1024,
11
+ "downsample_hidden_size": 480,
12
+ "dropout": 0,
13
+ "encoder_attention_heads": 16,
14
+ "encoder_ffn_dim": 4096,
15
+ "encoder_layers": 24,
16
+ "initializer_range": 0.02,
17
+ "max_position_embeddings": 13,
18
+ "model_type": "qwen3_asr_encoder",
19
+ "n_window": 50,
20
+ "n_window_infer": 800,
21
+ "num_key_value_heads": 16,
22
+ "num_mel_bins": 128,
23
+ "output_dim": 2048,
24
+ "scale_embedding": false
25
+ },
26
+ "audio_token_id": 151676,
27
+ "dtype": "bfloat16",
28
+ "eos_token_id": [
29
+ 151643,
30
+ 151645
31
+ ],
32
+ "initializer_range": 0.02,
33
+ "model_type": "qwen3_asr",
34
+ "pad_token_id": 151645,
35
+ "text_config": {
36
+ "attention_bias": false,
37
+ "attention_dropout": 0.0,
38
+ "bos_token_id": null,
39
+ "eos_token_id": null,
40
+ "head_dim": 128,
41
+ "hidden_act": "silu",
42
+ "hidden_size": 2048,
43
+ "initializer_range": 0.02,
44
+ "intermediate_size": 6144,
45
+ "layer_types": [
46
+ "full_attention",
47
+ "full_attention",
48
+ "full_attention",
49
+ "full_attention",
50
+ "full_attention",
51
+ "full_attention",
52
+ "full_attention",
53
+ "full_attention",
54
+ "full_attention",
55
+ "full_attention",
56
+ "full_attention",
57
+ "full_attention",
58
+ "full_attention",
59
+ "full_attention",
60
+ "full_attention",
61
+ "full_attention",
62
+ "full_attention",
63
+ "full_attention",
64
+ "full_attention",
65
+ "full_attention",
66
+ "full_attention",
67
+ "full_attention",
68
+ "full_attention",
69
+ "full_attention",
70
+ "full_attention",
71
+ "full_attention",
72
+ "full_attention",
73
+ "full_attention"
74
+ ],
75
+ "max_position_embeddings": 65536,
76
+ "max_window_layers": 28,
77
+ "model_type": "qwen3",
78
+ "num_attention_heads": 16,
79
+ "num_hidden_layers": 28,
80
+ "num_key_value_heads": 8,
81
+ "pad_token_id": null,
82
+ "rms_norm_eps": 1e-06,
83
+ "rope_parameters": {
84
+ "rope_theta": 1000000,
85
+ "rope_type": "default"
86
+ },
87
+ "sliding_window": null,
88
+ "tie_word_embeddings": true,
89
+ "use_cache": true,
90
+ "use_sliding_window": false,
91
+ "vocab_size": 151936
92
+ },
93
+ "tie_word_embeddings": true,
94
+ "timestamp_token_id": 151705,
95
+ "token_classification_bias": false,
96
+ "transformers_version": "5.13.0.dev0"
97
+ }
encoder-window.bf16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:231e77593bd96b3335207f4bbd3927e94c89270d54589581ca05357180cc2bac
3
+ size 924195
encoder-window.bf16.onnx.data ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37698aa0cb2060137868768ae376e2af0828c768ac4c726bbdcb8d386b26f514
3
+ size 635009088
encoder-window.fp16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9c2357719ed004677b7c79f2e47afa163d7c4491002628cbee831ca75d2d4667
3
+ size 924193
encoder-window.fp16.onnx.data ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3fe5c39bb66ba91e328623e84dd090ec7b8eccda83a8670e80d7a0e0ee30dfdd
3
+ size 635009088
encoder-window.int8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6cc2b80f21dd5036919e8a67abc4d90452500f17eaa24f74e530c248b225f585
3
+ size 1893394
encoder-window.int8.onnx_data ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c92889d879e992d617a5c1070bf206fb08acf96c056c62657a6a094ed95aaef
3
+ size 634978752
generation_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_sample": false,
3
+ "eos_token_id": [
4
+ 151643,
5
+ 151645
6
+ ],
7
+ "max_new_tokens": 512,
8
+ "pad_token_id": 151645,
9
+ "transformers_version": "5.13.0.dev0"
10
+ }
processor_config.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "feature_extractor": {
3
+ "chunk_length": 30,
4
+ "dither": 0.0,
5
+ "feature_extractor_type": "Qwen3ASRFeatureExtractor",
6
+ "feature_size": 128,
7
+ "hop_length": 160,
8
+ "min_length": 8000,
9
+ "n_fft": 400,
10
+ "n_samples": 480000,
11
+ "n_window": 50,
12
+ "nb_max_frames": 3000,
13
+ "padding_side": "right",
14
+ "padding_value": 0.0,
15
+ "return_attention_mask": true,
16
+ "sampling_rate": 16000
17
+ },
18
+ "processor_class": "Qwen3ASRProcessor",
19
+ "timestamp_segment_time": 80
20
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe1fad59be22a41ee293363fcf95fdedbc7c93f3b49270b1d2e18bd1399a7a05
3
+ size 11429653
tokenizer_config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "audio_bos_token": "<|audio_start|>",
4
+ "audio_eos_token": "<|audio_end|>",
5
+ "audio_token": "<|audio_pad|>",
6
+ "backend": "tokenizers",
7
+ "bos_token": null,
8
+ "clean_up_tokenization_spaces": false,
9
+ "eos_token": "<|im_end|>",
10
+ "errors": "replace",
11
+ "image_token": "<|image_pad|>",
12
+ "is_local": true,
13
+ "local_files_only": false,
14
+ "model_max_length": 131072,
15
+ "model_specific_special_tokens": {
16
+ "audio_bos_token": "<|audio_start|>",
17
+ "audio_eos_token": "<|audio_end|>",
18
+ "audio_token": "<|audio_pad|>",
19
+ "image_token": "<|image_pad|>",
20
+ "video_token": "<|video_pad|>",
21
+ "vision_bos_token": "<|vision_start|>",
22
+ "vision_eos_token": "<|vision_end|>"
23
+ },
24
+ "pad_token": "<|endoftext|>",
25
+ "processor_class": "Qwen3ASRProcessor",
26
+ "split_special_tokens": false,
27
+ "tokenizer_class": "Qwen2Tokenizer",
28
+ "unk_token": null,
29
+ "video_token": "<|video_pad|>",
30
+ "vision_bos_token": "<|vision_start|>",
31
+ "vision_eos_token": "<|vision_end|>"
32
+ }