File size: 4,148 Bytes
79fc1a1 9f999c7 79fc1a1 24f6fb4 79fc1a1 24f6fb4 79fc1a1 9f999c7 79fc1a1 9f999c7 79fc1a1 9f999c7 79fc1a1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | # ############################################################################
# BoundaryClassifier β hyperparameters
#
# Purpose : Train a Joiner-style binary classifier (see models/boundary_classifier.py)
# that, at each streaming chunk boundary, predicts whether the last
# emitted subword ends a complete word (boundary=1) or not (boundary=0).
#
# Workflow :
# 1. create_boundary_dataset.py β extracts (enc_feat, pred_feat, label) pairs
# from LibriSpeech using the frozen streaming ASR model and saves them
# as .pt files under <dataset_dir>.
# 2. train_boundary_classifier.py β trains BoundaryClassifier on those files.
#
# Usage examples
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# # Step 1 β create dataset
# python data/create_boundary_dataset.py hparams/boundary_classifier.yaml
#
# # Step 2 β train
# python train/train_boundary_classifier.py hparams/boundary_classifier.yaml
# ############################################################################
seed: 42
__set_seed: !apply:speechbrain.utils.seed_everything [42]
# ββ ASR model (frozen feature extractor) ββββββββββββββββββββββββββββββββββββ
# Path to the YAML used to train the streaming ASR model.
asr_hparams_file: /home/streamalign/streamASR/hparams/chunk_streaming_word_fastemit.yaml
# Path to a checkpoint directory (must contain model.ckpt and normalizer.ckpt).
asr_checkpoint: /home/streamalign/streamASR/results/conformer_transducer_char/word_fastemit/save/word_asr_ckpt
# Path to a sentencepiece tokenizer checkpoint (tokenizer.ckpt).
# If null the script searches <asr_checkpoint>/../../pretrained/tokenizer.ckpt.
tokenizer_ckpt: /home/streamalign/streamASR/results/conformer_transducer_char/word_fastemit/pretrained/tokenizer.ckpt
# ββ Streaming configuration (must match the ASR model's inference setting) ββ
chunk_size: 4 # encoder output frames per chunk (~40 ms / chunk)
left_context: 32 # left context in # of chunks
# ββ Dataset ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# LibriSpeech root directory (contains train-clean-100/, dev-clean/, β¦)
data_folder: /home/datasets/LibriSpeech
# Splits used for dataset creation.
train_splits:
- train-clean-100
- train-clean-360
- train-other-500
valid_split:
- dev-clean
- test-clean
# Directory where the pre-extracted .pt dataset files are written / read from.
dataset_dir: /home/streamalign/streamASR/data/boundary_dataset
# ββ BoundaryClassifier architecture βββββββββββββββββββββββββββββββββββββββββ
joint_dim: 640 # must match the ASR model's joint_dim
hidden_dim: 512 # width of hidden MLP layers
num_layers: 3 # total linear layers (2 hidden + 1 output)
dropout: 0.1 # dropout after each hidden GELU
# ββ Training βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
number_of_epochs: 50
lr: 0.001
weight_decay: 0.01
batch_size: 512
num_workers: 4
# Weight for the non-boundary class (label=0).
# Boundary tokens are the majority class (many words are single BPE tokens),
# so upweight the non-boundary class to compensate.
neg_weight: 3.0
# ββ Output βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
output_folder: /home/streamalign/streamASR/train/results/boundary_classifier_0416
checkpoint_folder: !ref <output_folder>/save
train_log: !ref <output_folder>/train_log.txt
|