예제 #1
0
    def output_ports(self):
        """Returns definitions of module output ports.

        input_ids:
            indices of tokens which constitute batches of text segments
        input_type_ids:
            tensor with 0's and 1's to denote the text segment type
        input_mask:
            bool tensor with 0s in place of tokens to be masked
        loss_mask:
            used to mask and ignore tokens in the loss function
        subtokens_mask:
            used to ignore the outputs of unwanted tokens in
            the inference and evaluation like the start and end tokens
        intents:
            intents labels
        slots:
            slots labels
        """
        return {
            "input_ids": NeuralType(('B', 'T'), ChannelType()),
            "input_type_ids": NeuralType(('B', 'T'), ChannelType()),
            "input_mask": NeuralType(('B', 'T'), ChannelType()),
            "loss_mask": NeuralType(('B', 'T'), MaskType()),
            "subtokens_mask": NeuralType(('B', 'T'), ChannelType()),
            "intents": NeuralType(tuple('B'), LabelsType()),
            "slots": NeuralType(('B', 'T'), LabelsType()),
        }
예제 #2
0
    def output_ports(self):
        """Returns definitions of module output ports.

        input_ids: indices of tokens which constitute batches of text segments
            0: AxisType(BatchTag)

            1: AxisType(TimeTag)

        input_mask: bool tensor with 0s in place of tokens to be masked
            0: AxisType(BatchTag)

            1: AxisType(TimeTag)

        labels: indices of tokens which should be predicted from each of the
            corresponding tokens in input_ids; for left-to-right language
            modeling equals to input_ids shifted by 1 to the right
            0: AxisType(BatchTag)

            1: AxisType(TimeTag)
        """
        return {
            # "input_ids": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
            # "input_mask": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
            # "labels": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
            "input_ids": NeuralType(('B', 'T'), ChannelType()),
            "input_mask": NeuralType(('B', 'T'), ChannelType()),
            "labels": NeuralType(('B', 'T'), LabelsType()),
        }
예제 #3
0
    def output_ports(self):
        """Returns definitions of module output ports.

        src_ids: indices of tokens which correspond to source sentences

        src_mask: bool tensor with 0s in place of source tokens to be masked

        tgt_ids: indices of tokens which correspond to target sentences

        tgt_mask: bool tensor with 0s in place of target tokens to be masked

        labels: indices of tokens which should be predicted from each of the
            corresponding target tokens in tgt_ids; for standard neural
            machine translation equals to tgt_ids shifted by 1 to the right

        sent_ids: indices of the sentences in a batch; important for
            evaluation with external metrics, such as SacreBLEU

        """
        return {
            # "src_ids": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
            # "src_mask": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
            # "tgt_ids": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
            # "tgt_mask": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
            # "labels": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
            # "sent_ids": NeuralType({0: AxisType(BatchTag)}),
            "src_ids": NeuralType(('B', 'T'), ChannelType()),
            "src_mask": NeuralType(('B', 'T'), ChannelType()),
            "tgt_ids": NeuralType(('B', 'T'), ChannelType()),
            "tgt_mask": NeuralType(('B', 'T'), ChannelType()),
            "labels": NeuralType(('B', 'T'), LabelsType()),
            "sent_ids": NeuralType(tuple('B'), ChannelType()),
        }
 def input_ports(self):
     """Returns definitions of module input ports.
     """
     return {
         "logits": NeuralType(('B', 'T', 'D'), LogitsType()),
         "labels": NeuralType(('B', 'T'), LabelsType()),
         "output_mask": NeuralType(('B', 'T'), MaskType(), optional=True),
     }
예제 #5
0
 def input_ports(self):
     """Returns definitions of module input ports.
     """
     return {
         # "logits": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag), 2: AxisType(ChannelTag)}),
         # "target_ids": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
         "logits": NeuralType(('B', 'T', 'D'), LogitsType()),
         "target_ids": NeuralType(('B', 'T'), LabelsType()),
     }
 def output_ports(self):
     """Returns definitions of module output ports.
     """
     return {
         # "input_ids": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
         # "input_type_ids": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
         # "input_mask": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
         # "loss_mask": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
         # "subtokens_mask": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
         # "punct_labels": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
         # "capit_labels": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
         "input_ids": NeuralType(('B', 'T'), ChannelType()),
         "input_type_ids": NeuralType(('B', 'T'), ChannelType()),
         "input_mask": NeuralType(('B', 'T'), ChannelType()),
         "loss_mask": NeuralType(('B', 'T'), ChannelType()),
         "subtokens_mask": NeuralType(('B', 'T'), ChannelType()),
         "punct_labels": NeuralType(('B', 'T'), LabelsType()),
         "capit_labels": NeuralType(('B', 'T'), LabelsType()),
     }
예제 #7
0
 def output_ports(self):
     """Returns definitions of module output ports.
     input_ids:
         indices of tokens which constitute batches of masked text segments
     input_type_ids:
         tensor with 0's and 1's to denote the text segment type
     input_mask:
         bool tensor with 0s in place of tokens to be masked
     output_ids: indices of tokens which constitute batches of unmasked text segments
     output_mask: bool tensor with 0s in place of tokens to be masked
     labels: 0 or 1 for next sentence prediction classification
     """
     return {
         "input_ids": NeuralType(('B', 'T'), ChannelType()),
         "input_type_ids": NeuralType(('B', 'T'), ChannelType()),
         "input_mask": NeuralType(('B', 'T'), ChannelType()),
         "output_ids": NeuralType(('B', 'T'), LabelsType()),
         "output_mask": NeuralType(('B', 'T'), MaskType()),
         "labels": NeuralType(tuple('B'), LabelsType()),
     }
예제 #8
0
 def output_ports(self):
     """Returns definitions of module output ports.
     """
     return {
         # "input_ids": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
         # "input_type_ids": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
         # "input_mask": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
         # "labels": NeuralType({0: AxisType(BatchTag)}),
         "input_ids": NeuralType(('B', 'T'), ChannelType()),
         "input_type_ids": NeuralType(('B', 'T'), ChannelType()),
         "input_mask": NeuralType(('B', 'T'), ChannelType()),
         "labels": NeuralType(tuple('B'), LabelsType()),
     }
예제 #9
0
    def output_ports(self):
        """Returns definitions of module output ports.

        input_ids: indices of tokens which constitute batches of masked text segments
        input_mask: bool tensor with 0s in place of source tokens to be masked
        segment_ids: bool tensor with 0's and 1's to denote the text segment type
        tgt_ids: indices of target tokens which constitute batches of masked text segments
        labels_mask: bool tensor with 0s in place of label tokens to be masked
        labels: indices of tokens which should be predicted from each of the
            corresponding target tokens in tgt_ids
        loss_mask: bool tensor with 0s in place of label tokens to be masked used for
            CrossEntropyLossNM

        """
        return {
            "input_ids": NeuralType(('B', 'T'), ChannelType()),
            "input_mask": NeuralType(('B', 'T'), ChannelType()),
            "segment_ids": NeuralType(('B', 'T'), ChannelType()),
            "tgt_ids": NeuralType(('B', 'T'), LabelsType()),
            "labels_mask": NeuralType(('B', 'T'), MaskType()),
            "labels": NeuralType(('B', 'T'), LabelsType()),
            "loss_mask": NeuralType(('B', 'T'), MaskType()),
        }
예제 #10
0
 def output_ports(self):
     """Returns definitions of module output ports.
     input_ids:
         indices of tokens which constitute batches of masked text segments
     input_type_ids:
         tensor with 0's and 1's to denote the text segment type
     input_mask:
         bool tensor with 0s in place of tokens to be masked
     loss_mask:
         used to mask and ignore tokens in the loss function: indices of tokens which constitute batches of unmasked text segments
     subtokens_mask:
         used to mask all but the first subtoken of the work, could be useful during inference
     punct_labels: punctuation label ids
     capit_labels: capit_labels label ids
     """
     return {
         "input_ids": NeuralType(('B', 'T'), ChannelType()),
         "input_type_ids": NeuralType(('B', 'T'), ChannelType()),
         "input_mask": NeuralType(('B', 'T'), ChannelType()),
         "loss_mask": NeuralType(('B', 'T'), MaskType()),
         "subtokens_mask": NeuralType(('B', 'T'), ChannelType()),
         "punct_labels": NeuralType(('B', 'T'), LabelsType()),
         "capit_labels": NeuralType(('B', 'T'), LabelsType()),
     }
예제 #11
0
 def input_ports(self):
     """Returns definitions of module input ports.
         logit_intent_status (float): Output of SGD model
         intent_status_labels (int): Intent labels
         logit_req_slot_status (float): Output of SGD model
         requested_slot_status (float): Takes value 1 if the corresponding slot is requested, 0 otherwise
         req_slot_mask (bool): Masks requested slots not used for the particular service
         logit_cat_slot_status (float): Output of SGD model
         categorical_slot_status (int): The status of each categorical slot in the service
         cat_slot_status_mask (bool): Masks categorical slots not used for the particular service
         logit_cat_slot_value (float): Output of SGD model
         categorical_slot_values (int): The index of the correct value for each categorical slot
         logit_noncat_slot_status (float): Output of SGD model
         noncategorical_slot_status (int): The status of each noncategorical slot in the service
         noncat_slot_status_mask (bool): masks noncategorical slots not used for the particular service
         logit_noncat_slot_start (float): Output of SGD model
         logit_noncat_slot_end (float): Output of SGD model
         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
     """
     return {
         "logit_intent_status": NeuralType(('B', 'T', 'C'), LogitsType()),
         "intent_status_labels": NeuralType(('B'), LabelsType()),
         "logit_req_slot_status": NeuralType(('B', 'T'), LogitsType()),
         "requested_slot_status": NeuralType(('B', 'T'), LabelsType()),
         "req_slot_mask": NeuralType(('B', 'T'), ChannelType()),
         "logit_cat_slot_status": NeuralType(('B', 'T', 'C'), LogitsType()),
         "categorical_slot_status": NeuralType(('B', 'T'), LabelsType()),
         "cat_slot_status_mask": NeuralType(('B', 'T'), ChannelType()),
         "logit_cat_slot_value": NeuralType(('B', 'T', 'C'), LogitsType()),
         "categorical_slot_values": NeuralType(('B', 'T'), LabelsType()),
         "logit_noncat_slot_status": NeuralType(('B', 'T', 'C'),
                                                LogitsType()),
         "noncategorical_slot_status": NeuralType(('B', 'T'), LabelsType()),
         "noncat_slot_status_mask": NeuralType(('B', 'T'), ChannelType()),
         "logit_noncat_slot_start": NeuralType(('B', 'T', 'C'),
                                               LogitsType()),
         "logit_noncat_slot_end": NeuralType(('B', 'T', 'C'), LogitsType()),
         "noncategorical_slot_value_start": NeuralType(('B', 'T'),
                                                       LabelsType()),
         "noncategorical_slot_value_end": NeuralType(('B', 'T'),
                                                     LabelsType()),
     }