espnet2.tasks package

espnet2.tasks.svs

Singing-voice-synthesis task.

class espnet2.tasks.svs.SVSTask[source]

Bases: espnet2.tasks.abs_task.AbsTask

classmethod add_task_arguments(parser: argparse.ArgumentParser)[source]
classmethod build_collate_fn(args: argparse.Namespace, train: bool) → Callable[[Collection[Tuple[str, Dict[str, numpy.ndarray]]]], Tuple[List[str], Dict[str, torch.Tensor]]][source]

Return “collate_fn”, which is a callable object and given to DataLoader.

>>> from torch.utils.data import DataLoader
>>> loader = DataLoader(collate_fn=cls.build_collate_fn(args, train=True), ...)

In many cases, you can use our common collate_fn.

classmethod build_model(args: argparse.Namespace) → espnet2.svs.espnet_model.ESPnetSVSModel[source]
classmethod build_preprocess_fn(args: argparse.Namespace, train: bool) → Optional[Callable[[str, Dict[str, numpy.array], float], Dict[str, numpy.ndarray]]][source]
classmethod build_vocoder_from_file(vocoder_config_file: Union[pathlib.Path, str] = None, vocoder_file: Union[pathlib.Path, str] = None, model: Optional[espnet2.svs.espnet_model.ESPnetSVSModel] = None, device: str = 'cpu')[source]
class_choices_list = [<espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>]
num_optimizers = 1
classmethod optional_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the optional names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as follows,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “optional_data_names” should be as

>>> optional_data_names = ('opt',)
classmethod required_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the required names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as following,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “required_data_names” should be as

>>> required_data_names = ('input', 'output')
trainer

alias of espnet2.train.trainer.Trainer

espnet2.tasks.enh_s2t

class espnet2.tasks.enh_s2t.EnhS2TTask[source]

Bases: espnet2.tasks.abs_task.AbsTask

classmethod add_task_arguments(parser: argparse.ArgumentParser)[source]
classmethod build_collate_fn(args: argparse.Namespace, train: bool) → Callable[[Collection[Tuple[str, Dict[str, numpy.ndarray]]]], Tuple[List[str], Dict[str, torch.Tensor]]][source]

Return “collate_fn”, which is a callable object and given to DataLoader.

>>> from torch.utils.data import DataLoader
>>> loader = DataLoader(collate_fn=cls.build_collate_fn(args, train=True), ...)

In many cases, you can use our common collate_fn.

classmethod build_model(args: argparse.Namespace) → espnet2.enh.espnet_enh_s2t_model.ESPnetEnhS2TModel[source]
classmethod build_preprocess_fn(args: argparse.Namespace, train: bool) → Optional[Callable[[str, Dict[str, numpy.array]], Dict[str, numpy.ndarray]]][source]
class_choices_list = [<espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>]
num_optimizers = 1
classmethod optional_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the optional names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as follows,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “optional_data_names” should be as

>>> optional_data_names = ('opt',)
classmethod required_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the required names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as following,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “required_data_names” should be as

>>> required_data_names = ('input', 'output')
trainer

alias of espnet2.train.trainer.Trainer

espnet2.tasks.asvspoof

class espnet2.tasks.asvspoof.ASVSpoofTask[source]

Bases: espnet2.tasks.abs_task.AbsTask

classmethod add_task_arguments(parser: argparse.ArgumentParser)[source]
classmethod build_collate_fn(args: argparse.Namespace, train: bool) → Callable[[Collection[Tuple[str, Dict[str, numpy.ndarray]]]], Tuple[List[str], Dict[str, torch.Tensor]]][source]

Return “collate_fn”, which is a callable object and given to DataLoader.

>>> from torch.utils.data import DataLoader
>>> loader = DataLoader(collate_fn=cls.build_collate_fn(args, train=True), ...)

In many cases, you can use our common collate_fn.

classmethod build_model(args: argparse.Namespace) → espnet2.asvspoof.espnet_model.ESPnetASVSpoofModel[source]
classmethod build_preprocess_fn(args: argparse.Namespace, train: bool) → Optional[Callable[[str, Dict[str, numpy.array]], Dict[str, numpy.ndarray]]][source]
class_choices_list = [<espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>]
num_optimizers = 1
classmethod optional_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the optional names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as follows,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “optional_data_names” should be as

>>> optional_data_names = ('opt',)
classmethod required_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the required names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as following,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “required_data_names” should be as

>>> required_data_names = ('input', 'output')
trainer

alias of espnet2.train.trainer.Trainer

espnet2.tasks.hubert

class espnet2.tasks.hubert.HubertTask[source]

Bases: espnet2.tasks.abs_task.AbsTask

classmethod add_task_arguments(parser: argparse.ArgumentParser)[source]
classmethod build_collate_fn(args: argparse.Namespace, train: bool) → Callable[[Collection[Tuple[str, Dict[str, numpy.ndarray]]]], Tuple[List[str], Dict[str, torch.Tensor]]][source]

Return “collate_fn”, which is a callable object and given to DataLoader.

>>> from torch.utils.data import DataLoader
>>> loader = DataLoader(collate_fn=cls.build_collate_fn(args, train=True), ...)

In many cases, you can use our common collate_fn.

classmethod build_model(args: argparse.Namespace) → Union[espnet2.hubert.espnet_model.HubertPretrainModel, espnet2.hubert.espnet_model.TorchAudioHubertPretrainModel][source]
classmethod build_preprocess_fn(args: argparse.Namespace, train: bool) → Optional[Callable[[str, Dict[str, numpy.array]], Dict[str, numpy.ndarray]]][source]
class_choices_list = [<espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>]
num_optimizers = 1
classmethod optional_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the optional names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as follows,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “optional_data_names” should be as

>>> optional_data_names = ('opt',)
classmethod required_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the required names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as following,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “required_data_names” should be as

>>> required_data_names = ('input', 'output')
trainer

alias of espnet2.train.trainer.Trainer

espnet2.tasks.diar

class espnet2.tasks.diar.DiarizationTask[source]

Bases: espnet2.tasks.abs_task.AbsTask

classmethod add_task_arguments(parser: argparse.ArgumentParser)[source]
classmethod build_collate_fn(args: argparse.Namespace, train: bool) → Callable[[Collection[Tuple[str, Dict[str, numpy.ndarray]]]], Tuple[List[str], Dict[str, torch.Tensor]]][source]

Return “collate_fn”, which is a callable object and given to DataLoader.

>>> from torch.utils.data import DataLoader
>>> loader = DataLoader(collate_fn=cls.build_collate_fn(args, train=True), ...)

In many cases, you can use our common collate_fn.

classmethod build_model(args: argparse.Namespace) → espnet2.diar.espnet_model.ESPnetDiarizationModel[source]
classmethod build_preprocess_fn(args: argparse.Namespace, train: bool) → Optional[Callable[[str, Dict[str, numpy.array]], Dict[str, numpy.ndarray]]][source]
class_choices_list = [<espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>]
num_optimizers = 1
classmethod optional_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the optional names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as follows,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “optional_data_names” should be as

>>> optional_data_names = ('opt',)
classmethod required_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the required names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as following,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “required_data_names” should be as

>>> required_data_names = ('input', 'output')
trainer

alias of espnet2.train.trainer.Trainer

espnet2.tasks.spk

class espnet2.tasks.spk.SpeakerTask[source]

Bases: espnet2.tasks.abs_task.AbsTask

classmethod add_task_arguments(parser: argparse.ArgumentParser)[source]
classmethod build_collate_fn(args: argparse.Namespace, train: bool) → Callable[[Collection[Tuple[str, Dict[str, numpy.ndarray]]]], Tuple[List[str], Dict[str, torch.Tensor]]][source]

Return “collate_fn”, which is a callable object and given to DataLoader.

>>> from torch.utils.data import DataLoader
>>> loader = DataLoader(collate_fn=cls.build_collate_fn(args, train=True), ...)

In many cases, you can use our common collate_fn.

classmethod build_model(args: argparse.Namespace) → espnet2.spk.espnet_model.ESPnetSpeakerModel[source]
classmethod build_preprocess_fn(args: argparse.Namespace, train: bool) → Optional[Callable[[str, Dict[str, numpy.array]], Dict[str, numpy.ndarray]]][source]
class_choices_list = [<espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>]
num_optimizers = 1
classmethod optional_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the optional names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as follows,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “optional_data_names” should be as

>>> optional_data_names = ('opt',)
classmethod required_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the required names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as following,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “required_data_names” should be as

>>> required_data_names = ('input', 'output')
trainer

alias of espnet2.train.spk_trainer.SpkTrainer

espnet2.tasks.slu

class espnet2.tasks.slu.SLUTask[source]

Bases: espnet2.tasks.asr.ASRTask

classmethod add_task_arguments(parser: argparse.ArgumentParser)[source]
classmethod build_model(args: argparse.Namespace) → espnet2.slu.espnet_model.ESPnetSLUModel[source]
classmethod build_preprocess_fn(args: argparse.Namespace, train: bool) → Optional[Callable[[str, Dict[str, numpy.array]], Dict[str, numpy.ndarray]]][source]
class_choices_list = [<espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>]
num_optimizers = 1
classmethod optional_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the optional names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as follows,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “optional_data_names” should be as

>>> optional_data_names = ('opt',)
classmethod required_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the required names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as following,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “required_data_names” should be as

>>> required_data_names = ('input', 'output')
trainer

alias of espnet2.train.trainer.Trainer

espnet2.tasks.mt

class espnet2.tasks.mt.MTTask[source]

Bases: espnet2.tasks.abs_task.AbsTask

classmethod add_task_arguments(parser: argparse.ArgumentParser)[source]
classmethod build_collate_fn(args: argparse.Namespace, train: bool) → Callable[[Collection[Tuple[str, Dict[str, numpy.ndarray]]]], Tuple[List[str], Dict[str, torch.Tensor]]][source]

Return “collate_fn”, which is a callable object and given to DataLoader.

>>> from torch.utils.data import DataLoader
>>> loader = DataLoader(collate_fn=cls.build_collate_fn(args, train=True), ...)

In many cases, you can use our common collate_fn.

classmethod build_model(args: argparse.Namespace) → espnet2.mt.espnet_model.ESPnetMTModel[source]
classmethod build_preprocess_fn(args: argparse.Namespace, train: bool) → Optional[Callable[[str, Dict[str, numpy.array]], Dict[str, numpy.ndarray]]][source]
class_choices_list = [<espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>]
num_optimizers = 1
classmethod optional_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the optional names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as follows,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “optional_data_names” should be as

>>> optional_data_names = ('opt',)
classmethod required_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the required names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as following,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “required_data_names” should be as

>>> required_data_names = ('input', 'output')
trainer

alias of espnet2.train.trainer.Trainer

espnet2.tasks.gan_tts

GAN-based text-to-speech task.

class espnet2.tasks.gan_tts.GANTTSTask[source]

Bases: espnet2.tasks.abs_task.AbsTask

GAN-based text-to-speech task.

classmethod add_task_arguments(parser: argparse.ArgumentParser)[source]
classmethod build_collate_fn(args: argparse.Namespace, train: bool) → Callable[[Collection[Tuple[str, Dict[str, numpy.ndarray]]]], Tuple[List[str], Dict[str, torch.Tensor]]][source]

Return “collate_fn”, which is a callable object and given to DataLoader.

>>> from torch.utils.data import DataLoader
>>> loader = DataLoader(collate_fn=cls.build_collate_fn(args, train=True), ...)

In many cases, you can use our common collate_fn.

classmethod build_model(args: argparse.Namespace) → espnet2.gan_tts.espnet_model.ESPnetGANTTSModel[source]
classmethod build_optimizers(args: argparse.Namespace, model: espnet2.gan_tts.espnet_model.ESPnetGANTTSModel) → List[torch.optim.optimizer.Optimizer][source]
classmethod build_preprocess_fn(args: argparse.Namespace, train: bool) → Optional[Callable[[str, Dict[str, numpy.array]], Dict[str, numpy.ndarray]]][source]
class_choices_list = [<espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>]
num_optimizers = 2
classmethod optional_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the optional names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as follows,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “optional_data_names” should be as

>>> optional_data_names = ('opt',)
classmethod required_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the required names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as following,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “required_data_names” should be as

>>> required_data_names = ('input', 'output')
trainer

alias of espnet2.train.gan_trainer.GANTrainer

espnet2.tasks.st

class espnet2.tasks.st.STTask[source]

Bases: espnet2.tasks.abs_task.AbsTask

classmethod add_task_arguments(parser: argparse.ArgumentParser)[source]
classmethod build_collate_fn(args: argparse.Namespace, train: bool) → Callable[[Collection[Tuple[str, Dict[str, numpy.ndarray]]]], Tuple[List[str], Dict[str, torch.Tensor]]][source]

Return “collate_fn”, which is a callable object and given to DataLoader.

>>> from torch.utils.data import DataLoader
>>> loader = DataLoader(collate_fn=cls.build_collate_fn(args, train=True), ...)

In many cases, you can use our common collate_fn.

classmethod build_model(args: argparse.Namespace) → espnet2.st.espnet_model.ESPnetSTModel[source]
classmethod build_preprocess_fn(args: argparse.Namespace, train: bool) → Optional[Callable[[str, Dict[str, numpy.array]], Dict[str, numpy.ndarray]]][source]
class_choices_list = [<espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>]
num_optimizers = 1
classmethod optional_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the optional names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as follows,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “optional_data_names” should be as

>>> optional_data_names = ('opt',)
classmethod required_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the required names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as following,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “required_data_names” should be as

>>> required_data_names = ('input', 'output')
trainer

alias of espnet2.train.trainer.Trainer

espnet2.tasks.uasr

class espnet2.tasks.uasr.UASRTask[source]

Bases: espnet2.tasks.abs_task.AbsTask

classmethod add_task_arguments(parser: argparse.ArgumentParser)[source]
classmethod build_collate_fn(args: argparse.Namespace, train: bool) → Callable[[Collection[Tuple[str, Dict[str, numpy.ndarray]]]], Tuple[List[str], Dict[str, torch.Tensor]]][source]

Return “collate_fn”, which is a callable object and given to DataLoader.

>>> from torch.utils.data import DataLoader
>>> loader = DataLoader(collate_fn=cls.build_collate_fn(args, train=True), ...)

In many cases, you can use our common collate_fn.

classmethod build_model(args: argparse.Namespace) → espnet2.uasr.espnet_model.ESPnetUASRModel[source]
classmethod build_optimizers(args: argparse.Namespace, model: espnet2.uasr.espnet_model.ESPnetUASRModel) → List[torch.optim.optimizer.Optimizer][source]
classmethod build_preprocess_fn(args: argparse.Namespace, train: bool) → Optional[Callable[[str, Dict[str, numpy.array]], Dict[str, numpy.ndarray]]][source]
class_choices_list = [<espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>]
num_optimizers = 2
classmethod optional_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the optional names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as follows,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “optional_data_names” should be as

>>> optional_data_names = ('opt',)
classmethod required_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the required names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as following,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “required_data_names” should be as

>>> required_data_names = ('input', 'output')
trainer

alias of espnet2.train.uasr_trainer.UASRTrainer

espnet2.tasks.lm

class espnet2.tasks.lm.LMTask[source]

Bases: espnet2.tasks.abs_task.AbsTask

classmethod add_task_arguments(parser: argparse.ArgumentParser)[source]
classmethod build_collate_fn(args: argparse.Namespace, train: bool) → Callable[[Collection[Tuple[str, Dict[str, numpy.ndarray]]]], Tuple[List[str], Dict[str, torch.Tensor]]][source]

Return “collate_fn”, which is a callable object and given to DataLoader.

>>> from torch.utils.data import DataLoader
>>> loader = DataLoader(collate_fn=cls.build_collate_fn(args, train=True), ...)

In many cases, you can use our common collate_fn.

classmethod build_model(args: argparse.Namespace) → espnet2.lm.espnet_model.ESPnetLanguageModel[source]
classmethod build_preprocess_fn(args: argparse.Namespace, train: bool) → Optional[Callable[[str, Dict[str, numpy.array]], Dict[str, numpy.ndarray]]][source]
class_choices_list = [<espnet2.train.class_choices.ClassChoices object>]
num_optimizers = 1
classmethod optional_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the optional names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as follows,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “optional_data_names” should be as

>>> optional_data_names = ('opt',)
classmethod required_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the required names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as following,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “required_data_names” should be as

>>> required_data_names = ('input', 'output')
trainer

alias of espnet2.train.trainer.Trainer

espnet2.tasks.enh

class espnet2.tasks.enh.EnhancementTask[source]

Bases: espnet2.tasks.abs_task.AbsTask

classmethod add_task_arguments(parser: argparse.ArgumentParser)[source]
classmethod build_collate_fn(args: argparse.Namespace, train: bool) → Callable[[Collection[Tuple[str, Dict[str, numpy.ndarray]]]], Tuple[List[str], Dict[str, torch.Tensor]]][source]

Return “collate_fn”, which is a callable object and given to DataLoader.

>>> from torch.utils.data import DataLoader
>>> loader = DataLoader(collate_fn=cls.build_collate_fn(args, train=True), ...)

In many cases, you can use our common collate_fn.

classmethod build_iter_factory(args: argparse.Namespace, distributed_option: espnet2.train.distributed_utils.DistributedOption, mode: str, kwargs: dict = None) → espnet2.iterators.abs_iter_factory.AbsIterFactory[source]

Build a factory object of mini-batch iterator.

This object is invoked at every epochs to build the iterator for each epoch as following:

>>> iter_factory = cls.build_iter_factory(...)
>>> for epoch in range(1, max_epoch):
...     for keys, batch in iter_fatory.build_iter(epoch):
...         model(**batch)

The mini-batches for each epochs are fully controlled by this class. Note that the random seed used for shuffling is decided as “seed + epoch” and the generated mini-batches can be reproduces when resuming.

Note that the definition of “epoch” doesn’t always indicate to run out of the whole training corpus. “–num_iters_per_epoch” option restricts the number of iterations for each epoch and the rest of samples for the originally epoch are left for the next epoch. e.g. If The number of mini-batches equals to 4, the following two are same:

  • 1 epoch without “–num_iters_per_epoch”

  • 4 epoch with “–num_iters_per_epoch” == 4

classmethod build_model(args: argparse.Namespace) → espnet2.enh.espnet_model.ESPnetEnhancementModel[source]
classmethod build_preprocess_fn(args: argparse.Namespace, train: bool) → Optional[Callable[[str, Dict[str, numpy.array]], Dict[str, numpy.ndarray]]][source]
class_choices_list = [<espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>]
num_optimizers = 1
classmethod optional_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the optional names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as follows,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “optional_data_names” should be as

>>> optional_data_names = ('opt',)
classmethod required_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the required names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as following,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “required_data_names” should be as

>>> required_data_names = ('input', 'output')
trainer

alias of espnet2.train.trainer.Trainer

espnet2.tasks.tts

Text-to-speech task.

class espnet2.tasks.tts.TTSTask[source]

Bases: espnet2.tasks.abs_task.AbsTask

classmethod add_task_arguments(parser: argparse.ArgumentParser)[source]
classmethod build_collate_fn(args: argparse.Namespace, train: bool) → Callable[[Collection[Tuple[str, Dict[str, numpy.ndarray]]]], Tuple[List[str], Dict[str, torch.Tensor]]][source]

Return “collate_fn”, which is a callable object and given to DataLoader.

>>> from torch.utils.data import DataLoader
>>> loader = DataLoader(collate_fn=cls.build_collate_fn(args, train=True), ...)

In many cases, you can use our common collate_fn.

classmethod build_model(args: argparse.Namespace) → espnet2.tts.espnet_model.ESPnetTTSModel[source]
classmethod build_preprocess_fn(args: argparse.Namespace, train: bool) → Optional[Callable[[str, Dict[str, numpy.array]], Dict[str, numpy.ndarray]]][source]
classmethod build_vocoder_from_file(vocoder_config_file: Union[pathlib.Path, str] = None, vocoder_file: Union[pathlib.Path, str] = None, model: Optional[espnet2.tts.espnet_model.ESPnetTTSModel] = None, device: str = 'cpu')[source]
class_choices_list = [<espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>]
num_optimizers = 1
classmethod optional_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the optional names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as follows,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “optional_data_names” should be as

>>> optional_data_names = ('opt',)
classmethod required_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the required names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as following,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “required_data_names” should be as

>>> required_data_names = ('input', 'output')
trainer

alias of espnet2.train.trainer.Trainer

espnet2.tasks.__init__

espnet2.tasks.abs_task

Abstract task module.

class espnet2.tasks.abs_task.AbsTask[source]

Bases: abc.ABC

abstract classmethod add_task_arguments(parser: argparse.ArgumentParser)[source]
classmethod build_chunk_iter_factory(args: argparse.Namespace, iter_options: espnet2.tasks.abs_task.IteratorOptions, mode: str) → espnet2.iterators.abs_iter_factory.AbsIterFactory[source]
abstract classmethod build_collate_fn(args: argparse.Namespace, train: bool) → Callable[[Sequence[Dict[str, numpy.ndarray]]], Dict[str, torch.Tensor]][source]

Return “collate_fn”, which is a callable object and given to DataLoader.

>>> from torch.utils.data import DataLoader
>>> loader = DataLoader(collate_fn=cls.build_collate_fn(args, train=True), ...)

In many cases, you can use our common collate_fn.

classmethod build_iter_factory(args: argparse.Namespace, distributed_option: espnet2.train.distributed_utils.DistributedOption, mode: str, kwargs: dict = None) → espnet2.iterators.abs_iter_factory.AbsIterFactory[source]

Build a factory object of mini-batch iterator.

This object is invoked at every epochs to build the iterator for each epoch as following:

>>> iter_factory = cls.build_iter_factory(...)
>>> for epoch in range(1, max_epoch):
...     for keys, batch in iter_fatory.build_iter(epoch):
...         model(**batch)

The mini-batches for each epochs are fully controlled by this class. Note that the random seed used for shuffling is decided as “seed + epoch” and the generated mini-batches can be reproduces when resuming.

Note that the definition of “epoch” doesn’t always indicate to run out of the whole training corpus. “–num_iters_per_epoch” option restricts the number of iterations for each epoch and the rest of samples for the originally epoch are left for the next epoch. e.g. If The number of mini-batches equals to 4, the following two are same:

  • 1 epoch without “–num_iters_per_epoch”

  • 4 epoch with “–num_iters_per_epoch” == 4

classmethod build_iter_options(args: argparse.Namespace, distributed_option: espnet2.train.distributed_utils.DistributedOption, mode: str)[source]
abstract classmethod build_model(args: argparse.Namespace) → espnet2.train.abs_espnet_model.AbsESPnetModel[source]
classmethod build_model_from_file(config_file: Union[pathlib.Path, str] = None, model_file: Union[pathlib.Path, str] = None, device: str = 'cpu') → Tuple[espnet2.train.abs_espnet_model.AbsESPnetModel, argparse.Namespace][source]

Build model from the files.

This method is used for inference or fine-tuning.

Parameters:
  • config_file – The yaml file saved when training.

  • model_file – The model file saved when training.

  • device – Device type, “cpu”, “cuda”, or “cuda:N”.

classmethod build_multiple_iter_factory(args: argparse.Namespace, distributed_option: espnet2.train.distributed_utils.DistributedOption, mode: str)[source]
classmethod build_optimizers(args: argparse.Namespace, model: torch.nn.modules.module.Module) → List[torch.optim.optimizer.Optimizer][source]
abstract classmethod build_preprocess_fn(args: argparse.Namespace, train: bool) → Optional[Callable[[str, Dict[str, numpy.array]], Dict[str, numpy.ndarray]]][source]
classmethod build_sequence_iter_factory(args: argparse.Namespace, iter_options: espnet2.tasks.abs_task.IteratorOptions, mode: str) → espnet2.iterators.abs_iter_factory.AbsIterFactory[source]
classmethod build_streaming_iterator(data_path_and_name_and_type, preprocess_fn, collate_fn, key_file: str = None, batch_size: int = 1, dtype: str = <class 'numpy.float32'>, num_workers: int = 1, allow_variable_data_keys: bool = False, ngpu: int = 0, inference: bool = False) → torch.utils.data.dataloader.DataLoader[source]

Build DataLoader using iterable dataset

classmethod build_task_iter_factory(args: argparse.Namespace, iter_options: espnet2.tasks.abs_task.IteratorOptions, mode: str) → espnet2.iterators.abs_iter_factory.AbsIterFactory[source]

Build task specific iterator factory

Example

>>> class YourTask(AbsTask):
... @classmethod
... def add_task_arguments(cls, parser: argparse.ArgumentParser):
...     parser.set_defaults(iterator_type="task")
...
... @classmethod
... def build_task_iter_factory(
...     cls,
...     args: argparse.Namespace,
...     iter_options: IteratorOptions,
...     mode: str,
... ):
...     return FooIterFactory(...)
...
... @classmethod
... def build_iter_options(
....    args: argparse.Namespace,
...     distributed_option: DistributedOption,
...     mode: str
... ):
...     # if you need to customize options object
classmethod check_required_command_args(args: argparse.Namespace)[source]
classmethod check_task_requirements(dataset: Union[espnet2.train.dataset.AbsDataset, espnet2.train.iterable_dataset.IterableESPnetDataset], allow_variable_data_keys: bool, train: bool, inference: bool = False) → None[source]

Check if the dataset satisfy the requirement of current Task

class_choices_list = []
classmethod exclude_opts() → Tuple[str, ...][source]

The options not to be shown by –print_config

classmethod get_default_config() → Dict[str, Any][source]

Return the configuration as dict.

This method is used by print_config()

classmethod get_parser() → espnet2.utils.config_argparse.ArgumentParser[source]
classmethod main(args: argparse.Namespace = None, cmd: Sequence[str] = None)[source]
classmethod main_worker(args: argparse.Namespace)[source]
num_optimizers = 1
abstract classmethod optional_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the optional names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as follows,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “optional_data_names” should be as

>>> optional_data_names = ('opt',)
classmethod print_config(file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>) → None[source]
abstract classmethod required_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the required names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as following,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “required_data_names” should be as

>>> required_data_names = ('input', 'output')
trainer

alias of espnet2.train.trainer.Trainer

class espnet2.tasks.abs_task.IteratorOptions(preprocess_fn: <built-in function callable>, collate_fn: <built-in function callable>, data_path_and_name_and_type: list, shape_files: list, batch_size: int, batch_bins: int, batch_type: str, max_cache_size: float, max_cache_fd: int, distributed: bool, num_batches: Union[int, NoneType], num_iters_per_epoch: Union[int, NoneType], train: bool)[source]

Bases: object

espnet2.tasks.enh_tse

class espnet2.tasks.enh_tse.TargetSpeakerExtractionTask[source]

Bases: espnet2.tasks.abs_task.AbsTask

classmethod add_task_arguments(parser: argparse.ArgumentParser)[source]
classmethod build_collate_fn(args: argparse.Namespace, train: bool) → Callable[[Collection[Tuple[str, Dict[str, numpy.ndarray]]]], Tuple[List[str], Dict[str, torch.Tensor]]][source]

Return “collate_fn”, which is a callable object and given to DataLoader.

>>> from torch.utils.data import DataLoader
>>> loader = DataLoader(collate_fn=cls.build_collate_fn(args, train=True), ...)

In many cases, you can use our common collate_fn.

classmethod build_model(args: argparse.Namespace) → espnet2.enh.espnet_model_tse.ESPnetExtractionModel[source]
classmethod build_preprocess_fn(args: argparse.Namespace, train: bool) → Optional[Callable[[str, Dict[str, numpy.array]], Dict[str, numpy.ndarray]]][source]
class_choices_list = [<espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>]
num_optimizers = 1
classmethod optional_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the optional names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as follows,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “optional_data_names” should be as

>>> optional_data_names = ('opt',)
classmethod required_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the required names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as following,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “required_data_names” should be as

>>> required_data_names = ('input', 'output')
trainer

alias of espnet2.train.trainer.Trainer

espnet2.tasks.gan_svs

GAN-based Singing-voice-synthesis task.

class espnet2.tasks.gan_svs.GANSVSTask[source]

Bases: espnet2.tasks.abs_task.AbsTask

GAN-based Singing-voice-synthesis task.

classmethod add_task_arguments(parser: argparse.ArgumentParser)[source]
classmethod build_collate_fn(args: argparse.Namespace, train: bool) → Callable[[Collection[Tuple[str, Dict[str, numpy.ndarray]]]], Tuple[List[str], Dict[str, torch.Tensor]]][source]

Return “collate_fn”, which is a callable object and given to DataLoader.

>>> from torch.utils.data import DataLoader
>>> loader = DataLoader(collate_fn=cls.build_collate_fn(args, train=True), ...)

In many cases, you can use our common collate_fn.

classmethod build_model(args: argparse.Namespace) → espnet2.gan_svs.espnet_model.ESPnetGANSVSModel[source]
classmethod build_optimizers(args: argparse.Namespace, model: espnet2.gan_svs.espnet_model.ESPnetGANSVSModel) → List[torch.optim.optimizer.Optimizer][source]
classmethod build_preprocess_fn(args: argparse.Namespace, train: bool) → Optional[Callable[[str, Dict[str, numpy.array], float], Dict[str, numpy.ndarray]]][source]
class_choices_list = [<espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>]
num_optimizers = 2
classmethod optional_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the optional names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as follows,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “optional_data_names” should be as

>>> optional_data_names = ('opt',)
classmethod required_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the required names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as following,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “required_data_names” should be as

>>> required_data_names = ('input', 'output')
trainer

alias of espnet2.train.gan_trainer.GANTrainer

espnet2.tasks.asr

class espnet2.tasks.asr.ASRTask[source]

Bases: espnet2.tasks.abs_task.AbsTask

classmethod add_task_arguments(parser: argparse.ArgumentParser)[source]
classmethod build_collate_fn(args: argparse.Namespace, train: bool) → Callable[[Collection[Tuple[str, Dict[str, numpy.ndarray]]]], Tuple[List[str], Dict[str, torch.Tensor]]][source]

Return “collate_fn”, which is a callable object and given to DataLoader.

>>> from torch.utils.data import DataLoader
>>> loader = DataLoader(collate_fn=cls.build_collate_fn(args, train=True), ...)

In many cases, you can use our common collate_fn.

classmethod build_model(args: argparse.Namespace) → espnet2.asr.espnet_model.ESPnetASRModel[source]
classmethod build_preprocess_fn(args: argparse.Namespace, train: bool) → Optional[Callable[[str, Dict[str, numpy.array]], Dict[str, numpy.ndarray]]][source]
class_choices_list = [<espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>]
num_optimizers = 1
classmethod optional_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the optional names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as follows,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “optional_data_names” should be as

>>> optional_data_names = ('opt',)
classmethod required_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Define the required names by Task

This function is used by >>> cls.check_task_requirements() If your model is defined as following,

>>> from espnet2.train.abs_espnet_model import AbsESPnetModel
>>> class Model(AbsESPnetModel):
...     def forward(self, input, output, opt=None):  pass

then “required_data_names” should be as

>>> required_data_names = ('input', 'output')
trainer

alias of espnet2.train.trainer.Trainer

espnet2.tasks.asr_transducer

ASR Transducer Task.

class espnet2.tasks.asr_transducer.ASRTransducerTask[source]

Bases: espnet2.tasks.abs_task.AbsTask

ASR Transducer Task definition.

classmethod add_task_arguments(parser: argparse.ArgumentParser)[source]

Add Transducer task arguments.

Parameters:
  • cls – ASRTransducerTask object.

  • parser – Transducer arguments parser.

classmethod build_collate_fn(args: argparse.Namespace, train: bool) → Callable[[Collection[Tuple[str, Dict[str, numpy.ndarray]]]], Tuple[List[str], Dict[str, torch.Tensor]]][source]

Build collate function.

Parameters:
  • cls – ASRTransducerTask object.

  • args – Task arguments.

  • train – Training mode.

Returns:

Callable collate function.

classmethod build_model(args: argparse.Namespace) → espnet2.asr_transducer.espnet_transducer_model.ESPnetASRTransducerModel[source]

Required data depending on task mode.

Parameters:
  • cls – ASRTransducerTask object.

  • args – Task arguments.

Returns:

ASR Transducer model.

Return type:

model

classmethod build_preprocess_fn(args: argparse.Namespace, train: bool) → Optional[Callable[[str, Dict[str, numpy.array]], Dict[str, numpy.ndarray]]][source]

Build pre-processing function.

Parameters:
  • cls – ASRTransducerTask object.

  • args – Task arguments.

  • train – Training mode.

Returns:

Callable pre-processing function.

class_choices_list = [<espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>, <espnet2.train.class_choices.ClassChoices object>]
num_optimizers = 1
classmethod optional_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Optional data depending on task mode.

Parameters:
  • cls – ASRTransducerTask object.

  • train – Training mode.

  • inference – Inference mode.

Returns:

Optional task data.

Return type:

retval

classmethod required_data_names(train: bool = True, inference: bool = False) → Tuple[str, ...][source]

Required data depending on task mode.

Parameters:
  • cls – ASRTransducerTask object.

  • train – Training mode.

  • inference – Inference mode.

Returns:

Required task data.

Return type:

retval

trainer

alias of espnet2.train.trainer.Trainer