Update README.md
Browse files123423465867108129141516171810111221131415161718192820213022232425263527282930313241333435365 unmodified lines4243445345464748495059515253541 unmodified line565758675960616218 unmodified lines81828392848586879697989910088899091929394959610597989910013 unmodified lines11411511612511711811912041 unmodified lines1621631641731651661671761681691701791711721731821741751761773 unmodified lines1811821831921931841851861871888 unmodified lines1971981992082092002012022032044 unmodified lines209210211220212---
license: apache-2.0
frameworks:- ""language:
- zh
license: apache-2.0tags:
- speech
- asr
frameworks:
- pytorch
tasks: []---
# Dolphin-Fangyan# Dolphin-CN-Dialect
[Paper](https://arxiv.org/abs/2503.20212)[Github](https://github.com/DataoceanAI/Dolphin)[Huggingface](https://huggingface.co/DataoceanAI)[Modelscope](https://www.modelscope.cn/organization/DataoceanAI)
**Dolphin-Fangyan** is a multi-dialect ASR model developed by Dataocean AI and Tsinghua University, with a strong focus on Chinese dialect recognition and real-world deployment scenarios. Compared with the previous Dolphin series, Dolphin-Fangyan introduces significant improvements in tokenizer design, dialect-balanced training, streaming capability, hotword biasing, and deployment efficiency.**Dolphin-CN-Dialect** is a multi-dialect ASR model developed by Dataocean AI and Tsinghua University, with a strong focus on Chinese dialect recognition and real-world deployment scenarios. Compared with the previous Dolphin series, Dolphin-CN-Dialect introduces significant improvements in tokenizer design, dialect-balanced training, streaming capability, hotword biasing, and deployment efficiency.
The model supports Mandarin Chinese and 22 Chinese dialects, while also maintaining multilingual ASR capability inherited from Dolphin. Dolphin-Fangyan supports both streaming and non-streaming inference, enabling practical deployment in latency-sensitive applications such as real-time transcription and industrial speech recognition systems.The model supports Mandarin Chinese and 22 Chinese dialects, while also maintaining multilingual ASR capability inherited from Dolphin. Dolphin-CN-Dialect supports both streaming and non-streaming inference, enabling practical deployment in latency-sensitive applications such as real-time transcription and industrial speech recognition systems.
## Approach
Dolphin-Fangyan is built upon the Dolphin architecture and follows a joint CTC-Attention framework with:Dolphin-CN-Dialect is built upon the Dolphin architecture and follows a joint CTC-Attention framework with:
* Encoder: E-Branchformer* Decoder: Transformer Decoder* Training Objective: Joint CTC + Attention loss
Compared to Dolphin, Dolphin-Fangyan introduces several important improvements:Compared to Dolphin, Dolphin-CN-Dialect introduces several important improvements:
* Temperature-based data sampling for balancing standard Mandarin and low-resource dialects* Redesigned tokenizer with:5 unmodified lines * encoder-level contextual biasing * prompt-based decoder biasing
Experimental results show that Dolphin-Fangyan achieves:Experimental results show that Dolphin-CN-Dialect achieves:
* 38% improvement in dialect recognition accuracy* 16.3% relative CER reduction over Dolphin* Competitive performance with recent large-scale ASR systems while maintaining a smaller model size

See details in the [Paper](https://arxiv.org/abs/2503.20212).1 unmodified line
## Setup
Dolphin-Fangyan requires FFmpeg to convert audio files into WAV format. Please install FFmpeg first if it is not already installed on your system.Dolphin-CN-Dialect requires FFmpeg to convert audio files into WAV format. Please install FFmpeg first if it is not already installed on your system.
```shell# Ubuntu / Debian18 unmodified lines
## Available Models
Currently, Dolphin-Fangyan provides multiple model sizes optimized for different deployment scenarios.Currently, Dolphin-CN-Dialect provides multiple model sizes optimized for different deployment scenarios.
| Model | Parameters | Hotwords ||:------:|:----------:|:----------:|| base.fangyan | 0.1 B | ❌ || base.fangyan.streaming | 0.1 B |❌ || small.fangyan | 0.4 B | Encoder-biased Hotwords || small.fangyan.streaming | 0.4 B | Encoder-biased Hotwords || small.fangyan.prompt | 0.4 B | Prompt-based Hotwords || base.cn | 0.1 B | ❌ || base.cn.streaming | 0.1 B |❌ || small.cn | 0.4 B | Encoder-biased Hotwords || small.cn.streaming | 0.4 B | Encoder-biased Hotwords || small.cn.prompt | 0.4 B | Prompt-based Hotwords |
## Hotword Biasing
Dolphin-Fangyan supports two hotword biasing approaches.Dolphin-CN-Dialect supports two hotword biasing approaches.
**Encoder-Level Contextual Biasing**
13 unmodified lines
## Supported Languages and Dialects
Dolphin-Fangyan primarily focuses on:Dolphin-CN-Dialect primarily focuses on:
* Mandarin Chinese* 22 Chinese dialects41 unmodified linesdolphin audio.wav
# Download model and specify the model pathdolphin audio.wav --model small.fangyan --model_dir /data/models/dolphin/dolphin audio.wav --model small.cn --model_dir /data/models/dolphin/
# Specify language and regiondolphin audio.wav --model small.fangyan --model_dir /data/models/dolphin/ --lang_sym "zh" --region_sym "CN"dolphin audio.wav --model small.cn --model_dir /data/models/dolphin/ --lang_sym "zh" --region_sym "CN"
# Specify the hotwords file with Encoder-biased methoddolphin audio.wav --model small.fangyan --model_dir /data/models/dolphin/ --hotword_list_path hotwords.txt --use_deep_biasing truedolphin audio.wav --model small.cn --model_dir /data/models/dolphin/ --hotword_list_path hotwords.txt --use_deep_biasing true
# Using prompt-based modeldolphin audio.wav --model small.fangyan.prompt --model_dir /data/models/dolphin/ --hotword_list_path hotwords.txt --use_prompt_hotword true --use_two_stage_filter truedolphin audio.wav --model small.cn.prompt --model_dir /data/models/dolphin/ --hotword_list_path hotwords.txt --use_prompt_hotword true --use_two_stage_filter true
```
3 unmodified linesimport dolphinfrom dolphin import transcribe
model_name = 'small.fangyan'model = dolphin.load_model(model_name, f"/data/models/dolphin/{model_name}", "cuda")model_name = 'small.cn'model = dolphin.load_model(model_name, device="cuda")
result = transcribe(model, 'audio.wav')print(result.text)8 unmodified lines
## prompt-based hotwords
model_name = 'small.fangyan.prompt'model = dolphin.load_model(model_name, f"/data/models/dolphin/{model_name}", "cuda")model_name = 'small.cn.prompt'model = dolphin.load_model(model_name, device="cuda")
result = transcribe(model, 'audio.wav', hotwords=['诺香丹青牌科研胶囊'], use_prompt_hotword=True, use_two_stage_filter=True, decoding_method='attention')
4 unmodified lines
## License
Dolphin-Fangyan is released under the Apache 2.0 License.Dolphin-CN-Dialect is released under the Apache 2.0 License.README.md+29-37