-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[squeezeformer] add Squeezeformer (#1447)
* [init] enable SqueezeformerEncoder * [update] enable Squeezeformer training * [update] README.md * fix formatting issues * fix formatting issues * fix formatting issues * fix formatting issues * [update] change residual connection & add copyrights * fix formatting issues * [update] enlarge adaptive scale dimensions * fix formatting issues * fix adaptive scale bugs * [update] encoder.py(fix init weights bugs) and README.md * [update] initialization for input projection * fix formatting issues * fix formatting issues * [update] time reduction layer with conv1d and conv2d * fix formatting issues * [update] operators * [update] experiment results & code format * [update] experiment results * [update] streaming support & results, dw_stride trigger * fix formatting issue * fix formatting issue * fix formatting issue * fix formatting issue * [update] SqueezeFormer Large Results * fix formatting issues * fix format issues Co-authored-by: xmly <[email protected]>
- Loading branch information
Showing
13 changed files
with
2,197 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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,88 @@ | ||
# network architecture | ||
# encoder related | ||
encoder: squeezeformer | ||
encoder_conf: | ||
encoder_dim: 256 | ||
output_size: 256 # dimension of attention | ||
attention_heads: 4 | ||
num_blocks: 12 # the number of encoder blocks | ||
reduce_idx: 5 | ||
recover_idx: 11 | ||
pos_enc_layer_type: 'rel_pos' | ||
time_reduction_layer_type: 'conv1d' | ||
feed_forward_expansion_factor: 4 | ||
input_dropout_rate: 0.1 | ||
feed_forward_dropout_rate: 0.1 | ||
attention_dropout_rate: 0.1 | ||
cnn_module_kernel: 31 | ||
cnn_norm_type: layer_norm | ||
adaptive_scale: true | ||
normalize_before: false | ||
|
||
# decoder related | ||
decoder: transformer | ||
decoder_conf: | ||
attention_heads: 4 | ||
linear_units: 2048 | ||
num_blocks: 6 | ||
dropout_rate: 0.1 | ||
positional_dropout_rate: 0.1 | ||
self_attention_dropout_rate: 0.0 | ||
src_attention_dropout_rate: 0.0 | ||
|
||
# hybrid CTC/attention | ||
model_conf: | ||
ctc_weight: 0.3 | ||
lsm_weight: 0.1 # label smoothing option | ||
length_normalized_loss: false | ||
|
||
# dataset related | ||
dataset_conf: | ||
filter_conf: | ||
max_length: 2000 | ||
min_length: 50 | ||
token_max_length: 400 | ||
token_min_length: 1 | ||
min_output_input_ratio: 0.0005 | ||
max_output_input_ratio: 0.1 | ||
resample_conf: | ||
resample_rate: 16000 | ||
speed_perturb: true | ||
fbank_conf: | ||
num_mel_bins: 80 | ||
frame_shift: 10 | ||
frame_length: 25 | ||
dither: 0.1 | ||
spec_aug: true | ||
spec_aug_conf: | ||
num_t_mask: 2 | ||
num_f_mask: 2 | ||
max_t: 50 | ||
max_f: 10 | ||
shuffle: true | ||
shuffle_conf: | ||
shuffle_size: 1500 | ||
sort: true | ||
sort_conf: | ||
sort_size: 500 # sort_size should be less than shuffle_size | ||
batch_conf: | ||
batch_type: 'static' # static or dynamic | ||
batch_size: 12 | ||
|
||
grad_clip: 5 | ||
accum_grad: 4 | ||
max_epoch: 120 | ||
log_interval: 100 | ||
|
||
optim: adamw | ||
optim_conf: | ||
lr: 1.e-3 | ||
weight_decay: 4.e-5 | ||
|
||
scheduler: NoamHoldAnnealing | ||
scheduler_conf: | ||
warmup_ratio: 0.2 | ||
hold_ratio: 0.3 | ||
max_steps: 87960 | ||
decay_rate: 1.0 | ||
min_lr: 1.e-5 |
96 changes: 96 additions & 0 deletions
96
examples/librispeech/s0/conf/train_squeezeformer_bidecoder_large.yaml
This file contains 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,96 @@ | ||
# network architecture | ||
# encoder related | ||
encoder: squeezeformer | ||
encoder_conf: | ||
encoder_dim: 512 | ||
output_size: 512 # dimension of attention | ||
attention_heads: 8 | ||
num_blocks: 12 # the number of encoder blocks | ||
reduce_idx: 5 | ||
recover_idx: 11 | ||
feed_forward_expansion_factor: 4 | ||
input_dropout_rate: 0.1 | ||
feed_forward_dropout_rate: 0.1 | ||
attention_dropout_rate: 0.1 | ||
cnn_module_kernel: 31 | ||
cnn_norm_type: batch_norm | ||
adaptive_scale: true | ||
normalize_before: false | ||
|
||
# decoder related | ||
decoder: bitransformer | ||
decoder_conf: | ||
attention_heads: 8 | ||
linear_units: 2048 | ||
num_blocks: 3 | ||
r_num_blocks: 3 | ||
dropout_rate: 0.1 | ||
positional_dropout_rate: 0.1 | ||
self_attention_dropout_rate: 0.1 | ||
src_attention_dropout_rate: 0.1 | ||
|
||
# hybrid CTC/attention | ||
model_conf: | ||
ctc_weight: 0.3 | ||
lsm_weight: 0.1 # label smoothing option | ||
length_normalized_loss: false | ||
reverse_weight: 0.3 | ||
|
||
# dataset related | ||
dataset_conf: | ||
syncbn: true | ||
filter_conf: | ||
max_length: 2000 | ||
min_length: 50 | ||
token_max_length: 400 | ||
token_min_length: 1 | ||
min_output_input_ratio: 0.0005 | ||
max_output_input_ratio: 0.1 | ||
resample_conf: | ||
resample_rate: 16000 | ||
speed_perturb: true | ||
fbank_conf: | ||
num_mel_bins: 80 | ||
frame_shift: 10 | ||
frame_length: 25 | ||
dither: 1.0 | ||
spec_aug: true | ||
spec_aug_conf: | ||
num_t_mask: 3 | ||
num_f_mask: 2 | ||
max_t: 100 | ||
max_f: 27 | ||
max_w: 80 | ||
# warp_for_time: true | ||
spec_sub: true | ||
spec_sub_conf: | ||
num_t_sub: 3 | ||
max_t: 30 | ||
shuffle: true | ||
shuffle_conf: | ||
shuffle_size: 1500 | ||
sort: true | ||
sort_conf: | ||
sort_size: 500 # sort_size should be less than shuffle_size | ||
batch_conf: | ||
batch_type: 'static' # static or dynamic | ||
batch_size: 12 | ||
|
||
grad_clip: 5 | ||
accum_grad: 4 | ||
max_epoch: 500 | ||
log_interval: 100 | ||
|
||
optim: adamw | ||
optim_conf: | ||
lr: 1.e-3 | ||
weight_decay: 4.e-5 | ||
|
||
scheduler: NoamHoldAnnealing | ||
scheduler_conf: | ||
warmup_ratio: 0.2 | ||
hold_ratio: 0.3 | ||
max_steps: 87960 | ||
decay_rate: 1.0 | ||
min_lr: 1.e-5 | ||
|
Oops, something went wrong.