def output_ports(self):
        """Returns definitions of module output ports.

        src_ids: ids of input sequences

        src_lens: lengths of input sequences

        tgt_ids: labels for the generator output

        tgt_lens: lengths of the generator targets

        gating_labels: labels for the gating head

        turn_domain: list of the domains
            NeuralType(None)

        """
        return {
            # "src_ids": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
            # "src_lens": NeuralType({0: AxisType(BatchTag)}),
            # "tgt_ids": NeuralType({0: AxisType(BatchTag), 1: AxisType(ChannelTag), 2: AxisType(TimeTag)}),
            # "tgt_lens": NeuralType({0: AxisType(BatchTag), 1: AxisType(ChannelTag)}),
            # "gating_labels": NeuralType({0: AxisType(BatchTag), 1: AxisType(ChannelTag)}),
            # "turn_domain": NeuralType(None),
            "src_ids": NeuralType(('B', 'T'), ChannelType()),
            "src_lens": NeuralType(tuple('B'), LengthsType()),
            "tgt_ids": NeuralType(('B', 'D', 'T'), LabelsType()),
            "tgt_lens": NeuralType(('B', 'D'), LengthsType()),
            "gating_labels": NeuralType(('B', 'D'), LabelsType()),
            "turn_domain": NeuralType(),
        }
示例#2
0
    def output_types(self) -> Optional[Dict[str, NeuralType]]:
        """Returns definitions of module output ports.
        """
        # TODO output type for external features
        output_types = {
            'external_feat':
            NeuralType(('B', 'D', 'T'), AcousticEncodedRepresentation()),
            'feat_length':
            NeuralType(tuple('B'), LengthsType()),
        }

        if self.is_speaker_emb:
            output_types.update({
                'embs':
                NeuralType(('B', 'D', 'T'), AcousticEncodedRepresentation()),
                'embs_length':
                NeuralType(tuple('B'), LengthsType()),
                'label':
                NeuralType(('B', 'T'), LabelsType()),
                'label_length':
                NeuralType(tuple('B'), LengthsType()),
            })
        else:
            output_types.update({
                'label':
                NeuralType(('B', 'T'), LabelsType()),
                'label_length':
                NeuralType(tuple('B'), LengthsType()),
            })

        return output_types
 def output_types(self) -> Optional[Dict[str, NeuralType]]:
     """Returns definitions of module output ports. """
     return {
         "input_ids": NeuralType(("B", "T"), ChannelType()),
         "segment_ids": NeuralType(("B", "T"), ChannelType()),
         "input_mask": NeuralType(("B", "T"), MaskType()),
         "subtokens_mask": NeuralType(("B", "T"), MaskType()),
         "loss_mask": NeuralType(("B", "T"), MaskType()),
         "punct_labels": NeuralType(("B", "T"), LabelsType()),
         "capit_labels": NeuralType(("B", "T"), LabelsType()),
     }
示例#4
0
 def output_types(self) -> Optional[Dict[str, NeuralType]]:
     """Returns definitions of module output ports. """
     return {
         'input_ids': NeuralType(('B', 'T'), ChannelType()),
         'segment_ids': NeuralType(('B', 'T'), ChannelType()),
         'input_mask': NeuralType(('B', 'T'), MaskType()),
         'subtokens_mask': NeuralType(('B', 'T'), MaskType()),
         'loss_mask': NeuralType(('B', 'T'), MaskType()),
         'punct_labels': NeuralType(('B', 'T'), LabelsType()),
         'capit_labels': NeuralType(('B', 'T'), LabelsType()),
     }
示例#5
0
 def output_types(self) -> Optional[Dict[str, NeuralType]]:
     """Returns definitions of module output ports.
            """
     return {
         "input_ids": NeuralType(('B', 'T'), ChannelType()),
         "input_mask": NeuralType(('B', 'T'), MaskType()),
         "segment_ids": NeuralType(('B', 'T'), ChannelType()),
         "labels_mask": NeuralType(('B', 'T'), MaskType()),
         "tag_labels": NeuralType(('B', 'T'), LabelsType()),
         "semiotic_labels": NeuralType(('B', 'T'), LabelsType()),
         "semiotic_spans": NeuralType(('B', 'T', 'C'), IntType()),
     }
示例#6
0
    def input_ports(self):
        """Returns definitions of module input ports.

        encoder_hidden: hidden states of the encoder

        encoder_outputs: outputs of the encoder

        input_lens: lengths of the input sequences to encoder

        src_ids: input sequences to encoder

        targets: targets for the output of the generator

        """
        return {
            # 'encoder_hidden': NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag), 2: AxisType(ChannelTag)}),
            # 'encoder_outputs': NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag), 2: AxisType(ChannelTag)}),
            # 'input_lens': NeuralType({0: AxisType(BatchTag)}),
            # 'src_ids': NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
            # 'targets': NeuralType({0: AxisType(BatchTag), 1: AxisType(ChannelTag), 2: AxisType(TimeTag)}),
            'encoder_hidden': NeuralType(('B', 'T', 'C'), ChannelType()),
            'encoder_outputs': NeuralType(('B', 'T', 'C'), ChannelType()),
            'input_lens': NeuralType(tuple('B'), LengthsType()),
            'src_ids': NeuralType(('B', 'T'), ChannelType()),
            # 'targets': NeuralType(ChannelType(), ('B', 'D', 'T')),
            'targets': NeuralType(('B', 'D', 'T'), LabelsType()),
        }
示例#7
0
    def output_types(self) -> Optional[Dict[str, NeuralType]]:
        """Returns definitions of module output ports.
        """

        output_types = {
            'audio_signal':
            NeuralType(
                ('B', 'T'),
                AudioSignal(freq=self._sample_rate) if self is not None
                and hasattr(self, '_sample_rate') else AudioSignal(),
            ),
            'a_sig_length':
            NeuralType(tuple('B'), LengthsType()),
        }

        if self.is_regression_task:
            output_types.update({
                'targets':
                NeuralType(tuple('B'), RegressionValuesType()),
                'targets_length':
                NeuralType(tuple('B'), LengthsType()),
            })
        else:

            output_types.update({
                'label':
                NeuralType(tuple('B'), LabelsType()),
                'label_length':
                NeuralType(tuple('B'), LengthsType()),
            })

        return output_types
示例#8
0
 def input_types(self) -> Optional[Dict[str, NeuralType]]:
     return {
         "input_ids": NeuralType(('B', 'T'), ChannelType()),
         "decoder_input_ids": NeuralType(('B', 'T'), ChannelType()),
         "attention_mask": NeuralType(('B', 'T'), MaskType(), optional=True),
         "labels": NeuralType(('B', 'T'), LabelsType()),
     }
示例#9
0
 def output_ports(self):
     """Returns definitions of module output ports.
     """
     return {
         # "latent": NeuralType(
         #     {
         #         0: AxisType(BatchTag),
         #         1: AxisType(ChannelTag, 64),
         #         2: AxisType(HeightTag, 4),
         #         3: AxisType(WidthTag, 4),
         #     }
         # ),
         # "image": NeuralType(
         #     {
         #         0: AxisType(BatchTag),
         #         1: AxisType(ChannelTag),
         #         2: AxisType(HeightTag, self._input_size[1]),
         #         3: AxisType(WidthTag, self._input_size[0]),
         #     }
         # ),
         # "label": NeuralType({0: AxisType(BatchTag)}),
         "latent": NeuralType(('B', 'C', 'H', 'W'), ChannelType()),
         "image": NeuralType(('B', 'C', 'H', 'W'), ChannelType()),
         "label": NeuralType(tuple('B'), LabelsType()),
     }
示例#10
0
 def input_types(self):
     """Returns definitions of module input ports.
     """
     return {
         "logits": NeuralType(('B', 'D'), LogitsType()),
         "labels": NeuralType(('B'), LabelsType())
     }
示例#11
0
文件: losses.py 项目: benhoff/NeMo
 def input_ports(self):
     """Returns definitions of module input ports.
     """
     return {
         "logits": NeuralType(axes=('B', 'D'), elements_type=LogitsType()),
         "labels": NeuralType(axes=tuple('B'), elements_type=LabelsType()),
     }
示例#12
0
 def input_types(self):
     """Returns definitions of module input ports.
     """
     return {
         "preds": NeuralType(tuple('B'), RegressionValuesType()),
         "labels": NeuralType(tuple('B'), LabelsType()),
     }
示例#13
0
 def input_types(self):
     """Input types definitions for AnguarLoss.
     """
     return {
         "logits": NeuralType(('B', 'D'), LogitsType()),
         "labels": NeuralType(('B',), LabelsType()),
     }
示例#14
0
文件: rnnt.py 项目: sycomix/NeMo
 def input_types(self):
     """Returns definitions of module input ports.
     """
     return {
         "targets": NeuralType(('B', 'T'), LabelsType()),
         "target_length": NeuralType(tuple('B'), LengthsType()),
         "states": [NeuralType(('D', 'B', 'D'), ElementType(), optional=True)],  # must always be last
     }
示例#15
0
文件: rnnt.py 项目: NVIDIA/NeMo
 def input_types(self):
     return OrderedDict(
         {
             "encoder_output": NeuralType(('B', 'D', 'T'), AcousticEncodedRepresentation()),
             "targets": NeuralType(('B', 'T'), LabelsType()),
             "target_lengths": NeuralType(tuple('B'), LengthsType()),
         }
     )
示例#16
0
 def input_types(self):
     """Returns definitions of module input ports.
     """
     return {
         "log_probs": NeuralType(("B", "T", "D"), LogprobsType()),
         "labels": NeuralType(("B", "T"), LabelsType()),
         "output_mask": NeuralType(("B", "T"), MaskType(), optional=True),
     }
    def output_ports(self):
        """Returns definitions of module output ports.
        example_id_num (int): example ids
        service_id  (int): service ids
        is_real_example (bool): flag to determine is the example is valid
        utterance_ids (int): utterance ids
        utterance_segment (int): Denotes the identity of the sequence. Takes values 0 (system utterance) and 1 (user utterance)
        utterance_mask (int): Mask which takes the value 0 for padded tokens and 1 otherwise
        categorical_slot_status (int): The status of each categorical slot in the service
        cat_slot_status_mask(int): Masks out categorical status for padded cat slots, takes values 0 and 1
        categorical_slot_values (int): The index of the correct value for each categorical slot
        cat_slot_values_mask (int): Masks out categorical slots values for slots not used in the service, takes values 0 and 1
        noncategorical_slot_status (int): The status of each non-categorical slot in the service
        noncat_slot_status_mask(int): Masks out non-categorical status for padded cat slots, takes values 0 and 1
        noncategorical_slot_value_start (int): The index of the starting subword corresponding to the slot span for a non-categorical slot value
        noncategorical_slot_value_end (int): The index of the ending (inclusive) subword corresponding to the slot span for a non-categorical slot value
        start_char_idx (int): Start character indices in the original utterance corresponding to the tokens
        end_char_idx (int): Inclusive end character indices in the original utterance corresponding to the tokens
        num_slots (int): Total number of slots present in the service
        requested_slot_status (int): Takes value 1 if the corresponding slot is requested, 0 otherwise
        req_slot_mask (int): Masks requested slots not used for the particular service
        intent_status_mask (long): Masks out padded intents in the service, takes values 0 and 1
        intent_status_labels (int): Intent labels

        """
        return {
            "example_id_num": NeuralType(('B'), ChannelType()),
            "service_id": NeuralType(('B'), ChannelType()),
            "is_real_example": NeuralType(('B'), ChannelType()),
            "utterance_ids": NeuralType(('B', 'T'), ChannelType()),
            "utterance_segment": NeuralType(('B', 'T'), ChannelType()),
            "utterance_mask": NeuralType(('B', 'T'), ChannelType()),
            "categorical_slot_status": NeuralType(('B', 'T'), LabelsType()),
            "cat_slot_status_mask": NeuralType(('B', 'T'), ChannelType()),
            "categorical_slot_values": NeuralType(('B', 'T'), LabelsType()),
            "cat_slot_values_mask": NeuralType(('B', 'T', 'C'), ChannelType()),
            "noncategorical_slot_status": NeuralType(('B', 'T'), LabelsType()),
            "noncat_slot_status_mask": NeuralType(('B', 'T'), ChannelType()),
            "noncategorical_slot_value_start": NeuralType(('B', 'T'),
                                                          LabelsType()),
            "noncategorical_slot_value_end": NeuralType(('B', 'T'),
                                                        LabelsType()),
            "start_char_idx": NeuralType(('B', 'T'), LabelsType()),
            "end_char_idx": NeuralType(('B', 'T'), LabelsType()),
            "num_slots": NeuralType(('B'), LengthsType()),
            "requested_slot_status": NeuralType(('B', 'T'), LabelsType()),
            "req_slot_mask": NeuralType(('B', 'T'), ChannelType()),
            "intent_status_mask": NeuralType(('B', 'T'), ChannelType()),
            "intent_status_labels": NeuralType(('B'), LabelsType()),
        }
示例#18
0
 def input_types(self):
     """Returns definitions of module input ports.
         logit_intent_status: Output of SGD model
         intent_status: intent label
         logit_req_slot_status: Output of SGD model
         requested_slot_status: Takes value 1 if the corresponding slot is requested, 0 otherwise
         logit_cat_slot_status: Output of SGD model
         categorical_slot_status: The status of each categorical slot in the service
         logit_cat_slot_value_status: Output of SGD model
         categorical_slot_value_status: Takes value 1 if the corresponding slot value is correct, 0 otherwise
         logit_noncat_slot_status: Output of SGD model
         noncategorical_slot_status: The status of each noncategorical slot in the service\
         logit_spans: Output of SGD model
         noncategorical_slot_value_start: The index of the starting subword corresponding to the slot span for a non-categorical slot value
         noncategorical_slot_value_end: The index of the ending (inclusive) subword corresponding to the slot span for a non-categorical slot value
         task_mask: Mask contains 1 if its the current task, 0 otherwise
     """
     return {
         "logit_intent_status": NeuralType(('B', 'T'), LogitsType()),
         "intent_status": NeuralType(('B'), LabelsType()),
         "logit_req_slot_status": NeuralType(('B', 'T'), LogitsType()),
         "requested_slot_status": NeuralType(('B'), LabelsType()),
         "logit_cat_slot_status": NeuralType(('B', 'T'), LogitsType()),
         "categorical_slot_status": NeuralType(('B'), LabelsType()),
         "logit_cat_slot_value_status": NeuralType(('B', 'T'), LogitsType()),
         "categorical_slot_value_status": NeuralType(('B'), LabelsType()),
         "logit_noncat_slot_status": NeuralType(('B', 'T'), LogitsType()),
         "noncategorical_slot_status": NeuralType(('B'), LabelsType()),
         "logit_spans": NeuralType(('B', 'T', 'D'), LogitsType()),
         "noncategorical_slot_value_start": NeuralType(('B'), LabelsType()),
         "noncategorical_slot_value_end": NeuralType(('B'), LabelsType()),
         "task_mask": NeuralType(('B', 'T'), ChannelType()),
     }
示例#19
0
 def input_types(self):
     """Input types definitions for LatticeLoss.
     """
     return {
         "log_probs": NeuralType(("B", "T", "D"), LogprobsType()),
         "targets": NeuralType(("B", "T"), LabelsType()),
         "input_lengths": NeuralType(tuple("B"), LengthsType()),
         "target_lengths": NeuralType(tuple("B"), LengthsType()),
     }
    def output_ports(self):
        """Returns definitions of module output ports.
        src_ids: ids of input sequences
        src_lens: lengths of input sequences
        tgt_ids: labels for the generator output
        tgt_lens: lengths of the generator targets
        gating_labels: labels for the gating head
        turn_domain: list of the domains

        """
        return {
            "src_ids": NeuralType(('B', 'T'), TokenIndex()),
            "src_lens": NeuralType(tuple('B'), Length()),
            "tgt_ids": NeuralType(('B', 'D', 'T'), LabelsType()),
            "tgt_lens": NeuralType(('B', 'D'), Length()),
            "gating_labels": NeuralType(('B', 'D'), LabelsType()),
            "turn_domain": NeuralType(),
        }
示例#21
0
 def input_types(self):
     """Input types definitions for CTCLoss.
     """
     return {
         "log_probs": NeuralType(('B', 'T', 'T', 'D'), LogprobsType()),
         "targets": NeuralType(('B', 'T'), LabelsType()),
         "input_lengths": NeuralType(tuple('B'), LengthsType()),
         "target_lengths": NeuralType(tuple('B'), LengthsType()),
     }
示例#22
0
 def input_ports(self):
     """Returns definitions of module input ports.
     """
     return {
         # "logits": NeuralType({0: AxisType(BatchTag), 1: AxisType(ChannelTag), 2: AxisType(ChannelTag)}),
         # "labels": NeuralType({0: AxisType(BatchTag), 1: AxisType(ChannelTag)}),
         "logits": NeuralType(('B', 'D', 'D'), LogitsType()),
         "labels": NeuralType(('B', 'D'), LabelsType()),
     }
示例#23
0
 def input_ports(self):
     """Returns definitions of module input ports.
     """
     return {
         'encoder_hidden': NeuralType(('B', 'T', 'C'), ChannelType()),
         'encoder_outputs': NeuralType(('B', 'T', 'C'), ChannelType()),
         'input_lens': NeuralType(tuple('B'), LengthsType()),
         'src_ids': NeuralType(('B', 'T'), ChannelType()),
         'targets': NeuralType(('B', 'D', 'T'), LabelsType()),
     }
示例#24
0
文件: rnnt.py 项目: sycomix/NeMo
    def input_types(self):
        state_type = NeuralType(('D', 'B', 'D'), ElementType())
        mytypes = {
            'encoder_outputs': NeuralType(('B', 'D', 'T'), AcousticEncodedRepresentation()),
            "targets": NeuralType(('B', 'T'), LabelsType()),
            "target_length": NeuralType(tuple('B'), LengthsType()),
            'input-states-1': state_type,
            'input-states-2': state_type,
        }

        return mytypes
示例#25
0
文件: rnnt.py 项目: sycomix/NeMo
 def input_types(self):
     """Returns definitions of module input ports.
     """
     return {
         "encoder_outputs": NeuralType(('B', 'D', 'T'), AcousticEncodedRepresentation()),
         "decoder_outputs": NeuralType(('B', 'D', 'T'), EmbeddedTextType()),
         "encoder_lengths": NeuralType(tuple('B'), LengthsType(), optional=True),
         "transcripts": NeuralType(('B', 'T'), LabelsType(), optional=True),
         "transcript_lengths": NeuralType(tuple('B'), LengthsType(), optional=True),
         "compute_wer": NeuralType(optional=True),
     }
示例#26
0
文件: losses.py 项目: vladgets/NeMo
    def input_ports(self):
        """Returns definitions of module input ports.

        preds:
            0: AxisType(RegressionTag)

        labels:
            0: AxisType(RegressionTag)
        """
        return {
            "preds": NeuralType(tuple('B'), RegressionValuesType()),
            "labels": NeuralType(tuple('B'), LabelsType()),
        }
示例#27
0
文件: losses.py 项目: vladgets/NeMo
 def input_ports(self):
     """Returns definitions of module input ports.
     """
     return {
         "logits":
         NeuralType(['B'] + ['ANY'] * (self._logits_dim - 1), LogitsType()),
         "labels":
         NeuralType(['B'] + ['ANY'] * (self._logits_dim - 2), LabelsType()),
         "loss_mask":
         NeuralType(['B'] + ['ANY'] * (self._logits_dim - 2),
                    MaskType(),
                    optional=True),
     }
示例#28
0
 def input_types(self):
     """Input types definitions for Contrastive.
     """
     return {
         "spec_masks": NeuralType(("B", "D", "T"), SpectrogramType()),
         "decoder_outputs": NeuralType(("B", "T", "D"), VoidType()),
         "targets": NeuralType(('B', 'T'), LabelsType()),
         "decoder_lengths": NeuralType(tuple('B'),
                                       LengthsType(),
                                       optional=True),
         "target_lengths": NeuralType(tuple('B'),
                                      LengthsType(),
                                      optional=True),
     }
    def input_ports(self):
        """Returns definitions of module input ports.

        logits: 4d tensor of logits

        labels: 3d tensor of labels

        loss_mask: specifies the words to be considered in the loss calculation

        """
        return {
            "logits": NeuralType(('B', 'T', 'D', 'D'), LogitsType()),
            "labels": NeuralType(('B', 'D', 'T'), LabelsType()),
            "length_mask": NeuralType(('B', 'D'), LengthsType()),
        }
示例#30
0
 def input_types(self):
     """Returns definitions of module input ports.
     """
     return {
         "logits":
         NeuralType(["B"] + ["ANY"] * (self._logits_dim - 1), LogitsType()),
         "labels": [
             NeuralType(["B"] + ["ANY"] * (self._logits_dim - 2),
                        LabelsType())
         ],
         "loss_mask":
         NeuralType(["B"] + ["ANY"] * (self._logits_dim - 2),
                    MaskType(),
                    optional=True),
     }