$ show FireRedTeam/FireRedASR
FireRedASR is an open-source industrial-grade automatic speech recognition (ASR) system supporting Mandarin, Chinese dialects, and English. It provides two model variants: FireRedASR-AED (Attention-based Encoder-Decoder with Conformer encoder and Transformer decoder) and FireRedASR-LLM (Encoder-Adapter-LLM framework leveraging Qwen2-7B). The codebase includes a CLI tool (`speech2text.py`), a Python API (`FireRedAsr`), feature extraction (fbank with CMVN), tokenization (mixed Chinese/English SentencePiece), and utilities for WER computation. It also includes a complete Triton Inference Server deployment with TensorRT-LLM acceleration for the AED model, with Docker support and benchmarking scripts. The architecture is modular: data preprocessing, model definitions, tokenizers, and inference orchestration are cleanly separated, though the model components are tightly coupled to the specific architectures. The repository is actively maintained with recent commits and demonstrates strong engineering craftsmanship in both the core ASR implementation and the production-grade deployment stack.
The LLM identified 4 files worth highlighting for reuse:
Provides ASRFeatExtractor, CMVN, and KaldifeatFbank classes for extracting 80-dimensional log Mel-filterbank features from audio with optional Kaldi-style CMVN normalization. The implementation is self-contained (only depends on kaldi_native_fbank, kaldiio, numpy, torch) and can be reused in any ASR pipeline. The CMVN class correctly handles variance flooring and reads Kaldi-format stats files. The KaldifeatFbank wraps the efficient kaldi_native_fbank C++ backend with configurable parameters. This is a well-engineered, reusable audio frontend.
Implements a bidirectional token-to-id dictionary (TokenDict) with support for unknown tokens and Kaldi-style dictionary files. It handles edge cases like empty lines, <space> tokens, and provides get() with defaults. The class is generic, has no internal dependencies beyond logging, and can be extracted into any NLP or ASR project requiring vocabulary management.
ChineseCharEnglishSpmTokenizer handles mixed Chinese character and English word tokenization. Chinese characters are kept as single tokens; English words are split via SentencePiece; spaces between Chinese are ignored, while English spaces are represented by the SPM space token. It uses the TokenDict for ID mapping. The detokenization correctly reconstructs text by replacing SPM space with regular space. This pattern is directly reusable for any bilingual or Chinese-English ASR system.
A comprehensive Word Error Rate (WER) computation tool that implements minimum edit distance with configurable substitution/deletion/insertion costs, backtracing for detailed alignment, and per-utterance statistics. It handles text normalization (optional cn2an for digits), punctuation removal, and provides separate English/digit accuracy stats. The WerInfo, WerStats, and EnDigStats classes are well-structured and can be reused in any ASR evaluation pipeline without modification.