Automatic Speech Recognition
Transformers
Safetensors
fun_asr_nano
text-generation
speech-recognition
asr
end-to-end
multilingual
streaming
arxiv:2407.04051
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")# Load model directly from transformers import AutoModelForSeq2SeqLM model = AutoModelForSeq2SeqLM.from_pretrained("FunAudioLLM/Fun-ASR-Nano-2512-hf", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update structured transcription chat template
Browse files- chat_template.jinja +10 -2
chat_template.jinja
CHANGED
|
@@ -2,6 +2,14 @@
|
|
| 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 %}{%
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant
|
| 7 |
-
{% endif %}
|
|
|
|
| 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 |
+
|
| 8 |
+
**上下文信息:**
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
{% if text_items %}{{ text_items[0]['text'] }}
|
| 12 |
+
{% endif %}{% if keyword_items %}热词列表:[{{ keyword_items[0]['keywords'] | 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 %}
|