repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
speechbrain
speechbrain-main/speechbrain/lobes/models/g2p/homograph.py
"""Tools for homograph disambiguation Authors * Artem Ploujnikov 2021 """ import torch from torch import nn class SubsequenceLoss(nn.Module): """ A loss function for a specific word in the output, used in the homograph disambiguation task The approach is as follows: 1. Arrange only the target wor...
21,897
31.978916
118
py
speechbrain
speechbrain-main/speechbrain/lobes/models/g2p/model.py
"""The Attentional RNN model for Grapheme-to-Phoneme Authors * Mirco Ravinelli 2021 * Artem Ploujnikov 2021 """ from speechbrain.lobes.models.transformer.Transformer import ( TransformerInterface, get_lookahead_mask, get_key_padding_mask, ) import torch from torch import nn from speechbrain.nnet.linear...
18,054
29.293624
119
py
speechbrain
speechbrain-main/speechbrain/lobes/models/g2p/__init__.py
from . import dataio # noqa from . import homograph # noqa from . import model # noqa from .dataio import * # noqa
120
19.166667
31
py
speechbrain
speechbrain-main/speechbrain/lobes/models/transformer/Transformer.py
"""Transformer implementaion in the SpeechBrain style. Authors * Jianyuan Zhong 2020 * Samuele Cornell 2021 """ import math import torch import torch.nn as nn import speechbrain as sb from typing import Optional import numpy as np from .Conformer import ConformerEncoder from speechbrain.nnet.activations import Swish...
27,179
30.641444
119
py
speechbrain
speechbrain-main/speechbrain/lobes/models/transformer/TransformerSE.py
"""CNN Transformer model for SE in the SpeechBrain style. Authors * Chien-Feng Liao 2020 """ import torch # noqa E402 from torch import nn from speechbrain.nnet.linear import Linear from speechbrain.lobes.models.transformer.Transformer import ( TransformerInterface, get_lookahead_mask, ) class CNNTransforme...
3,074
29.445545
92
py
speechbrain
speechbrain-main/speechbrain/lobes/models/transformer/TransformerLM.py
"""An implementation of Transformer Language model. Authors * Jianyuan Zhong * Samuele Cornell """ import torch # noqa 42 from torch import nn from speechbrain.nnet.linear import Linear from speechbrain.nnet.normalization import LayerNorm from speechbrain.nnet.containers import ModuleList from speechbrain.lobes.mo...
5,248
29.876471
108
py
speechbrain
speechbrain-main/speechbrain/lobes/models/transformer/TransformerASR.py
"""Transformer for ASR in the SpeechBrain style. Authors * Jianyuan Zhong 2020 """ import torch # noqa 42 from torch import nn from typing import Optional from speechbrain.nnet.linear import Linear from speechbrain.nnet.containers import ModuleList from speechbrain.lobes.models.transformer.Transformer import ( T...
12,371
34.348571
119
py
speechbrain
speechbrain-main/speechbrain/lobes/models/transformer/Conformer.py
"""Conformer implementation. Authors * Jianyuan Zhong 2020 * Samuele Cornell 2021 """ import torch import torch.nn as nn from typing import Optional import speechbrain as sb import warnings from speechbrain.nnet.attention import ( RelPosMHAXL, MultiheadAttention, PositionalwiseFeedForward, ) from speech...
20,245
29.127976
146
py
speechbrain
speechbrain-main/speechbrain/lobes/models/transformer/__init__.py
"""High level processing blocks. This subpackage gathers higher level blocks, or "lobes". The classes here may leverage the extended YAML syntax. """
151
24.333333
56
py
speechbrain
speechbrain-main/speechbrain/lobes/models/transformer/TransformerST.py
"""Transformer for ST in the SpeechBrain sytle. Authors * YAO FEI, CHENG 2021 """ import torch # noqa 42 import logging from torch import nn from typing import Optional from speechbrain.nnet.containers import ModuleList from speechbrain.lobes.models.transformer.Transformer import ( get_lookahead_mask, get_k...
13,931
34.360406
119
py
speechbrain
speechbrain-main/templates/hyperparameter_optimization_speaker_id/custom_model.py
../speaker_id/custom_model.py
29
29
29
py
speechbrain
speechbrain-main/templates/hyperparameter_optimization_speaker_id/mini_librispeech_prepare.py
../speaker_id/mini_librispeech_prepare.py
41
41
41
py
speechbrain
speechbrain-main/templates/hyperparameter_optimization_speaker_id/train.py
#!/usr/bin/env python3 """Recipe for training a speaker-id system, with hyperparameter optimization support. For a tutorial on hyperparameter optimization, refer to this tutorial: https://colab.research.google.com/drive/1b-5EOjZC7M9RvfWZ0Pq0HMV0KmQKu730#scrollTo=lJup9mNnYw_0 The template can use used as a basic exam...
13,148
35.935393
95
py
speechbrain
speechbrain-main/templates/speech_recognition/mini_librispeech_prepare.py
""" Downloads and creates manifest files for speech recognition with Mini LibriSpeech. Authors: * Peter Plantinga, 2021 * Mirco Ravanelli, 2021 """ import os import json import shutil import logging from speechbrain.utils.data_utils import get_all_files, download_file from speechbrain.dataio.dataio import read_audi...
6,041
31.138298
86
py
speechbrain
speechbrain-main/templates/speech_recognition/LM/custom_model.py
""" This file contains a very simple PyTorch module to use for language modeling. To replace this model, change the `!new:` tag in the hyperparameter file to refer to a built-in SpeechBrain model or another file containing a custom PyTorch module. Instead of this simple model, we suggest using one of the following bui...
2,590
27.163043
78
py
speechbrain
speechbrain-main/templates/speech_recognition/LM/train.py
#!/usr/bin/env python3 """Recipe for training a language model with a given text corpus. > python train.py RNNLM.yaml To run this recipe, you need to first install the Huggingface dataset: > pip install datasets Authors * Ju-Chieh Chou 2020 * Jianyuan Zhong 2021 * Mirco Ravanelli 2021 """ import sys import loggi...
9,669
32.344828
80
py
speechbrain
speechbrain-main/templates/speech_recognition/Tokenizer/mini_librispeech_prepare.py
../mini_librispeech_prepare.py
30
30
30
py
speechbrain
speechbrain-main/templates/speech_recognition/Tokenizer/train.py
#!/usr/bin/env/python3 """Script for training a BPE tokenizer on the top of CSV or JSON annotation files. The tokenizer converts words into sub-word units that can be used to train a language (LM) or an acoustic model (AM). When doing a speech recognition experiment you have to make sure that the acoustic and language ...
1,593
31.530612
82
py
speechbrain
speechbrain-main/templates/speech_recognition/ASR/mini_librispeech_prepare.py
../mini_librispeech_prepare.py
30
30
30
py
speechbrain
speechbrain-main/templates/speech_recognition/ASR/train.py
#!/usr/bin/env/python3 """Recipe for training a sequence-to-sequence ASR system with mini-librispeech. The system employs an encoder, a decoder, and an attention mechanism between them. Decoding is performed with beam search coupled with a neural language model. To run this recipe, do the following: > python train.py ...
17,800
37.364224
85
py
speechbrain
speechbrain-main/templates/speaker_id/custom_model.py
""" This file contains a very simple TDNN module to use for speaker-id. To replace this model, change the `!new:` tag in the hyperparameter file to refer to a built-in SpeechBrain model or another file containing a custom PyTorch module. Authors * Nauman Dawalatabad 2020 * Mirco Ravanelli 2020 """ import torch #...
5,638
29.814208
77
py
speechbrain
speechbrain-main/templates/speaker_id/mini_librispeech_prepare.py
""" Downloads and creates data manifest files for Mini LibriSpeech (spk-id). For speaker-id, different sentences of the same speaker must appear in train, validation, and test sets. In this case, these sets are thus derived from splitting the original training set intothree chunks. Authors: * Mirco Ravanelli, 2021 ""...
6,304
30.525
86
py
speechbrain
speechbrain-main/templates/speaker_id/train.py
#!/usr/bin/env python3 """Recipe for training a speaker-id system. The template can use used as a basic example for any signal classification task such as language_id, emotion recognition, command classification, etc. The proposed task classifies 28 speakers using Mini Librispeech. This task is very easy. In a real sce...
12,410
35.289474
80
py
speechbrain
speechbrain-main/templates/enhancement/custom_model.py
""" This file contains a very simple PyTorch module to use for enhancement. To replace this model, change the `!new:` tag in the hyperparameter file to refer to a built-in SpeechBrain model or another file containing a custom PyTorch module. Authors * Peter Plantinga 2021 """ import torch class CustomModel(torch.n...
1,992
30.140625
79
py
speechbrain
speechbrain-main/templates/enhancement/mini_librispeech_prepare.py
""" Downloads and creates manifest files for Mini LibriSpeech. Noise is automatically added to samples, managed by the EnvCorrupt class. Authors: * Peter Plantinga, 2020 """ import os import json import shutil import logging from speechbrain.utils.data_utils import get_all_files, download_file from speechbrain.datai...
4,917
32.006711
86
py
speechbrain
speechbrain-main/templates/enhancement/train.py
#!/usr/bin/env/python3 """Recipe for training a speech enhancement system with spectral masking. To run this recipe, do the following: > python train.py train.yaml --data_folder /path/to/save/mini_librispeech To read the code, first scroll to the bottom to see the "main" code. This gives a high-level overview of what...
11,127
34.552716
80
py
speechbrain
speechbrain-main/recipes/BinauralWSJ0Mix/prepare_data.py
""" The .csv preperation functions for Binaural-WSJ0Mix. Author * Cem Subakan 2020 * Zijian 2022 """ import os import csv def prepare_binaural_wsj0mix( experiment_name, datapath, savepath, n_spks=2, skip_prep=False, fs=8000, version="min", ): """ Prepared binaural wsj2mix if ...
11,651
28.800512
110
py
speechbrain
speechbrain-main/recipes/BinauralWSJ0Mix/separation/dynamic_mixing.py
import speechbrain as sb import numpy as np import torch import torchaudio import glob import os import random from speechbrain.processing.signal_processing import rescale from speechbrain.dataio.batch import PaddedBatch from scipy.signal import fftconvolve """ The functions to implement Dynamic Mixing For SpeechSepar...
7,597
33.694064
85
py
speechbrain
speechbrain-main/recipes/BinauralWSJ0Mix/separation/prepare_data.py
../prepare_data.py
18
18
18
py
speechbrain
speechbrain-main/recipes/BinauralWSJ0Mix/separation/train.py
#!/usr/bin/env/python3 """Recipe for training a neural speech separation system on binaural wsjmix the dataset. The system employs an encoder, a decoder, and a masking network. To run this recipe, do the following: > python train.py hparams/convtasnet-parallel.yaml --data_folder yourpath/binaural-wsj0m...
32,509
37.023392
113
py
speechbrain
speechbrain-main/recipes/KsponSpeech/convert_to_wav.py
import argparse import multiprocessing as mp import wave from pathlib import Path from tqdm import tqdm def convert_to_wav(filepath): """ This function converts pcm files to wav files Arguments --------- filepath : str path to the pcm file Returns ------- None """ w...
1,034
20.122449
70
py
speechbrain
speechbrain-main/recipes/KsponSpeech/ksponspeech_prepare.py
""" Data preparation. Download: https://aihub.or.kr/aidata/105/download Author ------ Dongwon Kim, Dongwoo Kim 2021 """ import csv import logging import os import re import torchaudio from speechbrain.dataio.dataio import load_pkl, merge_csvs, save_pkl from speechbrain.utils.data_utils import get_all_files logger ...
11,619
26.213115
80
py
speechbrain
speechbrain-main/recipes/KsponSpeech/LM/ksponspeech_prepare.py
../ksponspeech_prepare.py
25
25
25
py
speechbrain
speechbrain-main/recipes/KsponSpeech/LM/train.py
#!/usr/bin/env python3 """Recipe for training a Language Model with ksponspeech train-965.2 transcript and lm_corpus. To run this recipe, do the following: > pip install datasets > python train.py hparams/<hparam_file>.yaml \ --data_folder <local_path_to_librispeech_dataset> Authors * Jianyuan Zhong 2021 * Ju-C...
7,234
32.967136
80
py
speechbrain
speechbrain-main/recipes/KsponSpeech/Tokenizer/ksponspeech_prepare.py
../ksponspeech_prepare.py
25
25
25
py
speechbrain
speechbrain-main/recipes/KsponSpeech/Tokenizer/train.py
#!/usr/bin/env/python3 """Recipe for training a BPE tokenizer with ksponspeech. The tokenizer converts words into sub-word units that can be used to train a language (LM) or an acoustic model (AM). When doing a speech recognition experiment you have to make sure that the acoustic and language models are trained with th...
1,966
30.725806
72
py
speechbrain
speechbrain-main/recipes/KsponSpeech/ASR/transformer/ksponspeech_prepare.py
../../ksponspeech_prepare.py
28
28
28
py
speechbrain
speechbrain-main/recipes/KsponSpeech/ASR/transformer/train.py
#!/usr/bin/env python3 """Recipe for training a Transformer ASR system with KsponSpeech. The system employs an encoder, a decoder, and an attention mechanism between them. Decoding is performed with (CTC/Att joint) beamsearch coupled with a neural language model. To run this recipe, do the following: > python train.py...
17,980
36.696017
80
py
speechbrain
speechbrain-main/recipes/timers-and-such/prepare.py
import os import shutil import logging from speechbrain.dataio.dataio import read_audio, merge_csvs from speechbrain.utils.data_utils import download_file try: import pandas as pd except ImportError: err_msg = ( "The optional dependency pandas must be installed to run this recipe.\n" ) err_msg ...
7,072
36.226316
120
py
speechbrain
speechbrain-main/recipes/timers-and-such/LM/prepare.py
../prepare.py
13
13
13
py
speechbrain
speechbrain-main/recipes/timers-and-such/LM/train.py
#!/usr/bin/env/python3 """ Recipe for Timers and Such LM training. Run using: > python train.py hparams/train.yaml Authors * Loren Lugosch 2020 """ import sys import torch import speechbrain as sb from hyperpyyaml import load_hyperpyyaml from speechbrain.utils.distributed import run_on_main # Define training proc...
8,041
32.648536
83
py
speechbrain
speechbrain-main/recipes/timers-and-such/Tokenizer/prepare.py
../prepare.py
13
13
13
py
speechbrain
speechbrain-main/recipes/timers-and-such/Tokenizer/train.py
#!/usr/bin/env/python3 """Recipe for training a BPE tokenizer with timers-and-such. The tokenizer coverts semantics into sub-word units that can be used to train a language (LM) or an acoustic model (AM). To run this recipe, do the following: > python train.py hparams/tokenizer_bpe51.yaml Authors * Abdel Heba 2021 ...
1,549
26.678571
72
py
speechbrain
speechbrain-main/recipes/timers-and-such/decoupled/prepare.py
../prepare.py
13
13
13
py
speechbrain
speechbrain-main/recipes/timers-and-such/decoupled/train.py
#!/usr/bin/env/python3 """ Recipe for "decoupled" (speech -> ASR -> text -> NLU -> semantics) SLU. The NLU part is trained on the ground truth transcripts, and at test time we use the ASR to transcribe the audio and use that transcript as the input to the NLU. Run using: > python train.py hparams/train.yaml Authors ...
13,448
32.125616
89
py
speechbrain
speechbrain-main/recipes/timers-and-such/direct/train_with_wav2vec2.py
#!/usr/bin/env/python3 """ Recipe for "direct" (speech -> semantics) SLU with wav2vec2.0_based transfer learning. We encode input waveforms into features using a wav2vec2.0 model pretrained on ASR from HuggingFace (facebook/wav2vec2-base-960h), then feed the features into a seq2seq model to map them to semantics. (Ad...
13,849
32.373494
130
py
speechbrain
speechbrain-main/recipes/timers-and-such/direct/prepare.py
../prepare.py
13
13
13
py
speechbrain
speechbrain-main/recipes/timers-and-such/direct/train.py
#!/usr/bin/env/python3 """ Recipe for "direct" (speech -> semantics) SLU with ASR-based transfer learning. We encode input waveforms into features using a model trained on LibriSpeech, then feed the features into a seq2seq model to map them to semantics. (Adapted from the LibriSpeech seq2seq ASR recipe written by Ju-...
13,273
32.605063
125
py
speechbrain
speechbrain-main/recipes/timers-and-such/multistage/prepare.py
../prepare.py
13
13
13
py
speechbrain
speechbrain-main/recipes/timers-and-such/multistage/train.py
#!/usr/bin/env/python3 """ Recipe for "multistage" (speech -> ASR -> text -> NLU -> semantics) SLU. We transcribe each minibatch using a model trained on LibriSpeech, then feed the transcriptions into a seq2seq model to map them to semantics. (The transcriptions could be done offline to make training faster; the bene...
14,030
33.138686
117
py
speechbrain
speechbrain-main/recipes/VoxLingua107/lang_id/create_wds_shards.py
################################################################################ # # Converts the unzipped <LANG_ID>/<VIDEO---0000.000-0000.000.wav> folder # structure of VoxLingua107 into a WebDataset format # # Author(s): Tanel Alumäe, Nik Vaessen ######################################################################...
5,210
27.47541
81
py
speechbrain
speechbrain-main/recipes/VoxLingua107/lang_id/train.py
#!/usr/bin/python3 """Recipe for training language embeddings using the VoxLingua107 Dataset. This recipe is heavily inspired by this: https://github.com/nikvaessen/speechbrain/tree/sharded-voxceleb/my-recipes/SpeakerRec To run this recipe, use the following command: > python train_lang_embeddings_wds.py {hyperparame...
8,757
30.390681
126
py
speechbrain
speechbrain-main/recipes/SLURP/prepare.py
import os import jsonlines from speechbrain.dataio.dataio import read_audio, merge_csvs from speechbrain.utils.data_utils import download_file import shutil try: import pandas as pd except ImportError: err_msg = ( "The optional dependency pandas must be installed to run this recipe.\n" ) err_ms...
6,258
35.389535
120
py
speechbrain
speechbrain-main/recipes/SLURP/Tokenizer/prepare.py
../prepare.py
13
13
13
py
speechbrain
speechbrain-main/recipes/SLURP/Tokenizer/train.py
#!/usr/bin/env/python3 """Recipe for training a BPE tokenizer with SLURP. The tokenizer coverts semantics into sub-word units that can be used to train a language (LM) or an acoustic model (AM). To run this recipe, do the following: > python train.py hyperparams/tokenizer_bpe51.yaml Authors * Abdel Heba 2021 * Mir...
1,501
26.309091
72
py
speechbrain
speechbrain-main/recipes/SLURP/NLU/prepare.py
../prepare.py
13
13
13
py
speechbrain
speechbrain-main/recipes/SLURP/NLU/train.py
#!/usr/bin/env/python3 """ Text-only NLU recipe. This recipes takes the golden ASR transcriptions and tries to estimate the semantics on the top of that. Authors * Loren Lugosch, Mirco Ravanelli 2020 """ import sys import torch import speechbrain as sb from hyperpyyaml import load_hyperpyyaml from speechbrain.utils...
12,701
33.895604
96
py
speechbrain
speechbrain-main/recipes/SLURP/direct/train_with_wav2vec2.py
#!/usr/bin/env/python3 """ Recipe for "direct" (speech -> semantics) SLU. We encode input waveforms into features using the wav2vec2/HuBert model, then feed the features into a seq2seq model to map them to semantics. (Adapted from the LibriSpeech seq2seq ASR recipe written by Ju-Chieh Chou, Mirco Ravanelli, Abdel Heba,...
13,958
35.163212
125
py
speechbrain
speechbrain-main/recipes/SLURP/direct/prepare.py
../prepare.py
13
13
13
py
speechbrain
speechbrain-main/recipes/SLURP/direct/train.py
#!/usr/bin/env/python3 """ Recipe for "direct" (speech -> semantics) SLU with ASR-based transfer learning. We encode input waveforms into features using a model trained on LibriSpeech, then feed the features into a seq2seq model to map them to semantics. (Adapted from the LibriSpeech seq2seq ASR recipe written by Ju-...
13,228
35.144809
125
py
speechbrain
speechbrain-main/recipes/IEMOCAP/emotion_recognition/train_with_wav2vec2.py
#!/usr/bin/env python3 """Recipe for training an emotion recognition system from speech data only using IEMOCAP. The system classifies 4 emotions ( anger, happiness, sadness, neutrality) with wav2vec2. To run this recipe, do the following: > python train_with_wav2vec2.py hparams/train_with_wav2vec2.yaml --data_folder ...
10,890
35.182724
108
py
speechbrain
speechbrain-main/recipes/IEMOCAP/emotion_recognition/train.py
#!/usr/bin/env python3 """Recipe for training an emotion recognition system from speech data only using IEMOCAP. The system classifies 4 emotions ( anger, happiness, sadness, neutrality) with an ECAPA-TDNN model. To run this recipe, do the following: > python train.py hparams/train.yaml --data_folder /path/to/IEMOCAP...
13,084
34.080429
89
py
speechbrain
speechbrain-main/recipes/IEMOCAP/emotion_recognition/iemocap_prepare.py
""" Downloads and creates data manifest files for IEMOCAP (https://paperswithcode.com/dataset/iemocap). Authors: * Mirco Ravanelli, 2021 * Modified by Pierre-Yves Yanni, 2021 * Abdel Heba, 2021 * Yingzhi Wang, 2022 """ import os import sys import re import json import random import logging from speechbrain.dataio...
10,788
30.363372
148
py
speechbrain
speechbrain-main/recipes/LibriMix/prepare_data.py
""" The functions to create the .csv files for LibriMix Author * Cem Subakan 2020 """ import os import csv def prepare_librimix( datapath, savepath, n_spks=2, skip_prep=False, librimix_addnoise=False, fs=8000, ): """ Prepare .csv files for librimix Arguments: ---------- ...
6,470
29.814286
80
py
speechbrain
speechbrain-main/recipes/LibriMix/separation/dynamic_mixing.py
import speechbrain as sb import numpy as np import torch import torchaudio import glob import os from speechbrain.dataio.batch import PaddedBatch from tqdm import tqdm import warnings import pyloudnorm import random """ The functions to implement Dynamic Mixing For SpeechSeparation Authors * Samuele Cornell 2021 ...
7,257
30.284483
93
py
speechbrain
speechbrain-main/recipes/LibriMix/separation/prepare_data.py
../prepare_data.py
18
18
18
py
speechbrain
speechbrain-main/recipes/LibriMix/separation/train.py
#!/usr/bin/env/python3 """Recipe for training a neural speech separation system on Libri2/3Mix datasets. The system employs an encoder, a decoder, and a masking network. To run this recipe, do the following: > python train.py hparams/sepformer-libri2mix.yaml > python train.py hparams/sepformer-libri3mix.yaml The exp...
25,102
35.754026
108
py
speechbrain
speechbrain-main/recipes/LibriMix/meta/preprocess_dynamic_mixing.py
""" This script allows to resample a folder which contains audio files. The files are parsed recursively. An exact copy of the folder is created, with same structure but contained resampled audio files. Resampling is performed by using sox through torchaudio. Author ------ Samuele Cornell, 2020 """ import os import ar...
2,732
27.175258
80
py
speechbrain
speechbrain-main/recipes/ESC50/esc50_prepare.py
""" Creates data manifest files for ESC50 If the data does not exist in the specified --data_folder, we download the data automatically. https://urbansounddataset.weebly.com/urbansound8k.htm://github.com/karolpiczak/ESC-50 Authors: * Cem Subakan 2022, 2023 * Francesco Paissan 2022, 2023 Adapted from the Urbansoun...
12,776
33.814714
160
py
speechbrain
speechbrain-main/recipes/ESC50/classification/train_classifier.py
#!/usr/bin/python3 """Recipe to train a classifier on ESC50 data We employ an encoder followed by a sound classifier. To run this recipe, use the following command: > python train_classifier.py hparams/cnn14.yaml --data_folder yourpath/ESC-50-master Authors * Cem Subakan 2022, 2023 * Francesco Paissan 2022, 2...
15,164
35.454327
92
py
speechbrain
speechbrain-main/recipes/ESC50/classification/confusion_matrix_fig.py
#!/usr/bin/env python3 """Helper to create Confusion Matrix figure Authors * David Whipps 2021 * Ala Eddine Limame 2021 """ import numpy as np import matplotlib.pyplot as plt import itertools def create_cm_fig(cm, display_labels): """Creates confusion matrix plot. Arguments --------- cm : np.ndar...
1,622
24.359375
77
py
speechbrain
speechbrain-main/recipes/ESC50/classification/esc50_prepare.py
../esc50_prepare.py
19
19
19
py
speechbrain
speechbrain-main/recipes/ESC50/interpret/train_l2i.py
#!/usr/bin/python3 """This recipe to train L2I (https://arxiv.org/abs/2202.11479) to interepret audio classifiers. Authors * Cem Subakan 2022, 2023 * Francesco Paissan 2022, 2023 """ import os import sys import torch import torchaudio import speechbrain as sb from hyperpyyaml import load_hyperpyyaml from speec...
24,425
35.026549
95
py
speechbrain
speechbrain-main/recipes/ESC50/interpret/esc50_prepare.py
../esc50_prepare.py
19
19
19
py
speechbrain
speechbrain-main/recipes/ESC50/interpret/train_piq.py
#!/usr/bin/python3 """This recipe to train PIQ to interepret audio classifiers. Authors * Cem Subakan 2022, 2023 * Francesco Paissan 2022, 2023 """ import os import sys import torch import torchaudio import speechbrain as sb from hyperpyyaml import load_hyperpyyaml from speechbrain.utils.distributed import run...
26,143
33.627815
92
py
speechbrain
speechbrain-main/recipes/ESC50/interpret/train_nmf.py
#!/usr/bin/python3 """The recipe to train an NMF model with amortized inference on ESC50 data. To run this recipe, use the following command: > python train_nmf.py hparams/nmf.yaml --data_folder /yourpath/ESC-50-master Authors * Cem Subakan 2022, 2023 * Francesco Paissan 2022, 2023 """ import sys import tor...
4,783
32.222222
86
py
speechbrain
speechbrain-main/recipes/AISHELL-1/aishell_prepare.py
import os import shutil import logging from speechbrain.dataio.dataio import read_audio from speechbrain.utils.data_utils import download_file import glob import csv logger = logging.getLogger(__name__) def prepare_aishell(data_folder, save_folder, skip_prep=False): """ This function prepares the AISHELL-1 d...
3,368
31.708738
120
py
speechbrain
speechbrain-main/recipes/AISHELL-1/Tokenizer/aishell_prepare.py
../aishell_prepare.py
21
21
21
py
speechbrain
speechbrain-main/recipes/AISHELL-1/Tokenizer/pretrained.py
""" Pre-trained Tokenizer for inference. Authors * Mirco Ravanelli 2020 * Abdel Heba 2020 """ import os from speechbrain.utils.data_utils import download_file import sentencepiece as spm class tokenizer: """Downloads and loads the pretrained tokenizer. Arguments --------- tokenizer_file : str ...
934
23.605263
73
py
speechbrain
speechbrain-main/recipes/AISHELL-1/Tokenizer/train.py
#!/usr/bin/env/python3 """Recipe for training a BPE tokenizer with AISHELL-1. The tokenizer coverts transcripts into sub-word units that can be used to train a language (LM) or an acoustic model (AM). To run this recipe, do the following: > python train.py hparams/tokenizer_bpe5000.yaml Authors * Abdel Heba 2021 *...
1,480
26.425926
72
py
speechbrain
speechbrain-main/recipes/AISHELL-1/ASR/seq2seq/aishell_prepare.py
../../aishell_prepare.py
24
24
24
py
speechbrain
speechbrain-main/recipes/AISHELL-1/ASR/seq2seq/train.py
#!/usr/bin/env/python3 """ AISHELL-1 seq2seq model recipe. (Adapted from the LibriSpeech recipe.) """ import sys import torch import logging import speechbrain as sb from speechbrain.utils.distributed import run_on_main from hyperpyyaml import load_hyperpyyaml logger = logging.getLogger(__name__) # Define trainin...
13,009
34.162162
89
py
speechbrain
speechbrain-main/recipes/AISHELL-1/ASR/CTC/aishell_prepare.py
../../aishell_prepare.py
24
24
24
py
speechbrain
speechbrain-main/recipes/AISHELL-1/ASR/CTC/train_with_wav2vec.py
#!/usr/bin/env/python3 """AISHELL-1 CTC recipe. The system employs a wav2vec2 encoder and a CTC decoder. Decoding is performed with greedy decoding. To run this recipe, do the following: > python train_with_wav2vec2.py hparams/train_with_wav2vec2.yaml With the default hyperparameters, the system employs a pretrained ...
13,335
33.282776
89
py
speechbrain
speechbrain-main/recipes/AISHELL-1/ASR/transformer/aishell_prepare.py
../../aishell_prepare.py
24
24
24
py
speechbrain
speechbrain-main/recipes/AISHELL-1/ASR/transformer/train_with_wav2vect.py
#!/usr/bin/env/python3 """ AISHELL-1 transformer model recipe. (Adapted from the LibriSpeech recipe.). It is designed to work with wav2vec2 pre-training. """ import sys import torch import logging import speechbrain as sb from speechbrain.utils.distributed import run_on_main from hyperpyyaml import load_hyperpyyaml ...
17,879
35.341463
94
py
speechbrain
speechbrain-main/recipes/AISHELL-1/ASR/transformer/train.py
#!/usr/bin/env/python3 """ AISHELL-1 transformer model recipe. (Adapted from the LibriSpeech recipe.) """ import sys import torch import logging import speechbrain as sb from speechbrain.utils.distributed import run_on_main from hyperpyyaml import load_hyperpyyaml logger = logging.getLogger(__name__) # Define tra...
17,133
35.147679
94
py
speechbrain
speechbrain-main/recipes/LJSpeech/TTS/ljspeech_prepare.py
""" LJspeech data preparation. Download: https://data.keithito.com/data/speech/LJSpeech-1.1.tar.bz2 Authors * Yingzhi WANG 2022 """ import os import csv import json import logging import random from speechbrain.dataio.dataio import ( load_pkl, save_pkl, ) logger = logging.getLogger(__name__) OPT_FILE = "opt...
7,584
28.285714
80
py
speechbrain
speechbrain-main/recipes/LJSpeech/TTS/tacotron2/ljspeech_prepare.py
../ljspeech_prepare.py
22
22
22
py
speechbrain
speechbrain-main/recipes/LJSpeech/TTS/tacotron2/train.py
# -*- coding: utf-8 -*- """ Recipe for training the Tacotron Text-To-Speech model, an end-to-end neural text-to-speech (TTS) system To run this recipe, do the following: # python train.py --device=cuda:0 --max_grad_norm=1.0 --data_folder=/your_folder/LJSpeech-1.1 hparams/train.yaml to infer simply load saved mod...
13,447
32.53616
113
py
speechbrain
speechbrain-main/recipes/LJSpeech/TTS/vocoder/hifi_gan/ljspeech_prepare.py
../../ljspeech_prepare.py
25
25
25
py
speechbrain
speechbrain-main/recipes/LJSpeech/TTS/vocoder/hifi_gan/train.py
#!/usr/bin/env python3 """Recipe for training a hifi-gan vocoder. For more details about hifi-gan: https://arxiv.org/pdf/2010.05646.pdf To run this recipe, do the following: > python train.py hparams/train.yaml --data_folder /path/to/LJspeech Authors * Duret Jarod 2021 * Yingzhi WANG 2022 """ import sys import tor...
14,460
34.618227
90
py
speechbrain
speechbrain-main/recipes/Fisher-Callhome-Spanish/fisher_callhome_prepare.py
""" Data preparation Author ----- YAO-FEI, CHENG 2021 """ import os import re import json import string import logging import subprocess from typing import List from dataclasses import dataclass, field import torch import torchaudio from tqdm import tqdm from speechbrain.utils.data_utils import get_all_files from ...
25,525
33.682065
114
py
speechbrain
speechbrain-main/recipes/Fisher-Callhome-Spanish/Tokenizer/fisher_callhome_prepare.py
../fisher_callhome_prepare.py
29
29
29
py
speechbrain
speechbrain-main/recipes/Fisher-Callhome-Spanish/Tokenizer/train.py
#!/usr/bin/env/python3 """Recipe for training a BPE tokenizer with librispeech. The tokenizer coverts words into sub-word units that can be used to train a language (LM) or an acoustic model (AM). When doing a speech recognition experiment you have to make sure that the acoustic and language models are trained with the...
1,495
31.521739
72
py
speechbrain
speechbrain-main/recipes/Fisher-Callhome-Spanish/ST/transformer/train.py
#!/usr/bin/env/python3 """Recipe for training a Transformer based ST system with Fisher-Callhome. The system employs an encoder, a decoder, and an attention mechanism between them. Decoding is performed with beam search coupled with a neural language model. To run this recipe, do the following: > python train.py hpara...
23,243
35.778481
91
py
speechbrain
speechbrain-main/recipes/UrbanSound8k/urbansound8k_prepare.py
""" Creates data manifest files from UrbanSound8k, suitable for use in SpeechBrain. https://urbansounddataset.weebly.com/urbansound8k.html From the authors of UrbanSound8k: 1. Don't reshuffle the data! Use the predefined 10 folds and perform 10-fold (not 5-fold) cross validation The experiments conducted by vast maj...
14,774
37.476563
122
py
speechbrain
speechbrain-main/recipes/UrbanSound8k/SoundClassification/urbansound8k_prepare.py
../urbansound8k_prepare.py
26
26
26
py
speechbrain
speechbrain-main/recipes/UrbanSound8k/SoundClassification/confusion_matrix_fig.py
#!/usr/bin/env python3 """Helper to create Confusion Matrix figure Authors * David Whipps 2021 * Ala Eddine Limame 2021 """ import numpy as np import matplotlib.pyplot as plt import itertools def create_cm_fig(cm, display_labels): fig = plt.figure(figsize=cm.shape, dpi=50, facecolor="w", edgecolor="k") a...
1,359
26.2
77
py
speechbrain
speechbrain-main/recipes/UrbanSound8k/SoundClassification/custom_model.py
""" This file contains a very simple TDNN module to use for sound class identification. To replace this model, change the `!new:` tag in the hyperparameter file to refer to a built-in SpeechBrain model or another file containing a custom PyTorch module. Authors * David Whipps 2021 * Ala Eddine Limame 2021 Adapted...
5,731
29.489362
83
py