예제 #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.

        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()),
        }
예제 #3
0
 def input_ports(self):
     """Returns definitions of module input ports.
     """
     return {
         # "logits": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag), 2: AxisType(ChannelTag)}),
         # "start_positions": NeuralType({0: AxisType(BatchTag)}),
         # "end_positions": NeuralType({0: AxisType(BatchTag)}),
         "logits": NeuralType(('B', 'T', 'D'), LogitsType()),
         "start_positions": NeuralType(tuple('B'), ChannelType()),
         "end_positions": NeuralType(tuple('B'), ChannelType()),
     }
예제 #4
0
    def input_ports(self):
        """Returns definitions of module input ports.

        """
        return {
            # "intent_logits": NeuralType({0: AxisType(BatchTag), 1: AxisType(ChannelTag)}),
            # "slot_logits": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag), 2: AxisType(ChannelTag)}),
            # "loss_mask": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
            # "intents": NeuralType({0: AxisType(BatchTag)}),
            # "slots": NeuralType({0: AxisType(BatchTag), 1: AxisType(TimeTag)}),
            "intent_logits": NeuralType(('B', 'D'), LogitsType()),
            "slot_logits": NeuralType(('B', 'T', 'D'), LogitsType()),
            "loss_mask": NeuralType(('B', 'T'), ChannelType()),
            "intents": NeuralType(tuple('B'), ChannelType()),
            "slots": NeuralType(('B', 'T'), ChannelType()),
        }