Skip to content

Commit 8edb0bf

Browse files
committed
Zero-shot post fixes new
1 parent 9ce42cc commit 8edb0bf

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

src/fairseq2/recipes/wav2vec2/asr/_train.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from __future__ import annotations
88

99
import socket
10-
1110
from dataclasses import dataclass, field
1211
from pathlib import Path
1312
from typing import cast, final, Literal
@@ -173,6 +172,12 @@ class Wav2Vec2AsrTrainDatasetSection(DatasetSection):
173172
max_num_batches: int | None = None
174173
"""The maximum number of batches for the dataloader to return."""
175174

175+
always_read_tsv: bool = False
176+
"""If ``True``, always read the TSV manifest, regardless of whether parquet datasets exist."""
177+
178+
extras: dict[str, object] = field(default_factory=dict)
179+
"""The dataset-specific extra options."""
180+
176181
# Upsampling
177182
beta_corpus: float | None = None
178183
beta_language: float | None = None
@@ -186,14 +191,13 @@ class Wav2Vec2AsrTrainDatasetSection(DatasetSection):
186191
spec_aug_time_mask_param: int = 80
187192
"""Maximum time mask length."""
188193

189-
always_read_tsv: bool = False
190-
"""If ``True``, always read the TSV manifest, regardless of whether parquet datasets exist."""
191-
192-
extras: dict[str, object] = field(default_factory=dict)
193-
"""The dataset-specific extra options."""
194-
194+
# Zero/Few-shot
195195
n_context_examples: int = 0
196196
"""The number of context examples to use when providing context."""
197+
bucket_size_train: int = 2000
198+
"""Minimum size of pool for choosing context examples, for training set."""
199+
bucket_size_eval: int = 30
200+
"""Minimum size of pool for choosing context examples, for eval sets."""
197201

198202

199203
@dataclass(kw_only=True)
@@ -435,7 +439,7 @@ def load_wav2vec2_asr_trainer(
435439
spec_aug_time_mask_param=config.dataset.spec_aug_time_mask_param,
436440
max_num_batches=config.dataset.max_num_batches,
437441
n_context_examples=config.dataset.n_context_examples,
438-
bucket_size=2000,
442+
bucket_size=config.dataset.bucket_size_train,
439443
deterministic_context=False,
440444
)
441445

@@ -482,7 +486,7 @@ def load_wav2vec2_asr_trainer(
482486
max_num_batches=config.dataset.max_num_batches,
483487
extras=config.dataset.extras,
484488
n_context_examples=config.dataset.n_context_examples,
485-
bucket_size=30,
489+
bucket_size=config.dataset.bucket_size_eval,
486490
deterministic_context=True,
487491
)
488492

0 commit comments

Comments
 (0)