espnetez.task.get_ez_task_with_dataset
Less than 1 minute
espnetez.task.get_ez_task_with_dataset
espnetez.task.get_ez_task_with_dataset(task_name: str) → AbsTask
Create an ESPnet-EZ task class with a custom dataset for a given task.
This function returns a task class that inherits from the specified task class in the ESPnet framework, enabling the use of custom datasets for training and validation. The created task class includes methods for building models and iterators specifically tailored for handling datasets.
- Parameters:task_name (str) – The name of the task for which the class is being created. This should correspond to one of the predefined task classes in the ESPnet framework, such as ‘asr’, ‘tts’, etc.
- Returns: A subclass of AbsTask that supports custom datasets for the : specified task.
- Return type:AbsTask
Examples
>>> from espnetez.task import get_ez_task_with_dataset
>>> custom_asr_task = get_ez_task_with_dataset("asr")
>>> custom_asr_task.train_dataset = my_custom_train_dataset
>>> custom_asr_task.valid_dataset = my_custom_valid_dataset
>>> model = custom_asr_task.build_model(args)
>>> iterator = custom_asr_task.build_iter_factory(args, distributed_option,
mode='train')
NOTE
Ensure that the specified task name is valid and that the corresponding task class is available in the TASK_CLASSES dictionary. The created task class will need to have its train_dataset and valid_dataset attributes set to the appropriate dataset instances before training.