espnetez.task.get_ez_task
Less than 1 minute
espnetez.task.get_ez_task
espnetez.task.get_ez_task(task_name: str, use_custom_dataset: bool = False) → AbsTask
Retrieve a customized task class for the ESPnet-EZ framework.
This function returns a task class based on the specified task name. If the use_custom_dataset flag is set to True, a version of the task class that supports custom datasets will be returned. The returned class inherits from the appropriate base task class and may be extended with additional functionality.
- Parameters:
- task_name (str) – The name of the task to retrieve. This must be one of the keys defined in the TASK_CLASSES dictionary, such as ‘asr’, ‘mt’, ‘tts’, etc.
- use_custom_dataset (bool , optional) – A flag indicating whether to use a version of the task class that supports custom datasets. Defaults to False.
- Returns: An instance of the task class corresponding to the provided task_name. If use_custom_dataset is True, the returned class will be capable of handling custom datasets.
- Return type:AbsTask
- Raises:KeyError – If task_name is not found in the TASK_CLASSES dictionary.
Examples
>>> asr_task = get_ez_task("asr")
>>> custom_asr_task = get_ez_task("asr", use_custom_dataset=True)
>>> mt_task = get_ez_task("mt")
>>> custom_mt_task = get_ez_task("mt", use_custom_dataset=True)
NOTE
The task classes are designed to be used within the ESPnet-EZ framework, which allows for flexibility in handling various speech and language tasks. Ensure that the required dependencies for the specific task are properly installed and configured.