def output_types(self) -> Optional[Dict[str, NeuralType]]: """Returns definitions of module output ports. input_ids: ids of word subtokens encoded using tokenizer segment_ids: an array of zeros input_mask: attention mask. Zeros if input is padding. subtoken_mask: a mask used for retrieving predictions for words. An element equals ``1`` if corresponding token is the first token in some word and zero otherwise. For example, if input query "language processing" is tokenized into ["[CLS]", "language", "process", "ing", "SEP"], then ``subtokens_mask`` will be [0, 1, 1, 0, 0]. quantities_of_preceding_words: number of words preceding a segment in a query. It is used for uniting predictions from different segments if such segments overlap. For example, if query "hello john" is tokenized into segments ``[['hell', 'o'], ['john']]``, then ``quantities_of_preceding_words=[0, 1]``. query_ids: ids of queries to which segments belong. For example, if ``queries=["foo", "bar"]`` are segmented into ``[[['[CLS]', 'f', 'o', '[SEP]'], ['[CLS]', 'o', 'o', '[SEP]']], [['[CLS]', 'b', 'a', '[SEP]'], ['[CLS]', 'a', 'r', '[SEP]']]]``, then for batch [['[CLS]', 'o', 'o', '[SEP]'], ['[CLS]', 'b', 'a', '[SEP]'], ['[CLS]', 'a', 'r', '[SEP]']] ``query_ids=[0, 1, 1]``. is_first: is segment the first segment in query. The left margin of the first segment in a query is not removed and this parameter is used to identify first segments. is_last: is segment the last segment in query. The right margin of the last segment in a query is not removed and this parameter is used to identify last segments. """ 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()), 'quantities_of_preceding_words': NeuralType(('B', ), Index()), 'query_ids': NeuralType(('B', ), Index()), 'is_first': NeuralType(('B', ), BoolType()), 'is_last': NeuralType(('B', ), BoolType()), }
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()), }
def input_types(self) -> Optional[Dict[str, NeuralType]]: return { "input_ids": NeuralType(('B', 'T'), ChannelType()), "decoder_mask": NeuralType(('B', 'T'), MaskType(), optional=True), "encoder_embeddings": NeuralType(('B', 'T', 'D'), ChannelType(), optional=True), "encoder_mask": NeuralType(('B', 'T'), MaskType(), optional=True), "decoder_mems": NeuralType(('B', 'D', 'T', 'D'), EncodedRepresentation(), optional=True), }
def input_types(self) -> Optional[Dict[str, NeuralType]]: return { "q_input_ids": NeuralType(("B", "T"), ChannelType()), "q_attention_mask": NeuralType(("B", "T"), MaskType()), "q_token_type_ids": NeuralType(("B", "T"), ChannelType()), "p_input_ids": NeuralType(("B", "T"), ChannelType()), "p_attention_mask": NeuralType(("B", "T"), MaskType()), "p_token_type_ids": NeuralType(("B", "T"), ChannelType()), }
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()), }
def input_ports(self): """Returns definitions of module input ports.""" return dict( text=NeuralType(('B', 'T'), EmbeddedTextType(), optional=True), text_mask=NeuralType(('B', 'T'), MaskType(), optional=True), text_rep=NeuralType(('B', 'T'), LengthsType(), optional=True), text_rep_mask=NeuralType(('B', 'T'), MaskType(), optional=True), speaker_emb=NeuralType(('B', 'T'), EncodedRepresentation(), optional=True), durs=NeuralType(('B', 'T'), LengthsType(), optional=True), )
def input_types(self) -> Optional[Dict[str, NeuralType]]: return { "input_ids": NeuralType(('B', 'T'), ChannelType()), "decoder_mask": NeuralType(('B', 'T'), MaskType(), optional=True), "encoder_mask": NeuralType(('B', 'T'), MaskType(), optional=True), "encoder_hidden_states": NeuralType(('B', 'T', 'D'), ChannelType(), optional=True), }
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()), }
def output_types(self) -> Optional[Dict[str, NeuralType]]: """Returns neural types of :meth:`collate_fn` output.""" 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()), 'quantities_of_preceding_words': NeuralType(('B', ), Index()), 'query_ids': NeuralType(('B', ), Index()), 'is_first': NeuralType(('B', ), BoolType()), 'is_last': NeuralType(('B', ), BoolType()), }
def output_ports(self): """Returns definitions of module output ports.""" return dict( audio=NeuralType(('B', 'T'), AudioSignal(freq=self._sample_rate)), audio_len=NeuralType(tuple('B'), LengthsType()), text=NeuralType(('B', 'T'), EmbeddedTextType()), text_mask=NeuralType(('B', 'T'), MaskType()), dur=NeuralType(('B', 'T'), LengthsType()), text_rep=NeuralType(('B', 'T'), LengthsType()), text_rep_mask=NeuralType(('B', 'T'), MaskType()), text_raw=NeuralType(), speaker=NeuralType(('B',), EmbeddedTextType(), optional=True), speaker_emb=NeuralType(('B', 'T'), EncodedRepresentation(), optional=True), )
def input_ports(self): """Returns definitions of module input ports.""" return dict( dur_true=NeuralType(('B', 'T'), LengthsType()), dur_pred=NeuralType(('B', 'T', 'D'), ChannelType()), text_mask=NeuralType(('B', 'T'), MaskType()), )
def output_types(self) -> Optional[Dict[str, NeuralType]]: output_types = super().output_types output_types.update({ "hidden_mask": NeuralType(('B', 'T'), MaskType(), True), }) return output_types
def input_types(self) -> Optional[Dict[str, NeuralType]]: return { "input_ids": NeuralType(('B', 'T'), ChannelType()), "attention_mask": NeuralType(('B', 'T'), MaskType(), optional=True), "decoder_input_ids": NeuralType(('B', 'T'), ChannelType(), optional=True), "labels": NeuralType(('B', 'T'), ChannelType(), optional=True), }
def input_ports(self): """Returns definitions of module input ports.""" return dict( text=NeuralType(('B', 'T'), EmbeddedTextType()), text_pos=NeuralType(('B', 'T'), MaskType()), mel_true=NeuralType(('B', 'D', 'T'), MelSpectrogramType()), dur_true=NeuralType(('B', 'T'), LengthsType()), )
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 input_types(self) -> Optional[Dict[str, NeuralType]]: return { "source": NeuralType(('B', 'T'), AudioSignal()), "padding_mask": NeuralType(('B', 'T'), MaskType(), optional=True), "mask": NeuralType(elements_type=BoolType(), optional=True), "features_only": NeuralType(elements_type=BoolType(), optional=True), }
def output_ports(self): """Returns definitions of module input ports.""" return dict( text_rep=NeuralType(('B', 'T'), LengthsType()), text_rep_mask=NeuralType(('B', 'T'), MaskType()), mel_true=NeuralType(('B', 'D', 'T'), MelSpectrogramType()), mel_len=NeuralType(('B',), LengthsType()), )
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()), "labels": NeuralType(tuple('B'), CategoricalValuesType()), }
def input_ports(self): """Returns definitions of module input ports.""" return dict( true=NeuralType(('B', 'D', 'T'), ChannelType()), # 'BDT' - to fit mels directly. pred=NeuralType(('B', 'T', 'D'), ChannelType()), mask=NeuralType(('B', 'T'), MaskType()), mel_len=NeuralType(('B',), LengthsType(), optional=True), dur_true=NeuralType(('B', 'T'), LengthsType(), optional=True), )
def output_ports(self): """Returns definitions of module output ports.""" return dict( audio=NeuralType(('B', 'T'), AudioSignal(freq=self.sample_rate)), audio_len=NeuralType(tuple('B'), LengthsType()), text=NeuralType(('B', 'T'), EmbeddedTextType()), text_pos=NeuralType(('B', 'T'), MaskType()), dur_true=NeuralType(('B', 'T'), LengthsType()), )
def output_types(self) -> Optional[Dict[str, NeuralType]]: """Returns definitions of module output ports. """ return { "input_ids": NeuralType(("B", "T"), ChannelType()), "attention_mask": NeuralType(("B", "T"), MaskType()), "decoder_input_ids": NeuralType(("B", "T"), ChannelType()), "lm_labels": NeuralType(("B", "T"), ChannelType()), }
def input_types(self) -> Optional[Dict[str, NeuralType]]: """ These are ordered incorrectly in bert_module.py WRT to QAModel.forward() DistilBert doesn't use token_type_ids, but the QAModel still needs them during export. By re-ordring them, the correct input_names are used during export of the ONNX model. """ return { "input_ids": NeuralType(('B', 'T'), ChannelType()), "token_type_ids": NeuralType(('B', 'T'), ChannelType(), optional=True), "attention_mask": NeuralType(('B', 'T'), MaskType(), optional=True) }
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), }
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), }
def output_types(self) -> Optional[Dict[str, NeuralType]]: return { "logits": NeuralType(('B', 'T', 'D'), EncodedRepresentation()), "targets": NeuralType(('B', 'T', 'D'), EncodedRepresentation(), optional=True), "sampled_negatives": NeuralType(('N', 'B', 'T', 'D'), EncodedRepresentation(), optional=True), "padding_mask": NeuralType(('B', 'T'), MaskType(), optional=True), "features_penalty": NeuralType(elements_type=LossType(), optional=True), "prob_ppl_loss": NeuralType(elements_type=LossType(), optional=True), "cur_codebook_temp": NeuralType(elements_type=FloatType(), optional=True), }
def input_types(self) -> Optional[Dict[str, NeuralType]]: return { "input_ids": NeuralType(('B', 'T'), ChannelType()), "token_type_ids": NeuralType(('B', 'T'), ChannelType(), optional=True), "attention_mask": NeuralType(('B', 'T'), MaskType(), optional=True), "labels": NeuralType(('B', 'T'), ChannelType(), optional=True), 'past_key_values': [[NeuralType(None, StringType(), optional=True)]], 'use_cache': NeuralType(None, VoidType(), optional=True), 'position_ids': NeuralType(('B', 'T'), ChannelType(), optional=True), "return_dict": NeuralType(None, StringType(), optional=True), "output_attentions": NeuralType(None, StringType(), optional=True), "output_hidden_states": NeuralType(None, StringType(), optional=True), "max_length": NeuralType(None, IntType(), optional=True), }
def input_types(self) -> Optional[Dict[str, NeuralType]]: return { "input_ids": NeuralType(('B', 'T'), ChannelType()), "encoder_mask": NeuralType(('B', 'T'), MaskType()), }