-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add People's Speech (30,000 hours) Conformer ASR (Code from Samsung AI Center Cambridge) #2767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
47e3097
shorter augmentations in yaml
5ab888a
layout to 80 char
a3bf472
listed label replication
c86d687
listed label replication
761bf93
listed label replication
09cfde3
Refact CTC
e60396f
Refact transducer
d6a5524
Refact seq2seq
9daba50
call replicate label instead of duplication
6bf2361
refactor aishell
7ec92c5
refactor aishell
ebae569
CommonLanuageÃ
088a0eb
fix error + CV CTC
bfb9bc2
Giga OOF
21353d5
Giga OOF
9971121
Giga OOF
f879302
Giga OOF
95c5ea4
Giga OOF
1b24844
Giga OOF
a5a97aa
Giga OOF
55904dd
Giga OOF
7f366bb
Giga OOF
963bda4
Finishing OOF
922024a
final touch LULZ
819f8c8
fix tests
8ade568
Tests???Ã
9e73c10
fix augment in some recipes
mravanelli b2b8f56
merge
f0e9f6d
Merge branch 'develop' of https://github.com/TParcollet/speechbrain-r…
afd37a1
Merge branch 'develop' of https://github.com/speechbrain/speechbrain …
331ff7d
Merge branch 'develop' of https://github.com/speechbrain/speechbrain …
81db8cc
Merge branch 'develop' of https://github.com/speechbrain/speechbrain …
9ba61e6
Merge branch 'develop' of https://github.com/speechbrain/speechbrain …
56b5d3c
Merge branch 'develop' of https://github.com/speechbrain/speechbrain …
e4c6f32
Merge branch 'develop' of https://github.com/speechbrain/speechbrain …
4127e2b
Merge branch 'develop' of https://github.com/speechbrain/speechbrain …
94136b8
Merge branch 'develop' of https://github.com/speechbrain/speechbrain …
6f31d9c
Merge branch 'develop' of https://github.com/speechbrain/speechbrain …
744a069
Merge branch 'develop' of https://github.com/speechbrain/speechbrain …
6750a49
Merge branch 'develop' of https://github.com/speechbrain/speechbrain …
c47acb7
first commit
59efc68
cleaning
91edb97
cleaning
569bc25
ready to review
TParcollet b79b5e1
disable download
TParcollet 8a191ee
extra req
TParcollet e750775
no idea about this test
TParcollet f2608fd
remove recipe test
TParcollet b0e1c5d
Merge branch 'develop' into people_speech
TParcollet 6bbd27a
small fixes
TParcollet ef3d176
small fixes
TParcollet d3ab023
Merge branch 'people_speech' of https://github.com/TParcollet/speechb…
TParcollet 9598f63
Do such that Adel is finally happy
TParcollet bfbed5e
done
TParcollet bb74d46
update readme
TParcollet 0035e31
fix comments
TParcollet d61ca04
fix error catching
TParcollet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # How to run an ASR experiment with People's Speech | ||
|
|
||
| This recipe provides the necessary recipe to train a speech recognizer on the People's Speech dataset. | ||
|
|
||
| ## Downloading the dataset | ||
|
|
||
| The full dataset will occupy around 3 TB of storage and must be obtained following the standard HuggingFace | ||
| dataset process in the [corresponding HuggingFace people's speech repository](https://huggingface.co/datasets/MLCommons/peoples_speech). | ||
|
|
||
| By default, our recipe set the HuggingFace environmental variable *HF_DATASETS_OFFLINE* to disable the download | ||
| of the dataset. This is because we ask the user to download it before, like for any other recipe. Indeed, we do | ||
| not want a recipe script, potentially run on GPUs nodes, to take hours downloading a dataset first. | ||
|
|
||
| **One must download the wanted train subset as well as the validation and test splits.** | ||
|
|
||
| ## Important note on the data | ||
|
|
||
| [People's speech](https://arxiv.org/pdf/2111.09344) is a very challenging dataset containing two main sets 'clean' and 'dirty' totalising 28,000 hours of error-prone transcribed speech. From our experience, it is most likely that this dataset should not be utilised alone, as the training material is very hard. It mostly contains spontaneous speech, with a few errors in transcription alignments and a lot of transcription inconsistency e.g. sometimes transcribing filler words, sometimes not - sometimes transcribing repetition, sometimes not. This makes the models trained on this data fairly hard to evaluate... The provided validation and test sets seem to be also a bit out of domain. | ||
|
|
||
| However, this dataset remain very valuable due to the high quantity of spontaneous speech provided. | ||
|
|
||
| ## People's Speech Clean vs Dirty | ||
|
|
||
| The clean subset contains 5.8k hours of speech while the dirty one around 22k hours. According to the authors, samples in the clean subset exhibits a CER lower or equal to 20% on their transcriptions compared to pseudo-labels obtained from an external ASR model. The dirty set is for samples with between 20% and 38% of CER. This confirm that even the clean subset is very 'noisy' from the perspective of the quality of the labels. | ||
|
|
||
| ## Results | ||
|
|
||
| It is tricky to evaluate this dataset. Here we provide the results on the official validation | ||
| and test split as well as Voxpopuli test set and the test-clean from LibriSpeech. It is important | ||
| to remember that the results for the two last sets are out-of-domain and vocabulary for the | ||
| tokenizer. | ||
|
|
||
| | hyperparams file | validation WER | test WER | VoxPopuli | LibriSpeech test-clean WER | GPUs | | ||
| |:-------------:|:-------------:|:-------------:|:---------------------------:| :-----:| :-----:| | ||
| | conformer_large.yaml | 28.44 | 31.04 | 20.0 | 9.45 | 8xA100 80GB | | ||
|
|
||
| # **About SpeechBrain** | ||
| - Website: https://speechbrain.github.io/ | ||
| - Code: https://github.com/speechbrain/speechbrain/ | ||
| - HuggingFace: https://huggingface.co/speechbrain/ | ||
|
|
||
| # **Citing SpeechBrain** | ||
| Please, cite SpeechBrain if you use it for your research or business. | ||
|
|
||
| ```bibtex | ||
| @misc{speechbrainV1, | ||
| title={Open-Source Conversational AI with SpeechBrain 1.0}, | ||
| 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 Xuechen Liu and Sangeet Sagar and Jarod Duret and Salima Mdhaffar and Gaelle Laperriere and Mickael Rouvier and Renato De Mori and Yannick Esteve}, | ||
| year={2024}, | ||
| eprint={2407.00463}, | ||
| archivePrefix={arXiv}, | ||
| primaryClass={cs.LG}, | ||
| url={https://arxiv.org/abs/2407.00463}, | ||
| } | ||
| @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} | ||
| } | ||
| ``` | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| datasets==3.1.0 | ||
| librosa | ||
| soundfile |
284 changes: 284 additions & 0 deletions
284
recipes/PeoplesSpeech/ASR/transformer/hparams/conformer_large.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,284 @@ | ||
| # ############################################################################ | ||
| # Model: E2E ASR with Transformer | ||
| # Encoder: Conformer Encoder | ||
| # Decoder: Transformer Decoder + (CTC/ATT joint) beamsearch + TransformerLM | ||
| # Tokens: BPE | ||
| # losses: CTC + KLdiv (Label Smoothing loss) | ||
| # Training: People's Speech 28,000 hours | ||
| # Authors: Titouan Parcollet | ||
| # ############################################################################ | ||
|
|
||
| # Seed needs to be set at top of yaml, before objects with parameters are made | ||
| seed: 3407 | ||
| __set_seed: !apply:speechbrain.utils.seed_everything [!ref <seed>] | ||
| output_folder: !ref results/conformer_transducer_large/<seed> | ||
| output_wer_folder: !ref <output_folder>/ | ||
| save_folder: !ref <output_folder>/save | ||
| train_csv: !ref <save_folder>/train.csv | ||
| train_log: !ref <output_folder>/train_log.txt | ||
|
|
||
| # Data files | ||
| hf_download_folder: !PLACEHOLDER | ||
| subsets: ["clean", "dirty"] # _sa sets are removed. | ||
| ckpt_interval_minutes: 5 # save checkpoint every N min | ||
|
|
||
|
|
||
| ####################### Training Parameters #################################### | ||
|
|
||
| number_of_epochs: 30 | ||
| optimizer_step_limit: 400000 | ||
| ctc_weight: 0.3 | ||
| grad_accumulation_factor: 1 | ||
| max_grad_norm: 5.0 | ||
| loss_reduction: 'batchmean' | ||
| sorting: random | ||
| num_workers: 4 | ||
| precision: fp16 # bf16, fp16 or fp32 | ||
| skip_prep: False | ||
|
|
||
| # stages related parameters | ||
| lr_adam: 0.0008 | ||
|
|
||
| # Feature parameters | ||
| sample_rate: 16000 | ||
| n_fft: 512 | ||
| n_mels: 80 | ||
| win_length: 32 | ||
|
|
||
| # This setup works well for A100 80GB GPU, adapts it to your needs. | ||
| # Or turn it off (but training speed will decrease) | ||
| max_batch_length_train: 500 | ||
| max_batch_length_val: 100 # we reduce it as the beam is much wider (VRAM) | ||
| num_bucket: 200 | ||
| shuffle: True # if true re-creates batches at each epoch shuffling examples. | ||
| batch_ordering: random | ||
| max_batch_ex: 256 | ||
|
TParcollet marked this conversation as resolved.
|
||
|
|
||
| # BPE parameters | ||
| token_type: bpe # ["unigram", "bpe", "char"] | ||
| character_coverage: 1.0 | ||
|
|
||
| dynamic_batch_sampler: | ||
| max_batch_length: !ref <max_batch_length_train> | ||
| num_buckets: !ref <num_bucket> | ||
| shuffle: !ref <shuffle> | ||
| batch_ordering: !ref <batch_ordering> | ||
| max_batch_ex: !ref <max_batch_ex> | ||
|
|
||
| dynamic_batch_sampler_valid: | ||
| max_batch_length: !ref <max_batch_length_val> | ||
| num_buckets: !ref <num_bucket> | ||
| shuffle: !ref <shuffle> | ||
| batch_ordering: !ref <batch_ordering> | ||
| max_batch_ex: !ref <max_batch_ex> | ||
|
|
||
| # Dataloader options | ||
| train_dataloader_opts: | ||
| shuffle: True | ||
| num_workers: !ref <num_workers> | ||
|
|
||
| valid_dataloader_opts: | ||
| num_workers: !ref <num_workers> | ||
|
|
||
| test_dataloader_opts: | ||
| batch_size: 4 | ||
|
|
||
| ####################### Model Parameters ####################################### | ||
|
|
||
| # Transformer | ||
| d_model: 640 | ||
| nhead: 8 | ||
| num_encoder_layers: 14 | ||
| num_decoder_layers: 6 | ||
| d_ffn: 2048 | ||
| transformer_dropout: 0.1 | ||
| activation: !name:speechbrain.nnet.activations.Swish | ||
| output_neurons: 5120 | ||
|
|
||
| # Outputs | ||
| label_smoothing: 0.1 | ||
| bos_index: 1 | ||
| eos_index: 2 | ||
|
|
||
| # Decoding parameters | ||
| min_decode_ratio: 0.0 | ||
| max_decode_ratio: 1.0 | ||
| valid_search_interval: 10 | ||
| valid_beam_size: 5 | ||
| test_beam_size: 10 | ||
| ctc_weight_decode: 0.3 | ||
|
|
||
| ############################## Models ########################################## | ||
|
|
||
| CNN: !new:speechbrain.lobes.models.convolution.ConvolutionFrontEnd | ||
| input_shape: (8, 10, 80) | ||
| num_blocks: 2 | ||
| num_layers_per_block: 1 | ||
| out_channels: (64, 32) | ||
| kernel_sizes: (3, 3) | ||
| strides: (2, 2) | ||
| residuals: (False, False) | ||
|
|
||
| Transformer: !new:speechbrain.lobes.models.transformer.TransformerASR.TransformerASR # yamllint disable-line rule:line-length | ||
| input_size: 640 | ||
| tgt_vocab: !ref <output_neurons> | ||
| d_model: !ref <d_model> | ||
| nhead: !ref <nhead> | ||
| num_encoder_layers: !ref <num_encoder_layers> | ||
| num_decoder_layers: !ref <num_decoder_layers> | ||
| d_ffn: !ref <d_ffn> | ||
| dropout: !ref <transformer_dropout> | ||
| activation: !ref <activation> | ||
| conformer_activation: !ref <activation> | ||
| encoder_module: conformer | ||
| attention_type: RelPosMHAXL | ||
| normalize_before: True | ||
| causal: False | ||
|
|
||
| ctc_lin: !new:speechbrain.nnet.linear.Linear | ||
| input_size: !ref <d_model> | ||
| n_neurons: !ref <output_neurons> | ||
|
|
||
| seq_lin: !new:speechbrain.nnet.linear.Linear | ||
| input_size: !ref <d_model> | ||
| n_neurons: !ref <output_neurons> | ||
|
|
||
| normalize: !new:speechbrain.processing.features.InputNormalization | ||
| norm_type: global | ||
| update_until_epoch: 2 | ||
|
|
||
| modules: | ||
| CNN: !ref <CNN> | ||
| Transformer: !ref <Transformer> | ||
| seq_lin: !ref <seq_lin> | ||
| ctc_lin: !ref <ctc_lin> | ||
| normalize: !ref <normalize> | ||
|
|
||
| # define two optimizers here for two-stage training | ||
| Adam: !name:torch.optim.AdamW | ||
| lr: !ref <lr_adam> | ||
| betas: (0.9, 0.98) | ||
| eps: 0.000000001 | ||
| weight_decay: 0.001 | ||
|
|
||
| model: !new:torch.nn.ModuleList | ||
| - [!ref <CNN>, !ref <Transformer>, !ref <seq_lin>, !ref <ctc_lin>] | ||
|
|
||
| ####################### Decoding & optimiser ########################### | ||
|
|
||
| ctc_scorer: !new:speechbrain.decoders.scorer.CTCScorer | ||
| eos_index: !ref <eos_index> | ||
| blank_index: 0 | ||
| ctc_fc: !ref <ctc_lin> | ||
|
|
||
|
|
||
| scorer_test_search: !new:speechbrain.decoders.scorer.ScorerBuilder | ||
| full_scorers: [!ref <ctc_scorer>] | ||
| weights: | ||
| ctc: !ref <ctc_weight_decode> | ||
|
|
||
| scorer_valid_search: !new:speechbrain.decoders.scorer.ScorerBuilder | ||
| full_scorers: [!ref <ctc_scorer>] | ||
| weights: | ||
| ctc: !ref <ctc_weight_decode> | ||
|
|
||
| valid_search: !new:speechbrain.decoders.S2STransformerBeamSearcher | ||
| modules: [!ref <Transformer>, !ref <seq_lin>] | ||
| bos_index: !ref <bos_index> | ||
| eos_index: !ref <eos_index> | ||
| min_decode_ratio: !ref <min_decode_ratio> | ||
| max_decode_ratio: !ref <max_decode_ratio> | ||
| beam_size: !ref <valid_beam_size> | ||
| using_eos_threshold: False | ||
| length_normalization: True | ||
| scorer: !ref <scorer_valid_search> | ||
|
|
||
| test_search: !new:speechbrain.decoders.S2STransformerBeamSearcher | ||
| modules: [!ref <Transformer>, !ref <seq_lin>] | ||
| bos_index: !ref <bos_index> | ||
| eos_index: !ref <eos_index> | ||
| min_decode_ratio: !ref <min_decode_ratio> | ||
| max_decode_ratio: !ref <max_decode_ratio> | ||
| beam_size: !ref <test_beam_size> | ||
| temperature: 1.15 | ||
| using_eos_threshold: False | ||
| length_normalization: True | ||
| scorer: !ref <scorer_test_search> | ||
|
|
||
| log_softmax: !new:torch.nn.LogSoftmax | ||
| dim: -1 | ||
|
|
||
| ctc_cost: !name:speechbrain.nnet.losses.ctc_loss | ||
| blank_index: 0 | ||
| reduction: !ref <loss_reduction> | ||
|
|
||
| seq_cost: !name:speechbrain.nnet.losses.kldiv_loss | ||
| label_smoothing: !ref <label_smoothing> | ||
| reduction: !ref <loss_reduction> | ||
|
|
||
| noam_annealing: !new:speechbrain.nnet.schedulers.NoamScheduler | ||
| lr_initial: !ref <lr_adam> | ||
| n_warmup_steps: 40000 | ||
|
|
||
| checkpointer: !new:speechbrain.utils.checkpoints.Checkpointer | ||
| checkpoints_dir: !ref <save_folder> | ||
| recoverables: | ||
| model: !ref <model> | ||
| noam_scheduler: !ref <noam_annealing> | ||
| normalizer: !ref <normalize> | ||
| counter: !ref <epoch_counter> | ||
|
|
||
| epoch_counter: !new:speechbrain.utils.epoch_loop.EpochCounter | ||
| limit: !ref <number_of_epochs> | ||
|
|
||
| ############################## Augmentations ################################### | ||
|
|
||
| # Speed perturbation | ||
| speed_perturb: !new:speechbrain.augment.time_domain.SpeedPerturb | ||
| orig_freq: !ref <sample_rate> | ||
| speeds: [95, 100, 105] | ||
|
|
||
| # Time Drop | ||
| time_drop: !new:speechbrain.augment.freq_domain.SpectrogramDrop | ||
| drop_length_low: 15 | ||
| drop_length_high: 25 | ||
| drop_count_low: 1 | ||
| drop_count_high: 2 | ||
| replace: "mean" | ||
|
|
||
| # Freq Drop | ||
| freq_drop: !new:speechbrain.augment.freq_domain.SpectrogramDrop | ||
| drop_length_low: 10 | ||
| drop_length_high: 20 | ||
| drop_count_low: 1 | ||
| drop_count_high: 2 | ||
| replace: "mean" | ||
| dim: 2 | ||
|
|
||
| # Time warp | ||
| time_warp: !new:speechbrain.augment.freq_domain.Warping | ||
|
|
||
| # We remove augmentations as we are using the full 28k hour set. | ||
| # Uncomment to bring augmentations back! | ||
| # fea_augment: !new:speechbrain.augment.augmenter.Augmenter | ||
| # min_augmentations: 2 | ||
| # max_augmentations: 2 | ||
| # augment_prob: 1.0 | ||
| # augmentations: [ | ||
| # !ref <time_drop>, | ||
| # !ref <freq_drop>, | ||
| # !ref <time_warp>] | ||
|
|
||
| compute_features: !new:speechbrain.lobes.features.Fbank | ||
| sample_rate: !ref <sample_rate> | ||
| n_fft: !ref <n_fft> | ||
| n_mels: !ref <n_mels> | ||
| win_length: !ref <win_length> | ||
|
|
||
| ############################## Logging and Pretrainer ########################## | ||
|
|
||
| train_logger: !new:speechbrain.utils.train_logger.FileTrainLogger | ||
| save_file: !ref <train_log> | ||
|
|
||
| error_rate_computer: !name:speechbrain.utils.metric_stats.ErrorRateStats | ||
| acc_computer: !name:speechbrain.utils.Accuracy.AccuracyStats | ||
1 change: 1 addition & 0 deletions
1
recipes/PeoplesSpeech/ASR/transformer/peoples_speech_prepare.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../peoples_speech_prepare.py |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.