How yeyupiaoling/masr works
MASR is a PyTorch speech-recognition framework supporting model training and evaluation, plus offline, long-audio, streaming, diarization-oriented, GUI, and server inference. The central workflow prepares audio and text into features and tokens, trains or loads an acoustic model, decodes its output, and returns recognized text. The graph includes documented capabilities whose detailed wiring is not visible in the sampled excerpts; those links are omitted where callers cannot be verified.
Main entry points: trainer.py Training and evaluation · reader.py Dataset reader · inference_predictor.py Inference predictor · infer_path.py Path inference
Components 24
Data preparation
- Dataset preparation
download_data - Audio manifests
create_data.py - Dataset reader
masr/data_utils/reader.py - Feature extraction
masr/data_utils/audio_featurizer.py - Text tokenization
masr/data_utils/tokenizer.py - Batch preparation
masr/data_utils/collate_fn.py
Model learning
- Training and evaluation
masr/trainer.py - Training entry
train.py - Acoustic model families
masr/model_utils - Training losses
masr/model_utils/loss - Model checkpoints
masr/utils/checkpoint.py - Recognition metrics
eval.py - Model export
export_model.py
Recognition runtime
- Inference predictor
masr/infer_utils/inference_predictor.py - CTC and attention decoders
masr/decoders - Beam search language model
masr/decoders/beam_search_decoder.py - Punctuation prediction
masr/infer_utils/punc_predictor.py
Inference interfaces
- Path inference
infer_path.py - Streaming inference
infer_sd_asr.py - Inference server
infer_server.py - GUI inference
infer_gui.py
Other components
- Audio user
- Browser recorder
static/record.js - Recognized text
Connections 29
- Audio user → Path inference: provides audio
- Audio user → Streaming inference: provides audio
- Audio user → GUI inference: provides audio
- Dataset preparation → Audio manifests: writes manifests
- Audio manifests → Dataset reader: supplies examples
- Dataset reader → Feature extraction: extracts features
- Dataset reader → Text tokenization: encodes transcripts
- Dataset reader → Batch preparation: provides samples
- Training entry → Training and evaluation: starts training
- Training and evaluation → Dataset reader: builds datasets
- Training and evaluation → Batch preparation: batches samples
- Training and evaluation → Acoustic model families: constructs model
- Training and evaluation → Training losses: computes loss
- Training and evaluation → Model checkpoints: saves and loads
- Recognition metrics → Training and evaluation: evaluates model
- Model export → Acoustic model families: exports model
- Path inference → Inference predictor: runs inference
- Streaming inference → Inference predictor: runs chunks
- GUI inference → Inference predictor: runs inference
- Inference server → Inference predictor: runs inference
- Browser recorder → Inference server: sends audio
- Inference predictor → CTC and attention decoders: decodes probabilities
- CTC and attention decoders → Beam search language model: scores hypotheses
- Path inference → Punctuation prediction: adds punctuation
- Inference server → Punctuation prediction: adds punctuation
- Path inference → Recognized text: returns transcript
- Streaming inference → Recognized text: returns transcript
- GUI inference → Recognized text: displays transcript
- Inference server → Recognized text: returns transcript