Automatic Speech Recognition
Transformers
Safetensors
fun_asr_nano
speech-recognition
asr
end-to-end
multilingual
arxiv:2509.12508
Instructions to use FunAudioLLM/Fun-ASR-Nano-2512-hf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use FunAudioLLM/Fun-ASR-Nano-2512-hf with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="FunAudioLLM/Fun-ASR-Nano-2512-hf")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("FunAudioLLM/Fun-ASR-Nano-2512-hf") model = AutoModelForMultimodalLM.from_pretrained("FunAudioLLM/Fun-ASR-Nano-2512-hf", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add `{% generation %}` blocks to the chat template for training
#5
by bezzam HF Staff - opened
- chat_template.jinja +2 -2
chat_template.jinja
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
{% for message in messages %}{% if loop.first and message['role'] != 'system' %}<|im_start|>system
|
| 2 |
You are a helpful assistant.<|im_end|>
|
| 3 |
{% endif %}<|im_start|>{{ message['role'] }}
|
| 4 |
-
{% if message['content'] is string %}{{ message['content'] }}<|im_end|>
|
| 5 |
{% else %}{% set audio_items = message['content'] | selectattr('type', 'equalto', 'audio') | list %}{% if message['role'] == 'user' and audio_items %}{% set text_items = message['content'] | selectattr('type', 'equalto', 'text') | list %}{% set keyword_items = message['content'] | selectattr('type', 'equalto', 'keywords') | list %}{% set language_items = message['content'] | selectattr('type', 'equalto', 'language') | list %}{% if text_items or keyword_items %}请结合上下文信息,更加准确地完成语音转写任务。如果没有相关信息,我们会留空。
|
| 6 |
|
| 7 |
|
|
@@ -11,5 +11,5 @@ You are a helpful assistant.<|im_end|>
|
|
| 11 |
{% for item in text_items %}{{ item['text'] }}
|
| 12 |
{% endfor %}{% set keyword_namespace = namespace(items=[]) %}{% for item in keyword_items %}{% set keyword_namespace.items = keyword_namespace.items + item['keywords'] %}{% endfor %}{% if keyword_namespace.items %}热词列表:[{{ keyword_namespace.items | join(', ') }}]
|
| 13 |
{% endif %}{% endif %}语音转写{% if language_items %}成{{ language_items[0]['language'] }}{% endif %}:{% for content in audio_items %}<|object_ref_start|>{% endfor %}{% else %}{% for content in message['content'] %}{% if content['type'] == 'audio' %}<|object_ref_start|>{% elif content['type'] == 'text' %}{{ content['text'] }}{% endif %}{% endfor %}{% endif %}<|im_end|>
|
| 14 |
-
{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant
|
| 15 |
{% endif %}
|
|
|
|
| 1 |
{% for message in messages %}{% if loop.first and message['role'] != 'system' %}<|im_start|>system
|
| 2 |
You are a helpful assistant.<|im_end|>
|
| 3 |
{% endif %}<|im_start|>{{ message['role'] }}
|
| 4 |
+
{% set turn %}{% if message['content'] is string %}{{ message['content'] }}<|im_end|>
|
| 5 |
{% else %}{% set audio_items = message['content'] | selectattr('type', 'equalto', 'audio') | list %}{% if message['role'] == 'user' and audio_items %}{% set text_items = message['content'] | selectattr('type', 'equalto', 'text') | list %}{% set keyword_items = message['content'] | selectattr('type', 'equalto', 'keywords') | list %}{% set language_items = message['content'] | selectattr('type', 'equalto', 'language') | list %}{% if text_items or keyword_items %}请结合上下文信息,更加准确地完成语音转写任务。如果没有相关信息,我们会留空。
|
| 6 |
|
| 7 |
|
|
|
|
| 11 |
{% for item in text_items %}{{ item['text'] }}
|
| 12 |
{% endfor %}{% set keyword_namespace = namespace(items=[]) %}{% for item in keyword_items %}{% set keyword_namespace.items = keyword_namespace.items + item['keywords'] %}{% endfor %}{% if keyword_namespace.items %}热词列表:[{{ keyword_namespace.items | join(', ') }}]
|
| 13 |
{% endif %}{% endif %}语音转写{% if language_items %}成{{ language_items[0]['language'] }}{% endif %}:{% for content in audio_items %}<|object_ref_start|>{% endfor %}{% else %}{% for content in message['content'] %}{% if content['type'] == 'audio' %}<|object_ref_start|>{% elif content['type'] == 'text' %}{{ content['text'] }}{% endif %}{% endfor %}{% endif %}<|im_end|>
|
| 14 |
+
{% endif %}{% endset %}{% if message['role'] == 'assistant' %}{% generation %}{{ turn }}{% endgeneration %}{% else %}{{ turn }}{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant
|
| 15 |
{% endif %}
|