1 Star 0 Fork 0

create_future / speechbrain

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

SpeechBrain Logo

Tweet

SpeechBrain is an open-source and all-in-one conversational AI toolkit based on PyTorch.

The goal is to create a single, flexible, and user-friendly toolkit that can be used to easily develop state-of-the-art speech technologies, including systems for speech recognition, speaker recognition, speech enhancement, speech separation, language identification, multi-microphone signal processing, and many others.

drawing Please, star our project on github (see top-right corner) if you appreciate our contribution to the community!

SpeechBrain is currently in beta.

| Tutorials | Website | Documentation | Contributing | HuggingFace |

Key features

SpeechBrain provides various useful tools to speed up and facilitate research on speech and language technologies:

  • Various pretrained models nicely integrated with drawing (HuggingFace) in our official organization account. These models are coupled with easy-inference interfaces that facilitate their use. To help everyone replicate our results, we also provide all the experimental results and folders (including logs, training curves, etc.) in a shared Google Drive folder.
  • The Brain class is a fully-customizable tool for managing training and evaluation loops over data. The annoying details of training loops are handled for you while retaining complete flexibility to override any part of the process when needed.
  • A YAML-based hyperparameter file that specifies all the hyperparameters, from individual numbers (e.g., learning rate) to complete objects (e.g., custom models). This elegant solution dramatically simplifies the training script.
  • Multi-GPU training and inference with PyTorch Data-Parallel or Distributed Data-Parallel.
  • Mixed-precision for faster training.
  • A transparent and entirely customizable data input and output pipeline. SpeechBrain follows the PyTorch data loading style and enables users to customize the I/O pipelines (e.g., adding on-the-fly downsampling, BPE tokenization, sorting, threshold ...).
  • On-the-fly dynamic batching
  • Efficient reading of large datasets from a shared Network File System (NFS) via WebDataset.
  • Interface with HuggingFace for popular models such as wav2vec2 and Hubert.
  • Interface with Orion for hyperparameter tuning.

Speech recognition

SpeechBrain supports state-of-the-art methods for end-to-end speech recognition:

  • Support of wav2vec 2.0 pretrained model with finetuning.
  • State-of-the-art performance or comparable with other existing toolkits in several ASR benchmarks.
  • Easily customizable neural language models, including RNNLM and TransformerLM. We also share several pre-trained models that you can easily use (more to come!). We support the Hugging Face dataset to facilitate the training over a large text dataset.
  • Hybrid CTC/Attention end-to-end ASR:
    • Many available encoders: CRDNN (VGG + {LSTM,GRU,LiGRU} + DNN), ResNet, SincNet, vanilla transformers, context net-based transformers or conformers. Thanks to the flexibility of SpeechBrain, any fully customized encoder could be connected to the CTC/attention decoder and trained in a few hours of work. The decoder is fully customizable: LSTM, GRU, LiGRU, transformer, or your neural network!
    • Optimised and fast beam search on both CPUs and GPUs.
  • Transducer end-to-end ASR with both a custom Numba loss and the torchaudio one. Any encoder or decoder can be plugged into the transducer ranging from VGG+RNN+DNN to conformers.
  • Pre-trained ASR models for transcribing an audio file or extracting features for a downstream task.

Feature extraction and augmentation

SpeechBrain provides efficient (GPU-friendly) speech augmentation and feature extraction pipelines:

  • On-the-fly and fully-differentiable acoustic feature extraction: filter banks can be learned. This strategy simplifies the training pipeline (you don't have to dump features on disk).
  • On-the-fly feature normalization (global, sentence, batch, or speaker level).
  • On-the-fly environmental corruptions based on noise, reverberation, and babble for robust model training.
  • On-the-fly frequency and time domain SpecAugment with speed augmentation.
  • We support both SinConv and LEAF convolutional frontends.

Speech enhancement and separation

  • Recipes for spectral masking, spectral mapping, and time-domain speech enhancement.
  • Multiple sophisticated enhancement losses, including differentiable STOI loss, MetricGAN, and mimic loss.
  • State-of-the-art performance on speech separation with Conv-TasNet, DualPath RNN, SepFormer, and RE-SepFormer.

Speaker recognition, identification and diarization

SpeechBrain provides different models for speaker recognition, identification, and diarization on different datasets:

  • State-of-the-art performance on speaker recognition and diarization based on ECAPA-TDNN models.
  • Original Xvectors implementation (inspired by Kaldi) with PLDA.
  • Spectral clustering for speaker diarization (combined with speakers embeddings).
  • Libraries to extract speaker embeddings with a pre-trained model on your data.

Text-to-Speech (TTS) and Vocoders

  • Recipes for training TTS systems such as Tacotron2 with LJSpeech.
  • Recipes for training Vocoders such as HiFIGAN.

Grapheme-to-Phoneme (G2P)

We have models for converting characters into a sequence of phonemes. In particular, we have Transformer- and RNN-based models operating at the sentence level (i.e, converting a full sentence into a corresponding sequence of phonemes). The models are trained with both data from Wikipedia and LibriSpeech.

Language Identification

SpeechBrain provides different models for language identification. In particular, our best model is based on an ECAPA-TDNN trained with the voxlingua107 dataset.

Speech Translation

  • Recipes for transformer and conformer-based end-to-end speech translation.
  • Possibility to choose between normal training (Attention), multi-objectives (CTC+Attention), and multitasks (ST + ASR).

Self-Supervised Learning of Speech Representations

  • Recipes for wav2vec 2.0 pre-training with multiple GPUs compatible with HuggingFace models.

Multi-microphone processing

Combining multiple microphones is a powerful approach to achieving robustness in adverse acoustic environments:

  • Delay-and-sum, MVDR, and GeV beamforming.
  • Speaker localization.

Performance

The recipes released with speechbrain implement speech processing systems with competitive or state-of-the-art performance. In the following, we report the best performance achieved on some popular benchmarks:

Dataset Task System Performance
LibriSpeech Speech Recognition wav2vec2 WER=1.90% (test-clean)
LibriSpeech Speech Recognition CNN + Transformer WER=2.26% (test-clean)
TIMIT Speech Recognition CRDNN + distillation PER=13.1% (test)
TIMIT Speech Recognition wav2vec2 + CTC/Att. PER=8.04% (test)
CommonVoice (English) Speech Recognition wav2vec2 + CTC WER=15.69% (test)
CommonVoice (French) Speech Recognition wav2vec2 + CTC WER=9.96% (test)
CommonVoice (Italian) Speech Recognition wav2vec2 + seq2seq WER=9.86% (test)
CommonVoice (Kinyarwanda) Speech Recognition wav2vec2 + seq2seq WER=18.91% (test)
AISHELL (Mandarin) Speech Recognition wav2vec2 + seq2seq CER=5.58% (test)
Fisher-callhome (spanish) Speech translation conformer (ST + ASR) BLEU=48.04 (test)
VoxCeleb2 Speaker Verification ECAPA-TDNN EER=0.80% (vox1-test)
AMI Speaker Diarization ECAPA-TDNN DER=3.01% (eval)
VoiceBank Speech Enhancement MetricGAN+ PESQ=3.08 (test)
WSJ2MIX Speech Separation SepFormer SDRi=22.6 dB (test)
WSJ3MIX Speech Separation SepFormer SDRi=20.0 dB (test)
WHAM! Speech Separation SepFormer SDRi= 16.4 dB (test)
WHAMR! Speech Separation SepFormer SDRi= 14.0 dB (test)
Libri2Mix Speech Separation SepFormer SDRi= 20.6 dB (test-clean)
Libri3Mix Speech Separation SepFormer SDRi= 18.7 dB (test-clean)
LibryParty Voice Activity Detection CRDNN F-score=0.9477 (test)
IEMOCAP Emotion Recognition wav2vec Accuracy=79.8% (test)
CommonLanguage Language Recognition ECAPA-TDNN Accuracy=84.9% (test)
Timers and Such Spoken Language Understanding CRDNN Intent Accuracy=89.2% (test)
SLURP Spoken Language Understanding CRDNN Intent Accuracy=87.54% (test)
VoxLingua 107 Identification ECAPA-TDNN Sentence Accuracy=93.3% (test)

For more details, take a look at the corresponding implementation in recipes/dataset/.

Pretrained Models

Beyond providing recipes for training the models from scratch, SpeechBrain shares several pre-trained models (coupled with easy-inference functions) on HuggingFace. In the following, we report some of them:

Task Dataset Model
Speech Recognition LibriSpeech CNN + Transformer
Speech Recognition LibriSpeech CRDNN
Speech Recognition CommonVoice(English) wav2vec + CTC
Speech Recognition CommonVoice(French) wav2vec + CTC
Speech Recognition CommonVoice(Italian) wav2vec + CTC
Speech Recognition CommonVoice(Kinyarwanda) wav2vec + CTC
Speech Recognition AISHELL(Mandarin) wav2vec + CTC
Text-to-Speech LJSpeech Tacotron2
Speaker Recognition Voxceleb ECAPA-TDNN
Speech Separation WHAMR! SepFormer
Speech Enhancement Voicebank MetricGAN+
Speech Enhancement WHAMR! SepFormer
Spoken Language Understanding Timers and Such CRDNN
Language Identification CommonLanguage ECAPA-TDNN

The full list of pre-trained models can be found on HuggingFace

Documentation & Tutorials

SpeechBrain is designed to speed up the research and development of speech technologies. Hence, our code is backed-up with different levels of documentation:

  • Educational-level: we provide various Google Colab (i.e., interactive) tutorials describing all the building blocks of SpeechBrain ranging from the core of the toolkit to a specific model designed for a particular task. The tutorials are designed not only to help people familiarize themselves with SpeechBrain but, more in general, to help them familiarize themselves with speech and language technologies.
  • Functional-level: all classes in SpeechBrain contains a detailed docstring. It describes the input and output formats, the different arguments, the usage of the function, the potentially associated bibliography, and a function example used for test integration during pull requests.
  • Low-level: The code also uses a lot of in-line comments to describe nontrivial parts of the code.

Under development

We are currently implementing speech synthesis pipelines and real-time speech processing pipelines. An interface with the Finite State Transducers (FST) implemented by the Kaldi 2 team is under development.

Conference Tutorials

SpeechBrain has been presented at Interspeech 2021 and 2022 as well as ASRU 2021. When possible, we will provide some ressources here:

Quick installation

SpeechBrain is constantly evolving. New features, tutorials, and documentation will appear over time. SpeechBrain can be installed via PyPI. Moreover, a local installation can be used by those users that what to run experiments and modify/customize the toolkit. SpeechBrain supports both CPU and GPU computations. For most all the recipes, however, a GPU is necessary during training. Please note that CUDA must be properly installed to use GPUs.

Install via PyPI

Once you have created your Python environment (Python 3.7+) you can simply type:

pip install speechbrain

Then you can access SpeechBrain with:

import speechbrain as sb

Install with GitHub

Once you have created your Python environment (Python 3.7+) you can simply type:

git clone https://github.com/speechbrain/speechbrain.git
cd speechbrain
pip install -r requirements.txt
pip install --editable .

Then you can access SpeechBrain with:

import speechbrain as sb

Any modification made to the speechbrain package will be automatically interpreted as we installed it with the --editable flag.

Test Installation

Please, run the following script to make sure your installation is working:

pytest tests
pytest --doctest-modules speechbrain

Running an experiment

In SpeechBrain, you can run experiments in this way:

> cd recipes/<dataset>/<task>/
> python experiment.py params.yaml

The results will be saved in the output_folder specified in the yaml file. The folder is created by calling sb.core.create_experiment_directory() in experiment.py. Both detailed logs and experiment outputs are saved there. Furthermore, less verbose logs are output to stdout.

SpeechBrain Roadmap

As a community-based and open-source project, SpeechBrain needs the help of its community to grow in the right direction. Opening the roadmap to our users enables the toolkit to benefit from new ideas, new research axes, or even new technologies. The roadmap will be available in our GitHub Discussions and will list all the changes and updates that need to be done in the current version of SpeechBrain. Users are more than welcome to propose new items via new Discussions topics!

Learning SpeechBrain

We provide users with different resources to learn how to use SpeechBrain:

  • General information can be found on the website.
  • We offer many tutorials, you can start from the basic ones about SpeechBrain's basic functionalities and building blocks. We provide also more advanced tutorials (e.g SpeechBrain advanced, signal processing ...). You can browse them via the Tutorials drop-down menu on SpeechBrain website in the upper right.
  • Details on the SpeechBrain API, how to contribute, and the code are given in the documentation.

License

SpeechBrain is released under the Apache License, version 2.0. The Apache license is a popular BSD-like license. SpeechBrain can be redistributed for free, even for commercial purposes, although you can not take off the license headers (and under some circumstances, you may have to distribute a license document). Apache is not a viral license like the GPL, which forces you to release your modifications to the source code. Note that this project has no connection to the Apache Foundation, other than that we use the same license terms.

Social Media

We constantly update the community using Twitter. Feel free to follow us

Citing SpeechBrain

Please, cite SpeechBrain if you use it for your research or business.

@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}
}
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

用于各种语音技术的pytorch工具包 展开 收起
Python 等 4 种语言
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/create_future/speechbrain.git
git@gitee.com:create_future/speechbrain.git
create_future
speechbrain
speechbrain
develop

搜索帮助

53164aa7 5694891 3bd8fe86 5694891