Automatic Speech Recognition
Transformers
Safetensors
fun_asr_nano
text-generation
speech-recognition
asr
end-to-end
multilingual
streaming
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", dtype="auto") - Notebooks
- Google Colab
- Kaggle
File size: 3,170 Bytes
9436970 3ecd9e9 4d5668e 3ecd9e9 4d5668e 9436970 e711f3d 9436970 4d5668e b8b7ac6 4d5668e | 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 | ---
language:
- zh
- en
- ja
- yue
license: apache-2.0
library_name: transformers
pipeline_tag: automatic-speech-recognition
tags:
- speech-recognition
- asr
- end-to-end
- multilingual
- streaming
---
<div align="center">
### ⭐ Powered by [FunASR](https://github.com/modelscope/FunASR) — please give us a GitHub Star!
This model is part of the **FunASR** ecosystem — one industrial-grade open-source toolkit for **ASR · VAD · punctuation · speaker diarization · emotion / event · LLM-ASR**. A Star really helps the project (and keeps you updated):
[**🌟 FunASR**](https://github.com/modelscope/FunASR) · [**🌟 SenseVoice**](https://github.com/FunAudioLLM/SenseVoice) · [**🌟 Fun-ASR**](https://github.com/FunAudioLLM/Fun-ASR) · [**🌟 FunClip**](https://github.com/modelscope/FunClip)
</div>
# Fun-ASR-Nano (Hugging Face Transformers)
This is the Hugging Face Transformers-compatible version of [Fun-ASR-Nano-2512](https://huggingface.co/FunAudioLLM/Fun-ASR-Nano-2512).
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. This checkpoint supports Chinese, English, and Japanese; its Chinese coverage includes 7 dialect groups and 26 regional accents. For 31-language recognition, use the separate [Fun-ASR-MLT-Nano-2512](https://huggingface.co/FunAudioLLM/Fun-ASR-MLT-Nano-2512) checkpoint.
## Transformers quickstart
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.
With [PyTorch installed for your platform](https://pytorch.org/get-started/locally/), install the tested PR build and the quickstart dependencies:
```bash
python -m pip install accelerate librosa \
"transformers @ https://github.com/huggingface/transformers/archive/d58b6371091473c7bd1486f3147950c6e076ace9.zip"
```
```python
import torch
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor
model_id = "FunAudioLLM/Fun-ASR-Nano-2512-hf"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForSpeechSeq2Seq.from_pretrained(
model_id,
dtype=torch.bfloat16,
device_map="auto",
)
audio_url = "https://huggingface.co/FunAudioLLM/Fun-ASR-Nano-2512/resolve/main/example/en.mp3"
inputs = processor.apply_transcription_request(audio=audio_url, return_tensors="pt").to(model.device)
generated_ids = model.generate(**inputs, max_new_tokens=200)
generated_ids = generated_ids[:, inputs.input_ids.shape[1] :]
print(processor.batch_decode(generated_ids, skip_special_tokens=True)[0])
```
Expected transcription:
```text
The tribal chieftain called for the boy, and presented him with fifty pieces of gold.
```
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).
|