dd3434 commited on
Commit
6cebc8e
·
verified ·
1 Parent(s): b7c3e49

Upload alignment.yaml with huggingface_hub

Browse files
Files changed (1) hide show
  1. alignment.yaml +368 -0
alignment.yaml ADDED
@@ -0,0 +1,368 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Generated 2026-02-02 from:
2
+ # /gallery_rijks/jinyoung.park/streamalign/streamASR/hparams/train_chunk_streaming.yaml
3
+ # yamllint disable
4
+ # ############################################################################
5
+ # Model: E2E ASR with Conformer Transducer (Character-level)
6
+ # Encoder: Conformer with Dynamic Chunk Training
7
+ # Decoder: LSTM + greedy/beam search
8
+ # Tokens: Character-level (no BPE)
9
+ # Losses: Transducer + CTC (optional)
10
+ # Training: Librispeech
11
+ #
12
+ # Modified for character-level prediction and CER evaluation
13
+ # ############################################################################
14
+
15
+ seed: 3407
16
+ __set_seed: !apply:speechbrain.utils.seed_everything [3407]
17
+ output_folder: results/conformer_transducer_char/3407
18
+ output_wer_folder: results/conformer_transducer_char/3407/
19
+ save_folder: results/conformer_transducer_char/3407/save
20
+ train_log: results/conformer_transducer_char/3407/train_log.txt
21
+
22
+ # Data files
23
+ data_folder: /gallery_rijks/jinyoung.park/datasets/LibriTTS
24
+
25
+ # Files to hold the manifest data
26
+ train_json: !ref <save_folder>/train.json
27
+ valid_json: !ref <save_folder>/valid.json
28
+ test_json: !ref <save_folder>/test.json
29
+
30
+ # Data splits
31
+ train_split: ["train-clean-100", "train-clean-360", "train-other-500"]
32
+ valid_split: ["dev-clean", "dev-other"]
33
+ test_split: ["test-clean", "test-other"]
34
+
35
+ skip_prep: false
36
+ ckpt_interval_minutes: 5
37
+ ####################### Training Parameters ####################################
38
+
39
+ number_of_epochs: 100
40
+ warmup_steps: 25000
41
+ num_workers: 4
42
+ batch_size_valid: 4
43
+ lr: 0.0008
44
+ weight_decay: 0.01
45
+ number_of_ctc_epochs: 60
46
+ ctc_weight: 0.3
47
+ ce_weight: 0.0
48
+ max_grad_norm: 5.0
49
+ loss_reduction: batchmean
50
+ precision: fp16
51
+
52
+ batch_size: 8
53
+ grad_accumulation_factor: 4
54
+ sorting: random
55
+ avg_checkpoints: 10
56
+
57
+ # Feature parameters
58
+ sample_rate: 16000
59
+ n_fft: 512
60
+ n_mels: 80
61
+ win_length: 32
62
+
63
+ # ============================================================================
64
+ # Streaming & Dynamic Chunk Training
65
+ # ============================================================================
66
+ streaming: true
67
+
68
+ dynchunktrain_config_sampler: !new:speechbrain.utils.dynamic_chunk_training.DynChunkTrainConfigRandomSampler
69
+ chunkwise_prob: 0.6
70
+ chunk_size_min: 8
71
+ chunk_size_max: 32
72
+ limited_left_context_prob: 0.75
73
+ left_context_chunks_min: 2
74
+ left_context_chunks_max: 32
75
+ # Validation uses same streaming config as test
76
+ valid_config: !new:speechbrain.utils.dynamic_chunk_training.DynChunkTrainConfig
77
+ chunk_size: 16
78
+ left_context_size: 8
79
+ # Test config with specific streaming parameters
80
+ test_config: !new:speechbrain.utils.dynamic_chunk_training.DynChunkTrainConfig
81
+ chunk_size: 16
82
+ left_context_size: 8
83
+
84
+ # Dataloader options
85
+ train_dataloader_opts:
86
+ batch_size: 8
87
+ num_workers: 4
88
+
89
+ valid_dataloader_opts:
90
+ batch_size: 4
91
+
92
+ test_dataloader_opts:
93
+ batch_size: 4
94
+
95
+ # Dynamic batching
96
+ dynamic_batching: true
97
+ max_batch_len: 150
98
+ max_batch_len_val: 50
99
+ num_bucket: 200
100
+
101
+ dynamic_batch_sampler:
102
+ max_batch_len: 150
103
+ max_batch_len_val: 50
104
+ num_buckets: 200
105
+ shuffle_ex: true
106
+ batch_ordering: random
107
+ max_batch_ex: 256
108
+
109
+ ####################### Model Parameters #######################################
110
+
111
+ # Transformer/Conformer
112
+ d_model: 512
113
+ joint_dim: 640
114
+ nhead: 8
115
+ num_encoder_layers: 12
116
+ num_decoder_layers: 0
117
+ d_ffn: 2048
118
+ transformer_dropout: 0.1
119
+ activation: &id005 !name:torch.nn.GELU
120
+
121
+
122
+ # ============================================================================
123
+ # Character-level output
124
+ # 72 characters + blank = 73 tokens (CTC_VOCAB_SIZE)
125
+ # space/punct/a-z/accented (0-71) + blank (72)
126
+ # ============================================================================
127
+ output_neurons: 73
128
+
129
+ # Decoder
130
+ dec_dim: 512
131
+ dec_emb_dropout: 0.2
132
+ dec_dropout: 0.1
133
+ attention_type: RelPosMHAXL
134
+
135
+ # Decoding parameters
136
+ blank_index: 72
137
+ bos_index: 72
138
+ eos_index: 72
139
+ pad_index: 72
140
+ beam_size: 10
141
+ nbest: 1
142
+ state_beam: 2.3
143
+ expand_beam: 2.3
144
+
145
+ # If True uses torchaudio loss
146
+ use_torchaudio: false
147
+
148
+ epoch_counter: &id019 !new:speechbrain.utils.epoch_loop.EpochCounter
149
+
150
+ limit: 100
151
+
152
+ normalize: &id013 !new:speechbrain.processing.features.InputNormalization
153
+ norm_type: global
154
+ update_until_epoch: 4
155
+
156
+ compute_features: &id021 !new:speechbrain.lobes.features.Fbank
157
+ sample_rate: 16000
158
+ n_fft: 512
159
+ n_mels: 80
160
+ win_length: 32
161
+
162
+ ############################## Augmentations ###################################
163
+
164
+ speed_perturb: &id001 !new:speechbrain.augment.time_domain.SpeedPerturb
165
+ orig_freq: 16000
166
+ speeds: [95, 100, 105]
167
+
168
+ wav_augment: !new:speechbrain.augment.augmenter.Augmenter
169
+ min_augmentations: 1
170
+ max_augmentations: 1
171
+ augment_prob: 1.0
172
+ augmentations: [*id001]
173
+
174
+ time_drop: &id002 !new:speechbrain.augment.freq_domain.SpectrogramDrop
175
+ drop_length_low: 12
176
+ drop_length_high: 20
177
+ drop_count_low: 5
178
+ drop_count_high: 5
179
+ replace: zeros
180
+
181
+ freq_drop: &id003 !new:speechbrain.augment.freq_domain.SpectrogramDrop
182
+ drop_length_low: 20
183
+ drop_length_high: 25
184
+ drop_count_low: 2
185
+ drop_count_high: 2
186
+ replace: zeros
187
+ dim: 2
188
+
189
+ time_warp: &id004 !new:speechbrain.augment.freq_domain.Warping
190
+
191
+ fea_augment: !new:speechbrain.augment.augmenter.Augmenter
192
+ parallel_augment: false
193
+ concat_original: false
194
+ repeat_augment: 1
195
+ shuffle_augmentations: false
196
+ min_augmentations: 3
197
+ max_augmentations: 3
198
+ augment_prob: 1.0
199
+ augmentations: [*id002, *id003, *id004]
200
+
201
+ ############################## Pretrained ###################################
202
+ pretrained_source: speechbrain/asr-streaming-conformer-librispeech
203
+ pretrained_save: results/conformer_transducer_char/3407/pretrained
204
+
205
+
206
+ ############################## Models ##########################################
207
+
208
+ CNN: &id007 !new:speechbrain.lobes.models.convolution.ConvolutionFrontEnd
209
+ input_shape: (8, 10, 80)
210
+ num_blocks: 2
211
+ num_layers_per_block: 1
212
+ out_channels: (64, 32)
213
+ kernel_sizes: (3, 3)
214
+ strides: (2, 2)
215
+ residuals: (False, False)
216
+
217
+ Transformer: &id006 !new:models.TransformerASR.TransformerASR
218
+
219
+ input_size: 640
220
+ tgt_vocab: 73
221
+ d_model: 512
222
+ nhead: 8
223
+ num_encoder_layers: 12
224
+ num_decoder_layers: 0
225
+ d_ffn: 2048
226
+ dropout: 0.1
227
+ activation: *id005
228
+ encoder_module: conformer
229
+ attention_type: RelPosMHAXL
230
+ normalize_before: true
231
+ output_hidden_states: true
232
+ causal: false
233
+
234
+ enc: &id008 !new:models.TransformerASR.EncoderWrapper
235
+ transformer: *id006
236
+ proj_ctc: &id014 !new:speechbrain.nnet.linear.Linear
237
+ input_size: 640
238
+ n_neurons: 73
239
+
240
+ proj_enc: &id016 !new:speechbrain.nnet.linear.Linear
241
+
242
+ input_size: 512
243
+ n_neurons: 640
244
+ bias: false
245
+
246
+ proj_dec: &id015 !new:speechbrain.nnet.linear.Linear
247
+ input_size: 512
248
+ n_neurons: 640
249
+ bias: false
250
+
251
+ ctc_cost: !name:speechbrain.nnet.losses.ctc_loss
252
+ blank_index: 72
253
+ reduction: batchmean
254
+
255
+ # Character embedding (output_neurons - 1 because blank is handled separately)
256
+ emb: &id009 !new:speechbrain.nnet.embedding.Embedding
257
+ num_embeddings: 73
258
+ consider_as_one_hot: true
259
+ blank_id: 72
260
+
261
+ dec: &id010 !new:speechbrain.nnet.RNN.LSTM
262
+ input_shape: [null, null, 72]
263
+ hidden_size: 512
264
+ num_layers: 1
265
+ re_init: true
266
+
267
+ ce_cost: !name:speechbrain.nnet.losses.nll_loss
268
+ label_smoothing: 0.1
269
+
270
+ Tjoint: &id011 !new:speechbrain.nnet.transducer.transducer_joint.Transducer_joint
271
+ joint: sum
272
+ nonlinearity: *id005
273
+ transducer_lin: &id012 !new:speechbrain.nnet.linear.Linear
274
+ input_size: 640
275
+ n_neurons: 73
276
+ bias: false
277
+
278
+ log_softmax: !new:speechbrain.nnet.activations.Softmax
279
+ apply_log: true
280
+
281
+ transducer_cost: !name:speechbrain.nnet.losses.transducer_loss
282
+ blank_index: 72
283
+ use_torchaudio: false
284
+
285
+ modules:
286
+ CNN: *id007
287
+ enc: *id008
288
+ emb: *id009
289
+ dec: *id010
290
+ Tjoint: *id011
291
+ transducer_lin: *id012
292
+ normalize: *id013
293
+ proj_ctc: *id014
294
+ proj_dec: *id015
295
+ proj_enc: *id016
296
+ model: &id017 !new:torch.nn.ModuleList
297
+ - [*id007, *id008, *id009, *id010, *id016, *id015, *id014, *id012]
298
+ Greedysearcher: &id020 !new:speechbrain.decoders.transducer.TransducerBeamSearcher
299
+ decode_network_lst: [*id009, *id010, *id015]
300
+ tjoint: *id011
301
+ classifier_network: [*id012]
302
+ blank_id: 72
303
+ beam_size: 1
304
+ nbest: 1
305
+
306
+ Beamsearcher: !new:speechbrain.decoders.transducer.TransducerBeamSearcher
307
+ decode_network_lst: [*id009, *id010, *id015]
308
+ tjoint: *id011
309
+ classifier_network: [*id012]
310
+ blank_id: 72
311
+ beam_size: 10
312
+ nbest: 1
313
+ state_beam: 2.3
314
+ expand_beam: 2.3
315
+
316
+ opt_class: !name:torch.optim.AdamW
317
+ lr: 0.0008
318
+ betas: (0.9, 0.98)
319
+ eps: 1.e-8
320
+ weight_decay: 0.01
321
+
322
+ noam_annealing: &id018 !new:speechbrain.nnet.schedulers.NoamScheduler
323
+ lr_initial: 0.0008
324
+ n_warmup_steps: 25000
325
+
326
+
327
+ ############################## Logging and Checkpointing #######################
328
+
329
+ checkpointer: !new:speechbrain.utils.checkpoints.Checkpointer
330
+ checkpoints_dir: results/conformer_transducer_char/3407/save
331
+ recoverables:
332
+ model: *id017
333
+ scheduler: *id018
334
+ normalizer: *id013
335
+ counter: *id019
336
+ train_logger: !new:speechbrain.utils.train_logger.WandBLogger
337
+ initializer: !name:wandb.init
338
+ project: streamingAlign
339
+ name: subalign
340
+ dir: results/conformer_transducer_char/3407/wandb
341
+ reinit: true
342
+ resume: false
343
+
344
+ # CER computer (character-level)
345
+ cer_computer: !name:speechbrain.utils.metric_stats.ErrorRateStats
346
+ split_tokens: true
347
+
348
+ ############################## Streaming Inference #############################
349
+
350
+ # Streaming configuration for inference
351
+ # chunk_size: frames per chunk (8 frames ≈ 320ms after 4x subsampling)
352
+ # left_context_size: number of left context chunks
353
+ streaming_chunk_size: 16
354
+ streaming_left_context: 8
355
+
356
+ # Create streaming context for the decoder
357
+ make_decoder_streaming_context: !name:speechbrain.decoders.transducer.TransducerGreedySearcherStreamingContext
358
+
359
+ # Streaming decoding function
360
+ decoding_function: !name:speechbrain.decoders.transducer.TransducerBeamSearcher.transducer_greedy_decode_streaming
361
+ - *id020
362
+ fea_streaming_extractor: !new:speechbrain.lobes.features.StreamingFeatureWrapper
363
+ module: !new:speechbrain.nnet.containers.LengthsCapableSequential
364
+ - *id021
365
+ - *id013
366
+ - *id007
367
+ properties: !apply:speechbrain.utils.filter_analysis.stack_filter_properties
368
+ - [*id021, *id007]