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