Jasper5x3 Model

Jasper5x3 Model

class openspeech.models.jasper5x3.model.Jasper5x3Model(configs: omegaconf.dictconfig.DictConfig, vocab: openspeech.vocabs.vocab.Vocabulary)[source]

Jasper: An End-to-End Convolutional Neural Acoustic Model Paper: https://arxiv.org/pdf/1904.03288.pdf

Parameters
  • configs (DictConfig) – configuration set.

  • vocab (Vocabulary) – the class of vocabulary

Inputs:
inputs (torch.FloatTensor): A input sequence passed to encoders. Typically for inputs this will be a padded

FloatTensor of size (batch, seq_length, dimension).

input_lengths (torch.LongTensor): The length of input tensor. (batch)

Returns

Result of model predictions that contains y_hats, logits, output_lengths

Return type

  • dict (dict)

forward(inputs: torch.Tensor, input_lengths: torch.Tensor) → Dict[str, torch.Tensor][source]

Forward propagate a inputs and targets pair for inference.

Inputs:
inputs (torch.FloatTensor): A input sequence passed to encoders. Typically for inputs this will be a padded

FloatTensor of size (batch, seq_length, dimension).

input_lengths (torch.LongTensor): The length of input tensor. (batch)

Returns

Result of model predictions that contains y_hats, logits, output_lengths

Return type

  • dict (dict)

test_step(batch: tuple, batch_idx: int)collections.OrderedDict[source]

Forward propagate a inputs and targets pair for test.

Inputs:

batch (tuple): A train batch contains inputs, targets, input_lengths, target_lengths batch_idx (int): The index of batch

Returns

loss for training

Return type

loss (torch.Tensor)

training_step(batch: tuple, batch_idx: int)collections.OrderedDict[source]

Forward propagate a inputs and targets pair for training.

Inputs:

batch (tuple): A train batch contains inputs, targets, input_lengths, target_lengths batch_idx (int): The index of batch

Returns

loss for training

Return type

loss (torch.Tensor)

validation_step(batch: tuple, batch_idx: int)collections.OrderedDict[source]

Forward propagate a inputs and targets pair for validation.

Inputs:

batch (tuple): A train batch contains inputs, targets, input_lengths, target_lengths batch_idx (int): The index of batch

Returns

loss for training

Return type

loss (torch.Tensor)

Jasper5x3 Model Configuration

class openspeech.models.jasper5x3.configurations.Jasper5x3Config(model_name: str = 'jasper5x3', num_blocks: int = 5, num_sub_blocks: int = 3, in_channels: str = '(None, 256, 256, 256, 384, 384, 512, 512, 640, 640, 768, 768, 896, 1024)', out_channels: str = '(256, 256, 256, 384, 384, 512, 512, 640, 640, 768, 768, 896, 1024, None)', kernel_size: str = '(11, 11, 11, 13, 13, 17, 17, 21, 21, 25, 25, 29, 1, 1)', dilation: str = '(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1)', dropout_p: str = '(0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.3, 0.3, 0.3, 0.3, 0.4, 0.4, 0.0)', optimizer: str = 'novograd')[source]

This is the configuration class to store the configuration of a Jasper5x3.

It is used to initiated an Jasper5x3 model.

Configuration objects inherit from :class: ~openspeech.dataclass.configs.OpenspeechDataclass.

Configurations:

model_name (str): Model name (default: jasper5x3) num_blocks (int): Number of jasper blocks (default: 5) num_sub_blocks (int): Number of jasper sub blocks (default: 3) in_channels (str): Output channels of jasper block’s convolution out_channels (str): Output channels of jasper block’s convolution kernel_size (str): Kernel size of jasper block’s convolution dilation (str): Dilation of jasper block’s convolution dropout_p (str): Dropout probability optimizer (str): Optimizer for training.