mirror of
https://github.com/storytold/storyteller-ml.git
synced 2026-10-23 08:26:06 +00:00
Introduce code from Rust monorepo. This is a mess
This commit is contained in:
@@ -0,0 +1,201 @@
|
||||
# It contains the default values for training a Conformer ASR model medium size with RNNT loss and BPE-based vocabulary.
|
||||
# Default learning parameters in this config are set for effective batch size of 2K.
|
||||
# To train it with smaller batch sizes, you may need to re-tune the learning parameters or use higher accumulate_grad_batches.
|
||||
|
||||
# You may find more info about Conformer-CTC here: https://docs.nvidia.com/deeplearning/nemo/user-guide/docs/en/stable/asr/models.html#conformer-ctc
|
||||
# Pre-trained models of Conformer-CTC can be found here: https://docs.nvidia.com/deeplearning/nemo/user-guide/docs/en/stable/asr/results.html
|
||||
|
||||
name: "Conformer-RNNT-BPE"
|
||||
|
||||
model:
|
||||
sample_rate: &sample_rate 16000
|
||||
compute_eval_loss: false # disables loss evaluation for validation and test data
|
||||
log_prediction: true # enables logging sample predictions in the output during training
|
||||
ctc_reduction: 'mean_batch'
|
||||
|
||||
model_defaults:
|
||||
se: true
|
||||
se_context_size: -1
|
||||
# encoder / decoder / joint values
|
||||
enc_hidden: ${model.encoder.d_model}
|
||||
pred_hidden: 640
|
||||
joint_hidden: 640
|
||||
|
||||
train_ds:
|
||||
manifest_filepath: ???
|
||||
sample_rate: ${model.sample_rate}
|
||||
batch_size: 16 # you may increase batch_size if your memory allows
|
||||
shuffle: true
|
||||
num_workers: 8
|
||||
pin_memory: false
|
||||
use_start_end_token: true
|
||||
trim_silence: false
|
||||
max_duration: 16.7 # it is set for LibriSpeech, you may need to update it for your dataset
|
||||
min_duration: 0.1
|
||||
|
||||
validation_ds:
|
||||
manifest_filepath: ???
|
||||
sample_rate: ${model.sample_rate}
|
||||
batch_size: 16
|
||||
shuffle: false
|
||||
num_workers: 8
|
||||
pin_memory: false
|
||||
use_start_end_token: true
|
||||
|
||||
test_ds:
|
||||
manifest_filepath: null
|
||||
sample_rate: ${model.sample_rate}
|
||||
batch_size: 16
|
||||
shuffle: false
|
||||
num_workers: 8
|
||||
pin_memory: false
|
||||
use_start_end_token: true
|
||||
|
||||
# you may find more detail on how to train a tokenizer at: /scripts/tokenizers/process_asr_text_tokenizer.py
|
||||
tokenizer:
|
||||
dir: ??? # path to directory which contains either tokenizer.model (bpe) or vocab.txt (for wpe)
|
||||
type: wpe # Can be either bpe (SentencePiece tokenizer) or wpe (WordPiece tokenizer)
|
||||
|
||||
preprocessor:
|
||||
_target_: nemo.collections.asr.modules.AudioToMelSpectrogramPreprocessor
|
||||
sample_rate: *sample_rate
|
||||
normalize: "per_feature"
|
||||
window_size: 0.025
|
||||
window_stride: 0.01
|
||||
window: "hann"
|
||||
features: 80
|
||||
n_fft: 512
|
||||
frame_splicing: 1
|
||||
dither: 0.00001
|
||||
pad_to: 0
|
||||
|
||||
spec_augment:
|
||||
_target_: nemo.collections.asr.modules.SpectrogramAugmentation
|
||||
freq_masks: 2 # set to zero to disable it
|
||||
time_masks: 10 # set to zero to disable it
|
||||
freq_width: 27
|
||||
time_width: 0.05
|
||||
|
||||
encoder:
|
||||
_target_: nemo.collections.asr.modules.ConformerEncoder
|
||||
feat_in: ${model.preprocessor.features}
|
||||
feat_out: -1 # you may set it if you need different output size other than the default d_model
|
||||
n_layers: 16
|
||||
d_model: 256
|
||||
|
||||
# Sub-sampling params
|
||||
subsampling: striding # vggnet or striding
|
||||
subsampling_factor: 4 # must be power of 2
|
||||
subsampling_conv_channels: -1 # set to -1 to make it equal to the d_model
|
||||
|
||||
# Feed forward module's params
|
||||
ff_expansion_factor: 4
|
||||
|
||||
# Multi-headed Attention Module's params
|
||||
self_attention_model: rel_pos # rel_pos or abs_pos
|
||||
n_heads: 4
|
||||
xscaling: true # scales up the inputs by sqrt(d_model)
|
||||
untie_biases: true # unties the biases of the TransformerXL layers
|
||||
pos_emb_max_len: 5000
|
||||
|
||||
# Convolution module's params
|
||||
conv_kernel_size: 31
|
||||
|
||||
### regularization
|
||||
dropout: 0.1 # The dropout used in most of the Conformer Modules
|
||||
dropout_emb: 0.0 # The dropout used for embeddings
|
||||
dropout_att: 0.1 # The dropout for multi-headed attention modules
|
||||
|
||||
decoder:
|
||||
_target_: nemo.collections.asr.modules.RNNTDecoder
|
||||
normalization_mode: null
|
||||
random_state_sampling: false
|
||||
blank_as_pad: true
|
||||
|
||||
prednet:
|
||||
pred_hidden: ${model.model_defaults.pred_hidden}
|
||||
pred_rnn_layers: 1
|
||||
t_max: null
|
||||
dropout: 0.1
|
||||
|
||||
joint:
|
||||
_target_: nemo.collections.asr.modules.RNNTJoint
|
||||
log_softmax: null # 'null' would set it automatically according to CPU/GPU device
|
||||
|
||||
# fused mode
|
||||
experimental_fuse_loss_wer: true
|
||||
fused_batch_size: 16
|
||||
|
||||
jointnet:
|
||||
joint_hidden: ${model.model_defaults.joint_hidden}
|
||||
activation: "relu"
|
||||
dropout: 0.1
|
||||
|
||||
decoding:
|
||||
strategy: "greedy_batch"
|
||||
|
||||
# greedy strategy config
|
||||
greedy:
|
||||
max_symbols: 30
|
||||
|
||||
# beam strategy config
|
||||
beam:
|
||||
beam_size: 2
|
||||
score_norm: true
|
||||
tsd_max_sym_exp: 50 # for Time Synchronous Decoding
|
||||
alsd_max_target_len: 2.0 # for Alignment-Length Synchronous Decoding
|
||||
|
||||
optim:
|
||||
name: adam
|
||||
lr: 5.0
|
||||
# optimizer arguments
|
||||
betas: [0.9, 0.98]
|
||||
weight_decay: 1e-6
|
||||
|
||||
# scheduler setup
|
||||
sched:
|
||||
name: NoamAnnealing
|
||||
d_model: ${model.encoder.d_model}
|
||||
# scheduler config override
|
||||
warmup_steps: 10000
|
||||
warmup_ratio: null
|
||||
min_lr: 1e-6
|
||||
|
||||
trainer:
|
||||
gpus: -1 # number of GPUs, -1 would use all available GPUs
|
||||
num_nodes: 1
|
||||
max_epochs: 1000
|
||||
max_steps: null # computed at runtime if not set
|
||||
val_check_interval: 1.0 # Set to 0.25 to check 4 times per epoch, or an int for number of iterations
|
||||
accelerator: ddp
|
||||
accumulate_grad_batches: 1
|
||||
gradient_clip_val: 0.0
|
||||
amp_level: O0 # O1/O2 for mixed precision
|
||||
precision: 32 # Should be set to 16 for O1 and O2 to enable the AMP.
|
||||
log_every_n_steps: 10 # Interval of logging.
|
||||
progress_bar_refresh_rate: 10
|
||||
resume_from_checkpoint: null # The path to a checkpoint file to continue the training, restores the whole state including the epoch, step, LR schedulers, apex, etc.
|
||||
num_sanity_val_steps: 0 # number of steps to perform validation steps for sanity check the validation process before starting the training, setting to 0 disables it
|
||||
check_val_every_n_epoch: 1 # number of evaluations on validation every n epochs
|
||||
sync_batchnorm: true
|
||||
checkpoint_callback: false # Provided by exp_manager
|
||||
logger: false # Provided by exp_manager
|
||||
|
||||
|
||||
exp_manager:
|
||||
exp_dir: null
|
||||
name: ${name}
|
||||
create_tensorboard_logger: true
|
||||
create_checkpoint_callback: true
|
||||
checkpoint_callback_params:
|
||||
# in case of multiple validation sets, first one is used
|
||||
monitor: "val_wer"
|
||||
mode: "min"
|
||||
save_top_k: 3
|
||||
resume_if_exists: false
|
||||
resume_ignore_no_checkpoint: false
|
||||
|
||||
create_wandb_logger: false
|
||||
wandb_logger_kwargs:
|
||||
name: null
|
||||
project: null
|
||||
Reference in New Issue
Block a user