{"id":17157483,"url":"https://github.com/vectominist/miniasr","last_synced_at":"2025-06-27T15:06:54.842Z","repository":{"id":46596127,"uuid":"385885519","full_name":"vectominist/MiniASR","owner":"vectominist","description":"A mini, simple, and fast end-to-end automatic speech recognition toolkit.","archived":false,"fork":false,"pushed_at":"2022-12-06T20:57:31.000Z","size":350,"stargazers_count":54,"open_issues_count":1,"forks_count":6,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-06-27T15:03:55.591Z","etag":null,"topics":["asr","ctc","fairseq","hubert","minimal","pytorch","s3prl","speech-recognition","speech-representation","wav2vec2"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vectominist.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-14T09:33:16.000Z","updated_at":"2025-06-27T09:19:59.000Z","dependencies_parsed_at":"2023-01-23T15:01:58.659Z","dependency_job_id":null,"html_url":"https://github.com/vectominist/MiniASR","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vectominist/MiniASR","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vectominist%2FMiniASR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vectominist%2FMiniASR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vectominist%2FMiniASR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vectominist%2FMiniASR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vectominist","download_url":"https://codeload.github.com/vectominist/MiniASR/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vectominist%2FMiniASR/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262279099,"owners_count":23286547,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asr","ctc","fairseq","hubert","minimal","pytorch","s3prl","speech-recognition","speech-representation","wav2vec2"],"created_at":"2024-10-14T22:09:07.186Z","updated_at":"2025-06-27T15:06:54.810Z","avatar_url":"https://github.com/vectominist.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MiniASR\n\nA mini, simple, and fast end-to-end automatic speech recognition toolkit.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"logo.png\" width=\"500\"\u003e\n  \u003cbr/\u003e\n  \u003cimg alt=\"GitHub\" src=\"https://img.shields.io/github/license/vectominist/MiniASR\"\u003e\n\u003c/p\u003e\n\n## Intro\n\n### Why Mini?\n\u003c!-- * **Minimal Code** 📄  \n  Less than 1600 lines of code.\n* **Minimal Modification** ✏️  \n  Easy to customize. --\u003e\n* **Minimal Training** ⏱  \n  Self-supervised pre-trained models + minimal fine-tuning.\n* **Simple and Flexible** ⚙️  \n  Easy to understand and customize.\n* **Colab Compatible** 🧪  \n  Train your model directly on Google Colab.\n\u003c!-- * **Fast Deployment** 🚀\n  Fast fine-tuning for real-world applications. --\u003e\n\n\n### ASR Pipeline\n\n* Preprocessing (`run_preprocess.py`)\n  * Find all audio files and transcriptions.\n  * Generate vocabularies (character/word/subword/code-switched).\n* Training (`run_asr.py`)\n  * Dataset (`miniasr/data/dataset.py`)\n    * Tokenizer for text data (`miniasr/data/text.py`)\n  * DataLoader (`miniasr/data/dataloader.py`)\n  * Model (`miniasr/model/base_asr.py`)\n    * Feature extractor\n    * Data augmentation\n    * End-to-end CTC ASR\n* Testing (`run_asr.py`)\n  * CTC greedy/beam decoding\n  * Performance measures: error rates, RTF, latency\n\n\n## Instructions\n\n### Requirements\n* Python 3.6+\n* Install sox on your OS\n* Install latest [s3prl](https://github.com/s3prl/s3prl) (at least `v0.4`)\n```bash\ngit clone https://github.com/s3prl/s3prl.git\ncd s3prl\npip install -e ./\ncd ..\n```\n* Install via pip:\n```bash\npip install -e ./\n```\nAdditional libraries:\n\u003c!-- * [fairseq](https://github.com/pytorch/fairseq): to use pre-trained feature extractors like wav2vec 2.0 or HuBERT. --\u003e\n* [flashlight](https://github.com/flashlight/flashlight): to decode with LM and beam search.\n\n\n### Pre-trained ASR\nYou can directly use pre-trained ASR models for any applications. (under construction 🚧)\n```python\nfrom miniasr.utils import load_from_checkpoint\nfrom miniasr.data.audio import load_waveform\n\n# Option 1: Loading from a checkpoint\nmodel, args, tokenizer = load_from_checkpoint('path/to/ckpt', 'cuda')\n# Option 2: Loading from torch.hub (TODO)\nmodel = torch.hub.load('vectominist/MiniASR', 'ctc_eng').to('cuda')\n\n# Load waveforms and recognize!\nwaves = [load_waveform('path/to/waveform').to('cuda')]\nhyps = model.recognize(waves)\n```\n\n### Preprocessing\n* For already implemented corpora, please see `egs/`.\n* To customize your own dataset, please see `miniasr/preprocess`.\n\n\u003cdetails\u003e\u003csummary\u003eminiasr-preprocess\u003c/summary\u003e\u003cp\u003e\n\nOptions:\n```\n  --corpus Corpus name.\n  --path Path to dataset.\n  --set Which subsets to be processed.\n  --out Output directory.\n  --gen-vocab Specify whether to generate vocabulary files.\n  --char-vocab-size Character vocabulary size.\n  --word-vocab-size Word vocabulary size.\n  --subword-vocab-size Subword vocabulary size.\n  --gen-subword Specify whether to generate subword vocabulary.\n  --subword-mode {unigram,bpe} Subword training mode.\n  --char-coverage Character coverage.\n  --seed SEED Set random seed.\n  --njobs Number of workers.\n  --log-file Logging file.\n  --log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL} Logging level.\n```\n\n\u003c/p\u003e\u003c/details\u003e\n\n### Training \u0026 Testing\nSee examples in `egs/`.\n\n\u003cdetails\u003e\u003csummary\u003eminiasr-asr\u003c/summary\u003e\u003cp\u003e\n\nOptions:\n```\n  --config Training configuration file (.yaml).\n  --test Specify testing mode.\n  --ckpt Checkpoint for testing.\n  --test-name Specify testing results' name.\n  --cpu Using CPU only.\n  --seed Set random seed.\n  --njobs Number of workers.\n  --log-file Logging file.\n  --log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL} Logging level.\n```\n\n\u003c/p\u003e\u003c/details\u003e\n\n\n\u003c!-- ## Benchmark Corpora Support\nSee `egs/`.\n\n### LibriSpeech\n| Data | Extractor      | Model | Param    | Decode | test-clean | test-other |\n| ---- | -------------- | ----- | -------- | ------ | ---------- | ---------- |\n| 100h | fbank          | BLSTM | 40M      | Greedy |            |            |\n| 100h | hubert (fixed) | BLSTM | 95 + 40M | Greedy | 6.4        | 15.1       |\n| 100h | hubert (fixed) | BLSTM | 95 + 40M | LM     | 4.1        | 9.9        | --\u003e\n\n## TODO List\n* `torch.hub` support\n* Releasing pre-trained ASR models\n\n\u003c!-- ## Acknowledgements\n\nTBA --\u003e\n\n## Reference Papers\n\n* [Connectionist Temporal Classification: Labelling Unsegmented Sequence Data with Recurrent Neural Networks](https://www.cs.toronto.edu/~graves/icml_2006.pdf), Graves et al.\n* [Neural Machine Translation of Rare Words with Subword Units](https://aclanthology.org/P16-1162/), Sennrich et al.\n* [HuBERT: Self-Supervised Speech Representation Learning by Masked Prediction of Hidden Units](https://arxiv.org/abs/2106.07447), Hsu et al.\n* [SpecAugment: A Simple Data Augmentation Method for Automatic Speech Recognition](https://arxiv.org/abs/1904.08779), Park et al.\n\n\n## Reference Repos\n\n* [PyTorch](https://github.com/pytorch/pytorch)\n* [PyTorch Lightning](https://github.com/PyTorchLightning/pytorch-lightning)\n* [S3PRL](https://github.com/s3prl/s3prl)\n* [Fairseq](https://github.com/pytorch/fairseq)\n* [Flashlight](https://github.com/flashlight/flashlight)\n* [SentencePiece](https://github.com/google/sentencepiece)\n* [End-to-end-ASR-Pytorch](https://github.com/Alexander-H-Liu/End-to-end-ASR-Pytorch)\n\n\n## Citation\n\n```\n@misc{chang2021miniasr,\n  title={{MiniASR}},\n  author={Chang, Heng-Jui},\n  year={2021},\n  url={https://github.com/vectominist/MiniASR}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvectominist%2Fminiasr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvectominist%2Fminiasr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvectominist%2Fminiasr/lists"}