--- 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 ---
### ⭐ 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)
# 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. ```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).