espnet3.systems.esp2_asr.system.ASRSystem
espnet3.systems.esp2_asr.system.ASRSystem
class espnet3.systems.esp2_asr.system.ASRSystem(, configs: Mapping[str, DictConfig | None], exp_dir: Path | None = None, stages_to_run: Sequence[str] | None = None)
Bases: BaseSystem
ASR-specific system.
This system adds train_tokenizer (its log goes under tokenizer.save_path of its own stage config), run before train trains the tokenizer if it is not already cached.
######### Examples
>>> [s.name for s in ASRSystem.stages[:2]]
['create_dataset', 'train_tokenizer']Build each requested stage’s config and hold it, by stage name.
- Parameters:
- configs – Each config role’s own config (its default plus whatever the caller loaded), not yet resolved, keyed by role name (
"training","inference", …). A role this system has no stage for is ignored; a role it does have a stage for but that is missing here is treated as empty. A stage that needs its ownrecipe_dirreads it from its own config (self.stage_configs[stage].recipe_dir), not from a separate constructor argument. - exp_dir – The experiment directory to bake stage configs under and read earlier baked configs from. When None, derived from the first given config whose own exp_dir resolves by itself (see _exp_dir_from); if none does, raises.
- stages_to_run – The stages this run actually requests. Only these (and the earlier stages they inherit from) have their config built and resolved; a later stage’s missing identity never stops construction. None builds every declared stage.
- configs – Each config role’s own config (its default plus whatever the caller loaded), not yet resolved, keyed by role name (
- Raises:ConfigError – exp_dir is not given and no config in configs has a self-resolving exp_dir.
Notes
Each stage’s config is its own DictConfig object - the earlier stages’ own keys (this run’s, in memory, or an earlier run’s baked file), then this stage’s own config on top, then resolved. No two stages share one config object, so one stage popping or overwriting a key never affects another.
stages : ClassVar[tuple[StageSpec, ...]] = (StageSpec(name='create_dataset', config='training', log_dir='data_dir', dir_aliases=()), StageSpec(name='train_tokenizer', config='training', log_dir='tokenizer.save_path', dir_aliases=()), StageSpec(name='collect_stats', config='training', log_dir='stats_dir', dir_aliases=()), StageSpec(name='train', config='training', log_dir='exp_dir', dir_aliases=()), StageSpec(name='infer', config='inference', log_dir='inference_dir', dir_aliases=()), StageSpec(name='measure', config='metrics', log_dir='inference_dir', dir_aliases=()), StageSpec(name='pack_model', config=('training', 'publication'), log_dir=None, dir_aliases=()), StageSpec(name='upload_model', config='publication', log_dir=None, dir_aliases=()), StageSpec(name='pack_demo', config='demo', log_dir='pack.out_dir', dir_aliases=()), StageSpec(name='upload_demo', config='demo', log_dir='pack.out_dir', dir_aliases=()))
train(*args, **kwargs)
Train the model, training the tokenizer first if needed.
This stage checks for a cached tokenizer model and runs tokenizer training before delegating to the base training routine.
- Raises:RuntimeError – If neither dataset references nor
dataset_direxist.
######### Examples
>>> system = ASRSystem(configs={"training": training_config})
>>> system.train()train_tokenizer(*args, **kwargs)
Train a SentencePiece tokenizer based on configured text.
The text builder configured in this stage’s own tokenizer.text_builder is used to generate training text, which is then saved and consumed by the SentencePiece trainer.
- Raises:RuntimeError – If required tokenizer config is missing or invalid.
######### Examples
>>> system = ASRSystem(configs={"training": training_config})
>>> system.train_tokenizer()