langgz commited on
Commit
4d5668e
·
verified ·
1 Parent(s): 35bf550

Update split-layout Transformers checkpoint

Browse files

Publish the checkpoint and processor artifacts validated for huggingface/transformers#46180. The model loads with zero missing, unexpected, or mismatched keys and passes the H100 English transcription quickstart. Also replace the stale preprocessor config and add model-card usage instructions.

README.md CHANGED
@@ -34,11 +34,40 @@ This model is part of the **FunASR** ecosystem — one industrial-grade open-sou
34
 
35
  </div>
36
 
 
37
 
38
- # Fun-ASR-Nano (HuggingFace Transformers)
39
-
40
- This is the HuggingFace Transformers-compatible version of [Fun-ASR-Nano-2512](https://huggingface.co/FunAudioLLM/Fun-ASR-Nano-2512).
41
 
42
  Fun-ASR-Nano is an end-to-end speech recognition model by [FunAudioLLM](https://github.com/FunAudioLLM), trained on tens of millions of hours of real speech data. It supports multilingual speech recognition covering Chinese (with dialects), English, Japanese, Korean, and many more languages.
43
 
44
- For full documentation, benchmarks, and usage instructions, please refer to the [main model card](https://huggingface.co/FunAudioLLM/Fun-ASR-Nano-2512).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
  </div>
36
 
37
+ # Fun-ASR-Nano (Hugging Face Transformers)
38
 
39
+ This is the Hugging Face Transformers-compatible version of [Fun-ASR-Nano-2512](https://huggingface.co/FunAudioLLM/Fun-ASR-Nano-2512).
 
 
40
 
41
  Fun-ASR-Nano is an end-to-end speech recognition model by [FunAudioLLM](https://github.com/FunAudioLLM), trained on tens of millions of hours of real speech data. It supports multilingual speech recognition covering Chinese (with dialects), English, Japanese, Korean, and many more languages.
42
 
43
+ ## Transformers quickstart
44
+
45
+ Fun-ASR-Nano support is being added to Transformers in [huggingface/transformers#46180](https://github.com/huggingface/transformers/pull/46180). Until it is included in a Transformers release, use a build containing that PR.
46
+
47
+ ```python
48
+ import torch
49
+ from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor
50
+
51
+ model_id = "FunAudioLLM/Fun-ASR-Nano-2512-hf"
52
+ processor = AutoProcessor.from_pretrained(model_id)
53
+ model = AutoModelForSpeechSeq2Seq.from_pretrained(
54
+ model_id,
55
+ dtype=torch.bfloat16,
56
+ device_map="auto",
57
+ )
58
+
59
+ audio_url = "https://huggingface.co/FunAudioLLM/Fun-ASR-Nano-2512/resolve/main/example/en.mp3"
60
+ inputs = processor.apply_transcription_request(audio=audio_url, return_tensors="pt").to(model.device)
61
+
62
+ generated_ids = model.generate(**inputs, max_new_tokens=200)
63
+ generated_ids = generated_ids[:, inputs.input_ids.shape[1] :]
64
+ print(processor.batch_decode(generated_ids, skip_special_tokens=True)[0])
65
+ ```
66
+
67
+ Expected transcription:
68
+
69
+ ```text
70
+ The tribal chieftain called for the boy, and presented him with fifty pieces of gold.
71
+ ```
72
+
73
+ For batch inference, training, `torch.compile`, benchmarks, and the full model description, see the [Transformers documentation](https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/fun_asr_nano.md) and the [original model card](https://huggingface.co/FunAudioLLM/Fun-ASR-Nano-2512).
config.json CHANGED
@@ -1,23 +1,23 @@
1
  {
2
- "adaptor_attention_heads": 8,
3
  "adaptor_downsample_rate": 1,
4
- "adaptor_dropout_rate": 0.0,
5
- "adaptor_ffn_dim": 2048,
6
- "adaptor_num_layers": 2,
 
7
  "architectures": [
8
  "FunAsrNanoForConditionalGeneration"
9
  ],
10
  "audio_encoder_config": {
11
- "attention_dropout_rate": 0.1,
12
- "attention_heads": 4,
13
- "dropout_rate": 0.1,
14
  "initializer_range": 0.02,
15
  "input_size": 560,
 
16
  "kernel_size": 11,
17
- "linear_units": 2048,
18
  "model_type": "fun_asr_nano_encoder",
19
- "num_blocks": 50,
20
- "output_size": 512,
21
  "sanm_shift": 0,
22
  "tp_blocks": 20
23
  },
@@ -87,5 +87,6 @@
87
  "use_sliding_window": false,
88
  "vocab_size": 151936
89
  },
 
90
  "transformers_version": "5.13.0.dev0"
91
  }
 
1
  {
 
2
  "adaptor_downsample_rate": 1,
3
+ "adaptor_dropout": 0.0,
4
+ "adaptor_intermediate_size": 2048,
5
+ "adaptor_num_attention_heads": 8,
6
+ "adaptor_num_hidden_layers": 2,
7
  "architectures": [
8
  "FunAsrNanoForConditionalGeneration"
9
  ],
10
  "audio_encoder_config": {
11
+ "attention_dropout": 0.0,
12
+ "dropout": 0.1,
13
+ "encoder_layers": 50,
14
  "initializer_range": 0.02,
15
  "input_size": 560,
16
+ "intermediate_size": 2048,
17
  "kernel_size": 11,
 
18
  "model_type": "fun_asr_nano_encoder",
19
+ "num_attention_heads": 4,
20
+ "output_dim": 512,
21
  "sanm_shift": 0,
22
  "tp_blocks": 20
23
  },
 
87
  "use_sliding_window": false,
88
  "vocab_size": 151936
89
  },
90
+ "tie_word_embeddings": true,
91
  "transformers_version": "5.13.0.dev0"
92
  }
generation_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 151643,
4
+ "eos_token_id": 151645,
5
+ "output_attentions": false,
6
+ "output_hidden_states": false,
7
+ "transformers_version": "5.13.0.dev0",
8
+ "use_cache": true
9
+ }
model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d6ff80cd0dc665baf82adac89f68b788e56c75815351c46227366ae3791bdd7f
3
- size 1970908640
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bc11982f1cb33c77c21208365d3a1a19cf103cf4a0b1cab96684b70728b231ab
3
+ size 1659742664
preprocessor_config.json DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "feature_extractor_type": "FunAsrNanoFeatureExtractor",
3
- "feature_size": 80,
4
- "sampling_rate": 16000,
5
- "frame_length": 25,
6
- "frame_shift": 10,
7
- "lfr_m": 7,
8
- "lfr_n": 6,
9
- "window": "hamming",
10
- "padding_value": 0.0,
11
- "return_attention_mask": true
12
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
processor_config.json CHANGED
@@ -1,6 +1,20 @@
1
  {
2
- "processor_class": "FunAsrNanoProcessor",
3
- "auto_map": {
4
- "AutoProcessor": "processing_fun_asr_nano.FunAsrNanoProcessor"
5
- }
6
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  {
2
+ "audio_downsample_rate": 1,
3
+ "audio_token": "<|object_ref_start|>",
4
+ "default_transcription_prompt": "Transcribe the audio:",
5
+ "feature_extractor": {
6
+ "feature_extractor_type": "FunAsrNanoFeatureExtractor",
7
+ "feature_size": 80,
8
+ "frame_length": 25,
9
+ "frame_shift": 10,
10
+ "lfr_m": 7,
11
+ "lfr_n": 6,
12
+ "padding_side": "right",
13
+ "padding_value": 0.0,
14
+ "preemphasis": 0.97,
15
+ "return_attention_mask": true,
16
+ "sampling_rate": 16000
17
+ },
18
+ "max_audio_len": null,
19
+ "processor_class": "FunAsrNanoProcessor"
20
+ }
tokenizer.json CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4
3
- size 11422654
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be75606093db2094d7cd20f3c2f385c212750648bd6ea4fb2bf507a6a4c55506
3
+ size 11422650
tokenizer_config.json CHANGED
@@ -1,217 +1,11 @@
1
  {
2
- "add_bos_token": false,
3
  "add_prefix_space": false,
4
- "added_tokens_decoder": {
5
- "151643": {
6
- "content": "<|endoftext|>",
7
- "lstrip": false,
8
- "normalized": false,
9
- "rstrip": false,
10
- "single_word": false,
11
- "special": true
12
- },
13
- "151644": {
14
- "content": "<|im_start|>",
15
- "lstrip": false,
16
- "normalized": false,
17
- "rstrip": false,
18
- "single_word": false,
19
- "special": true
20
- },
21
- "151645": {
22
- "content": "<|im_end|>",
23
- "lstrip": false,
24
- "normalized": false,
25
- "rstrip": false,
26
- "single_word": false,
27
- "special": true
28
- },
29
- "151646": {
30
- "content": "<|object_ref_start|>",
31
- "lstrip": false,
32
- "normalized": false,
33
- "rstrip": false,
34
- "single_word": false,
35
- "special": true
36
- },
37
- "151647": {
38
- "content": "<|object_ref_end|>",
39
- "lstrip": false,
40
- "normalized": false,
41
- "rstrip": false,
42
- "single_word": false,
43
- "special": true
44
- },
45
- "151648": {
46
- "content": "<|box_start|>",
47
- "lstrip": false,
48
- "normalized": false,
49
- "rstrip": false,
50
- "single_word": false,
51
- "special": true
52
- },
53
- "151649": {
54
- "content": "<|box_end|>",
55
- "lstrip": false,
56
- "normalized": false,
57
- "rstrip": false,
58
- "single_word": false,
59
- "special": true
60
- },
61
- "151650": {
62
- "content": "<|quad_start|>",
63
- "lstrip": false,
64
- "normalized": false,
65
- "rstrip": false,
66
- "single_word": false,
67
- "special": true
68
- },
69
- "151651": {
70
- "content": "<|quad_end|>",
71
- "lstrip": false,
72
- "normalized": false,
73
- "rstrip": false,
74
- "single_word": false,
75
- "special": true
76
- },
77
- "151652": {
78
- "content": "<|vision_start|>",
79
- "lstrip": false,
80
- "normalized": false,
81
- "rstrip": false,
82
- "single_word": false,
83
- "special": true
84
- },
85
- "151653": {
86
- "content": "<|vision_end|>",
87
- "lstrip": false,
88
- "normalized": false,
89
- "rstrip": false,
90
- "single_word": false,
91
- "special": true
92
- },
93
- "151654": {
94
- "content": "<|vision_pad|>",
95
- "lstrip": false,
96
- "normalized": false,
97
- "rstrip": false,
98
- "single_word": false,
99
- "special": true
100
- },
101
- "151655": {
102
- "content": "<|image_pad|>",
103
- "lstrip": false,
104
- "normalized": false,
105
- "rstrip": false,
106
- "single_word": false,
107
- "special": true
108
- },
109
- "151656": {
110
- "content": "<|video_pad|>",
111
- "lstrip": false,
112
- "normalized": false,
113
- "rstrip": false,
114
- "single_word": false,
115
- "special": true
116
- },
117
- "151657": {
118
- "content": "<tool_call>",
119
- "lstrip": false,
120
- "normalized": false,
121
- "rstrip": false,
122
- "single_word": false,
123
- "special": false
124
- },
125
- "151658": {
126
- "content": "</tool_call>",
127
- "lstrip": false,
128
- "normalized": false,
129
- "rstrip": false,
130
- "single_word": false,
131
- "special": false
132
- },
133
- "151659": {
134
- "content": "<|fim_prefix|>",
135
- "lstrip": false,
136
- "normalized": false,
137
- "rstrip": false,
138
- "single_word": false,
139
- "special": false
140
- },
141
- "151660": {
142
- "content": "<|fim_middle|>",
143
- "lstrip": false,
144
- "normalized": false,
145
- "rstrip": false,
146
- "single_word": false,
147
- "special": false
148
- },
149
- "151661": {
150
- "content": "<|fim_suffix|>",
151
- "lstrip": false,
152
- "normalized": false,
153
- "rstrip": false,
154
- "single_word": false,
155
- "special": false
156
- },
157
- "151662": {
158
- "content": "<|fim_pad|>",
159
- "lstrip": false,
160
- "normalized": false,
161
- "rstrip": false,
162
- "single_word": false,
163
- "special": false
164
- },
165
- "151663": {
166
- "content": "<|repo_name|>",
167
- "lstrip": false,
168
- "normalized": false,
169
- "rstrip": false,
170
- "single_word": false,
171
- "special": false
172
- },
173
- "151664": {
174
- "content": "<|file_sep|>",
175
- "lstrip": false,
176
- "normalized": false,
177
- "rstrip": false,
178
- "single_word": false,
179
- "special": false
180
- },
181
- "151665": {
182
- "content": "<tool_response>",
183
- "lstrip": false,
184
- "normalized": false,
185
- "rstrip": false,
186
- "single_word": false,
187
- "special": false
188
- },
189
- "151666": {
190
- "content": "</tool_response>",
191
- "lstrip": false,
192
- "normalized": false,
193
- "rstrip": false,
194
- "single_word": false,
195
- "special": false
196
- },
197
- "151667": {
198
- "content": "<think>",
199
- "lstrip": false,
200
- "normalized": false,
201
- "rstrip": false,
202
- "single_word": false,
203
- "special": false
204
- },
205
- "151668": {
206
- "content": "</think>",
207
- "lstrip": false,
208
- "normalized": false,
209
- "rstrip": false,
210
- "single_word": false,
211
- "special": false
212
- }
213
- },
214
- "additional_special_tokens": [
215
  "<|im_start|>",
216
  "<|im_end|>",
217
  "<|object_ref_start|>",
@@ -226,13 +20,11 @@
226
  "<|image_pad|>",
227
  "<|video_pad|>"
228
  ],
229
- "bos_token": null,
230
- "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {{- messages[0].content + '\\n\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0].content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- if message.content is string %}\n {%- set content = message.content %}\n {%- else %}\n {%- set content = '' %}\n {%- endif %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- if loop.index0 > ns.last_query_index %}\n {%- if loop.last or (not loop.last and reasoning_content) %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content.strip('\\n') + '\\n</think>\\n\\n' + content.lstrip('\\n') }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n {%- if enable_thinking is defined and enable_thinking is false %}\n {{- '<think>\\n\\n</think>\\n\\n' }}\n {%- endif %}\n{%- endif %}",
231
- "clean_up_tokenization_spaces": false,
232
- "eos_token": "<|im_end|>",
233
- "errors": "replace",
234
  "model_max_length": 131072,
235
  "pad_token": "<|endoftext|>",
 
236
  "split_special_tokens": false,
237
  "tokenizer_class": "Qwen2Tokenizer",
238
  "unk_token": null
 
1
  {
 
2
  "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  "<|im_start|>",
10
  "<|im_end|>",
11
  "<|object_ref_start|>",
 
20
  "<|image_pad|>",
21
  "<|video_pad|>"
22
  ],
23
+ "is_local": true,
24
+ "local_files_only": false,
 
 
 
25
  "model_max_length": 131072,
26
  "pad_token": "<|endoftext|>",
27
+ "processor_class": "FunAsrNanoProcessor",
28
  "split_special_tokens": false,
29
  "tokenizer_class": "Qwen2Tokenizer",
30
  "unk_token": null