QuartzNet 5x5 Model

QuartzNet 5x5 Model

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

QUARTZNET: DEEP AUTOMATIC SPEECH RECOGNITION WITH 1D TIME-CHANNEL SEPARABLE CONVOLUTIONS Paper: https://arxiv.org/abs/1910.10261.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)

QuartzNet 5x5 Model Configuration

class openspeech.models.quartznet5x5.configurations.QuartzNet5x5Configs(model_name: str = 'quartznet5x5', num_blocks: int = 5, num_sub_blocks: int = 5, in_channels: str = '(None, 256, 256, 256, 512, 512, 512, 512, 1024)', out_channels: str = '(256, 256, 256, 512, 512, 512, 512, 1024, None)', kernel_size: str = '(33, 33, 39, 51, 63, 75, 87, 1, 1)', dilation: str = '(1, 1, 1, 1, 1, 1, 1, 1, 2)', dropout_p: str = '(0.2, None, None, None, None, None, 0.2, 0.2, 0.2)', optimizer: str = 'novograd')[source]

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

It is used to initiated an QuartzNet5x5 model.

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

Configurations:

model_name (str): Model name (default: quartznet5x5) num_blocks (int): Number of quartznet blocks (default: 5) num_sub_blocks (int): Number of quartznet sub blocks (default: 5) 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.