从 GitHub 安装需先执行 pip install -r requirements.txt 再 pip install --editable .;预训练模型推理时会从 HuggingFace 下载权重到 savedir 指定目录;训练配方需先 cd 到对应 recipes/// 目录再运行实验脚本
speechbrain
speechbrainApache-2.0活跃维护基于 PyTorch 的开源语音工具包,覆盖语音识别、说话人识别与分离、语音增强等任务,提供预训练模型和训练流程,方便快速搭建语音系统。
A PyTorch-based Speech Toolkit
pip install speechbrainREADME 未说明
基于 PyTorch 的开源语音工具包,覆盖识别、分离、增强、合成等对话式 AI 任务
基于 PyTorch 的开源语音工具包,覆盖语音识别、说话人识别与分离、语音增强等任务,提供预训练模型和训练流程,方便快速搭建语音系统。
核心能力
- 提供 200+ 训练配方,覆盖 40+ 数据集与 20 项语音文本任务
- 支持 Whisper、Wav2Vec2、HuBERT、Llama2 等预训练模型微调
- HuggingFace 上 100+ 预训练模型,三行代码即可推理
- 用 YAML 配置超参数,各任务保持一致的代码结构
- 内置 30+ 教程与可运行文档示例
容易踩的坑
- v1.1.2最新正式版2026-10-14 · 2026-10-14 23:27 UTC
Notable changes
- Minimum version of the
torchandtorchaudiodependencies are now2.7.1for better device management, see #3099 and #3080 - A regression in training time due to the speed perturb augmentation was fixed (gianfranco) #3100
- A regression in packaging added several irrelevant modules to the pypi artifacts, this has been fixed (Kayvan Zahiri) #3088
Bug Fixes
- use parametrizations.weight_norm to silence deprecation warning (li-lizhe) #3087
- transformer: enforce max_len in make_transformer_src_tgt_masks (Luchang Jiang) #3086
- Fix fetch() returning a missing path with COPY_SKIP_CACHE and save_filename (sungbin1015) #3093
- Fix get_all_files dropping files listed after an exclude_and match (sungbin1015) #3101
- Fix TextEncoder.limited_labelset_from_iterable ignoring n_most_common and min_count (sungbin1015) #3095
Documentation
- clarify channelwise behavior of CumulativeLayerNorm #3105
New Contributors
- @li-lizhe made their first contribution in https://github.com/speechbrain/speechbrain/pull/3080
- @sungbin1015 made their first contribution in https://github.com/speechbrain/speechbrain/pull/3093
- @Kayvan-Zahiri made their first contribution in https://github.com/speechbrain/speechbrain/pull/3088
- @FinalSunFlower made their first contribution in https://github.com/speechbrain/speechbrain/pull/3086
- @j45856021-dev made their first contribution in https://github.com/speechbrain/speechbrain/pull/3105
Full Changelog: https://github.com/speechbrain/speechbrain/compare/v1.1.1...v1.1.2
- Minimum version of the
- v1.1.12026-08-27 · 2026-08-27 13:52 UTC
查看更新说明
Recipes
Documentation
- fix incorrect parameter description in load_data_json (#3053) #3053 (Bimochan raj kunwar)
- [830d601]: add markdown files for agentic models (#3048) (Adel Moumen) #3048
Security
Bug Fixes
- mel_spectogram should be mel_spectrogram (#3063) #3063 (Access)
- Windows-incompatible python's inspect file guard in LazyModule (#3065) #3065 (Need-an-AwP)
- Decoder input tensor dimension error (#3049) #3049 (Paras)
- [9c826ef]: Add hooks to ensure saving of kmeans model works correctly (#3047) (Peter Plantinga) #3047
- [8a89eba]: Fix device handling for MPS (#3055) (flexthink) #3055
- [d0d15bb]: Fix incorrect documented defaults for HF wrapper freeze/output_norm (#3060) (#3062) (Deeksha Manjunath) #3062
- [e5cb1f6]: Fix #3033: Fix closure variable bug in classification_error (#3061) (Nandana Dileep) #3061
- [841e205]: Fix LoRA adapter support for convolutional layers (fixes #3056) (#3064) (oly) #3064
- [dff42ee]: fix float columns being converted to string in from_csv (#3043) (Novikov Kirill) #3043
- [d9ee175]: Fix LengthsCapable containers dropping lengths for wav_lens-named layers (fixes #2986) (#3068) (oly) #3068
- [825d024]: Fixed TransformerST bug with ASR masks (#2984) (Filip Gębala) #2984
- v1.1.02026-03-30 · 2026-03-30 14:41 UTC
查看更新说明
This major release extends SpeechBrain's support for SpeechLLMs and introduces several new features, recipes, and improvements.
Highlights
- Feature Caching — Save extracted features (e.g. wav2vec embeddings) to disk and load them on the fly, skipping recomputation. This powers our first ASR SpeechLLM recipe on LibriSpeech, enabling LLM-based training with pre-computed embeddings.
- New Recipes — SpeechLLM for ASR and translation, streaming SSL, FocalCodec, and SENSE models.
Along with internal improvements and bug fixes. Here follows a changelog of the main changes (omitting some minor bugfixes):
What's Changed
- Reforging LLaMA lobe (code from Samsung AI Center-Cambridge) by @TParcollet in https://github.com/speechbrain/speechbrain/pull/2850
- Streaming recipe for BestRQ by @Chaanks in https://github.com/speechbrain/speechbrain/pull/2790
- Librilight data preparation for SpeechBrain SSL (code from Samsung AI Center Cambridge) by @shucongzhang in https://github.com/speechbrain/speechbrain/pull/2765
- Alignment with CTC ASR models powered by k2. by @ZhaoZeyu1995 in https://github.com/speechbrain/speechbrain/pull/2772
- SpeechLLM (with LLaMA) and Conformer recipe for speech translation on CoVoST (Code from Samsung AI Center Cambridge) by @TParcollet in https://github.com/speechbrain/speechbrain/pull/2865
- Feature caching proposal: CachedDynamicItem by @pplantinga in https://github.com/speechbrain/speechbrain/pull/2985
- Adapting transducer greedy decoding by @younessdkhissi in https://github.com/speechbrain/speechbrain/pull/2975
- Replace torchaudio I/O with soundfile-based audio_io wrapper by @Copilot in https://github.com/speechbrain/speechbrain/pull/2989
- FocalCodec [NeurIPS 2025] by @lucadellalib in https://github.com/speechbrain/speechbrain/pull/3000
- Caching: add compression + filename + closing/loading by @Adel-Moumen in https://github.com/speechbrain/speechbrain/pull/3005
- Implement per-key padding configuration in PaddedBatch by @Adel-Moumen in https://github.com/speechbrain/speechbrain/pull/3008
- SpeechLLM LibriSpeech recipe by @Adel-Moumen in https://github.com/speechbrain/speechbrain/pull/2885
- Remove CTC CUDA + Move transducer loss in integrations by @Adel-Moumen in https://github.com/speechbrain/speechbrain/pull/3028
- Adding SENSE models by @MaryemBouziane in https://github.com/speechbrain/speechbrain/pull/2998
New Contributors
- @emmanuel-ferdman made their first contribution in https://github.com/speechbrain/speechbrain/pull/2900
- @ofiryaish made their first contribution in https://github.com/speechbrain/speechbrain/pull/2871
- @omidiu made their first contribution in https://github.com/speechbrain/speechbrain/pull/2923
- @svecjan made their first contribution in https://github.com/speechbrain/speechbrain/pull/2934
- @nouranali made their first contribution in https://github.com/speechbrain/speechbrain/pull/2855
- @OscarFree made their first contribution in https://github.com/speechbrain/speechbrain/pull/2988
- @younessdkhissi made their first contribution in https://github.com/speechbrain/speechbrain/pull/2975
- @jordanozang made their first contribution in https://github.com/speechbrain/speechbrain/pull/2982
- @jrochdi made their first contribution in https://github.com/speechbrain/speechbrain/pull/2947
- @seohyunjun made their first contribution in https://github.com/speechbrain/speechbrain/pull/2996
- @Daheer made their first contribution in https://github.com/speechbrain/speechbrain/pull/3022
- @raotnameh made their first contribution in https://github.com/speechbrain/speechbrain/pull/2617
- @Mr-Neutr0n made their first contribution in https://github.com/speechbrain/speechbrain/pull/3029
- @georgesabr made their first contribution in https://github.com/speechbrain/speechbrain/pull/3038
- @MaryemBouziane made their first contribution in https://github.com/speechbrain/speechbrain/pull/2998
Full Changelog: https://github.com/speechbrain/spe
- v1.0.32025-04-07 · 2025-04-07 17:05 UTC
查看更新说明
Major Changes
- Add People's Speech (30,000 hours) Conformer ASR (Code from Samsung AI Center Cambridge) by @TParcollet in https://github.com/speechbrain/speechbrain/pull/2767
- Audio and Music SSL by @poonehmousavi in https://github.com/speechbrain/speechbrain/pull/2755
- Add new Audio Tokenziers by @poonehmousavi in https://github.com/speechbrain/speechbrain/pull/2751
- Libriheavy (Code from SAIC-Cambridge) by @shucongzhang in https://github.com/speechbrain/speechbrain/pull/2781
- Conformer recipe for LargeScaleASR (code from Samsung AI Center Cambridge) by @TParcollet in https://github.com/speechbrain/speechbrain/pull/2806
- Rotary Position Embedding (RoPE) for ASR (code from Samsung Cambridge) by @shucongzhang in https://github.com/speechbrain/speechbrain/pull/2799
- Voice analysis functions by @pplantinga in https://github.com/speechbrain/speechbrain/pull/2689
New Contributors
- @rogiervd made their first contribution in https://github.com/speechbrain/speechbrain/pull/2734
- @benniekiss made their first contribution in https://github.com/speechbrain/speechbrain/pull/2746
- @mirofedurco made their first contribution in https://github.com/speechbrain/speechbrain/pull/2762
- @kit1980 made their first contribution in https://github.com/speechbrain/speechbrain/pull/2797
- @IliasMAOUDJ made their first contribution in https://github.com/speechbrain/speechbrain/pull/2574
Full Changelog: https://github.com/speechbrain/speechbrain/compare/v1.0.2...v1.0.3
- v1.0.22024-10-31 · 2024-10-31 10:06 UTC
查看更新说明
This is a minor update which includes some new features and recipes, internal improvements, bugfixes and improved tutorials.
Here follows a changelog of the main changes (omitting some minor bugfixes):
Notable changes
- Added support for Adapters, see new tutorial (#2563)
- Added BEST-RQ with a recipe for LibriSpeech (#2309)
- Added GigaSpeech recipes for ASR, with a Conformer RNN-T and WavLM CTC (#2421)
- Overhauled
fetchandPretrained, greatly reducing the use of symlinks out of the box as much as possible (see down below) - Migrated all tutorials to the SpeechBrain repository, merged them into the main docs, improved documentation (updated outdated information, broken links, etc.).
- Added new tutorials:
- TensorFloat32 is now enabled by default when available (#2682)
New features
- Added layer dropout support for TransformerASR (#2309)
- Added the sign flip augmentation for ASR/EEG/potentially more (#2636)
- Improved reproducibility by adding
seed_everything, improved DDP handling for seeding (#2654) - Added "quirks" to centralize overriden PyTorch defaults and workarounds (among other things) in an easy-to-find fashion, with proper logging (#2558)
Bugfixes
- Improved performance for VAD inference (#2683)
- Fixed various issues with DDP handling (#2682)
- Fixed broken augmentation integration tests (#2628)
- Fixed error when processing newer CommonVoice (#2647)
- Fixed concat bug in augmentation (#2717)
- Removed EOS in G2P inference which was incorrectly introduced (#2718)
- ... and some more
New
fetching semanticsWe have made a number of changes that affect how
fetchworks, and this affects various things in a way you should be aware of.- In various fetching-related code, such as inference interfaces'
from_hparams, thesavedirrefers to the directory where files should be collected. It is now optional and defaults toNone.- When fetching files (models, audio, etc.) from local paths or HuggingFace repositories, you no longer need to specify a target directory.
- For local file fetching, the path is returned directly.
- For HF fetching, HF cache is used directly.
- For URL fetching, you still need to specify the
savedir.
- Inference interfaces will no longer pollute your working directory with symlinks by default when loading audio files.
- Avoiding symlink creation by default is now much friendlier to Windows compatibility. We also added some warnings to help.
- If you do specify a
savedir, behavior should be largely unchanged (although more robust).
- When fetching files (models, audio, etc.) from local paths or HuggingFace repositories, you no longer need to specify a target directory.
- In various fetching-related code, you can now specify a
fetch_strategy.- The fetching strategy dictates what to do when a file is found locally, but not in the desired
savedir. For instance, if some model file is available in HuggingFace cache, you can now choose between copying, symlinking or not linking the file in thesavedir.
- The fetching strategy dictates what to do when a file is found locally, but not in the desired
fetchnow has anallow_networkparameter, which defaults toTrue. When disabled, this fails if the URI is not available locally, or if the file isn't found locally in HF cache.fetchalso now has anallow_updatesparameter, which defaults toTrue. It interrogates HF even if a local path is present in order to update any model files (or switch revisions), if required.
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
| 📘 Tutorials | 🌐 Website | 📚 Documentation | 🤝 Contributing | 🤗 HuggingFace | ▶️ YouTube | 🐦 X |
Please, help our community project. Star on GitHub!
Exciting News (January, 2024): Discover what is new in SpeechBrain 1.0 here!
🗣️💬 What SpeechBrain Offers
-
SpeechBrain is an open-source PyTorch toolkit that accelerates Conversational AI development, i.e., the technology behind speech assistants, chatbots, and large language models.
-
It is crafted for fast and easy creation of advanced technologies for Speech and Text Processing.
🌐 Vision
-
With the rise of deep learning, once-distant domains like speech processing and NLP are now very close. A well-designed neural network and large datasets are all you need.
-
We think it is now time for a holistic toolkit that, mimicking the human brain, jointly supports diverse technologies for complex Conversational AI systems.
-
This spans speech recognition, speaker recognition, speech enhancement, speech separation, language modeling, dialogue, and beyond.
-
Aligned with our long-term goal of natural human-machine conversation, including for non-verbal individuals, we have recently added support for the EEG modality.
📚 Training Recipes
-
We share over 200 competitive training recipes on more than 40 datasets supporting 20 speech and text processing tasks (see below).
-
We support both training from scratch and fine-tuning pretrained models such as Whisper, Wav2Vec2, WavLM, Hubert, GPT2, Llama2, and beyond. The models on HuggingFace can be easily plugged in and fine-tuned.
-
For any task, you train the model using these commands:
python train.py hparams/train.yaml
-
The hyperparameters are encapsulated in a YAML file, while the training process is orchestrated through a Python script.
-
We maintained a consistent code structure across different tasks.
-
For better replicability, training logs and checkpoints are hosted on Dropbox.
Pretrained Models and Inference
- Access over 100 pretrained models hosted on HuggingFace.
- Each model comes with a user-friendly interface for seamless inference. For example, transcribing speech using a pretrained model requires just three lines of code:
from speechbrain.inference import EncoderDecoderASR
asr_model = EncoderDecoderASR.from_hparams(source="speechbrain/asr-conformer-transformerlm-librispeech", savedir="pretrained_models/asr-transformer-transformerlm-librispeech")
asr_model.transcribe_file("speechbrain/asr-conformer-transformerlm-librispeech/example.wav")
Documentation
- We are deeply dedicated to promoting inclusivity and education.
- We have authored over 30 tutorials that not only describe how SpeechBrain works but also help users familiarize themselves with Conversational AI.
- Every class or function has clear explanations and examples that you can run. Check out the documentation for more details 📚.
🎯 Use Cases
-
🚀 Research Acceleration: Speeding up academic and industrial research. You can develop and integrate new models effortlessly, comparing their performance against our baselines.
-
⚡️ Rapid Prototyping: Ideal for quick prototyping in time-sensitive projects.
-
🎓 Educational Tool: SpeechBrain's simplicity makes it a valuable educational resource. It is used by institutions like Mila, Concordia University, Avignon University, and many others for student training.
🚀 Quick Start
To get started with SpeechBrain, follow these simple steps:
🛠️ Installation
Install via PyPI
-
Install SpeechBrain using PyPI:
pip install speechbrain -
Access SpeechBrain in your Python code:
import speechbrain as sb
Install from GitHub
This installation is recommended for users who wish to conduct experiments and customize the toolkit according to their needs.
-
Clone the GitHub repository and install the requirements:
git clone https://github.com/speechbrain/speechbrain.git cd speechbrain pip install -r requirements.txt pip install --editable . -
Access SpeechBrain in your Python code:
import speechbrain as sb
Any modifications made to the speechbrain package will be automatically reflected, thanks to the --editable flag.
✔️ Test Installation
Ensure your installation is correct by running the following commands:
pytest tests
pytest --doctest-modules speechbrain
🏃♂️ Running an Experiment
In SpeechBrain, you can train a model for any task using the following steps:
cd recipes/<dataset>/<task>/
python experiment.py params.yaml
The results will be saved in the output_folder specified in the YAML file.
📘 Learning SpeechBrain
-
Website: Explore general information on the official website.
-
Tutorials: Start with basic tutorials covering fundamental functionalities. Find advanced tutorials and topics in the Tutorial notebooks category in the SpeechBrain documentation.
-
Documentation: Detailed information on the SpeechBrain API, contribution guidelines, and code is available in the documentation.
🔧 Supported Technologies
- SpeechBrain is a versatile framework designed for implementing a wide range of technologies within the field of Conversational AI.
- It excels not only in individual task implementations but also in combining various technologies into complex pipelines.
🎙️ Speech/Audio Processing
📝 Text Processing
| Tasks | Datasets | Technologies/Models |
|---|---|---|
| Language Modeling | CommonVoice, LibriSpeech | n-grams, RNNLM, TransformerLM |
| Response Generation | MultiWOZ | GPT2, Llama2 |
| Grapheme-to-Phoneme | LibriSpeech | RNN, Transformer, Curriculum Learning, Homograph loss |
🧠 EEG Processing
| Tasks | Datasets | Technologies/Models |
|---|---|---|
| Motor Imagery | BNCI2014001, BNCI2014004, BNCI2015001, Lee2019_MI, Zhou201 | EEGNet, ShallowConvNet, EEGConformer |
| P300 | BNCI2014009, EPFLP300, bi2015a, | EEGNet |
| SSVEP | Lee2019_SSVEP | EEGNet |
🔍 Additional Features
SpeechBrain includes a range of native functionalities that enhance the development of Conversational AI technologies. Here are some examples:
-
Training Orchestration: The
Brainclass serves as a fully customizable tool for managing training and evaluation loops over data. It simplifies training loops while providing the flexibility to override any part of the process. -
Hyperparameter Management: A YAML-based hyperparameter file specifies all hyperparameters, from individual numbers (e.g., learning rate) to complete objects (e.g., custom models). This elegant solution drastically simplifies the training script.
-
Dynamic Dataloader: Enables flexible and efficient data reading.
-
GPU Training: Supports single and multi-GPU training, including distributed training.
-
Dynamic Batching: On-the-fly dynamic batching enhances the efficient processing of variable-length signals.
-
Mixed-Precision Training: Accelerates training through mixed-precision techniques.
-
Efficient Data Reading: Reads large datasets efficiently from a shared Network File System (NFS) via WebDataset.
-
Hugging Face Integration: Interfaces seamlessly with HuggingFace for popular models such as wav2vec2 and Hubert.
-
Orion Integration: Interfaces with Orion for hyperparameter tuning.
-
Speech Augmentation Techniques: Includes SpecAugment, Noise, Reverberation, and more.
-
Data Preparation Scripts: Includes scripts for preparing data for supported datasets.
SpeechBrain is rapidly evolving, with ongoing efforts to support a growing array of technologies in the future.
📊 Performance
-
SpeechBrain integrates a variety of technologies, including those that achieves competitive or state-of-the-art performance.
-
For a comprehensive overview of the achieved performance across different tasks, datasets, and technologies, please visit here.
📜 License
- SpeechBrain is released under the Apache License, version 2.0, a popular BSD-like license.
- You are free to redistribute SpeechBrain for both free and commercial purposes, with the condition of retaining license headers. Unlike the GPL, the Apache License is not viral, meaning you are not obligated to release modifications to the source code.
🔮Future Plans
We have ambitious plans for the future, with a focus on the following priorities:
-
Scale Up: We aim to provide comprehensive recipes and technologies for training massive models on extensive datasets.
-
Scale Down: While scaling up delivers unprecedented performance, we recognize the challenges of deploying large models in production scenarios. We are focusing on real-time, streamable, and small-footprint Conversational AI.
-
Multimodal Large Language Models: We envision a future where a single foundation model can handle a wide range of text, speech, and audio tasks. Our core team is focused on enabling the training of advanced multimodal LLMs.
🤝 Contributing
- SpeechBrain is a community-driven project, led by a core team with the support of numerous international collaborators.
- We welcome contributions and ideas from the community. For more information, check here.
🙏 Sponsors
- SpeechBrain is an academically driven project and relies on the passion and enthusiasm of its contributors.
- As we cannot rely on the resources of a large company, we deeply appreciate any form of support, including donations or collaboration with the core team.
- If you're interested in sponsoring SpeechBrain, please reach out to us at [email protected].
- A heartfelt thank you to all our sponsors, including the current ones:
📖 Citing SpeechBrain
If you use SpeechBrain in your research or business, please cite it using the following BibTeX entry:
@article{speechbrain_v1,
author = {Mirco Ravanelli and Titouan Parcollet and Adel Moumen and Sylvain de Langen and Cem Subakan and Peter Plantinga and Yingzhi Wang and Pooneh Mousavi and Luca Della Libera and Artem Ploujnikov and Francesco Paissan and Davide Borra and Salah Zaiem and Zeyu Zhao and Shucong Zhang and Georgios Karakasidis and Sung-Lin Yeh and Pierre Champion and Aku Rouhe and Rudolf Braun and Florian Mai and Juan Zuluaga-Gomez and Seyed Mahed Mousavi and Andreas Nautsch and Ha Nguyen and Xuechen Liu and Sangeet Sagar and Jarod Duret and Salima Mdhaffar and Ga{{\"e}}lle Laperri{{\`e}}re and Mickael Rouvier and Renato De Mori and Yannick Est{{\`e}}ve},
title = {Open-Source Conversational AI with SpeechBrain 1.0},
journal = {Journal of Machine Learning Research},
year = {2024},
volume = {25},
number = {333},
url = {http://jmlr.org/papers/v25/24-0991.html}
}
@misc{speechbrain,
title={{SpeechBrain}: A General-Purpose Speech Toolkit},
author={Mirco Ravanelli and Titouan Parcollet and Peter Plantinga and Aku Rouhe and Samuele Cornell and Loren Lugosch and Cem Subakan and Nauman Dawalatabad and Abdelwahab Heba and Jianyuan Zhong and Ju-Chieh Chou and Sung-Lin Yeh and Szu-Wei Fu and Chien-Feng Liao and Elena Rastorgueva and François Grondin and William Aris and Hwidong Na and Yan Gao and Renato De Mori and Yoshua Bengio},
year={2021},
eprint={2106.04624},
archivePrefix={arXiv},
primaryClass={eess.AS},
note={arXiv:2106.04624}
}