convlab2.nlu.jointBERT package¶
Subpackages¶
Submodules¶
convlab2.nlu.jointBERT.dataloader module¶
-
class
convlab2.nlu.jointBERT.dataloader.
Dataloader
(intent_vocab, tag_vocab, pretrained_weights)¶ Bases:
object
-
bert_tokenize
(word_seq, tag_seq)¶
-
get_train_batch
(batch_size)¶
-
load_data
(data, data_key, cut_sen_len, use_bert_tokenizer=True)¶ sample representation: [list of words, list of tags, list of intents, original dialog act] :param data_key: train/val/test :param data: :return:
-
pad_batch
(batch_data)¶
-
seq_id2intent
(ids)¶
-
seq_id2tag
(ids)¶
-
seq_intent2id
(intents)¶
-
seq_tag2id
(tags)¶
-
yield_batches
(batch_size, data_key)¶
-
convlab2.nlu.jointBERT.jointBERT module¶
-
class
convlab2.nlu.jointBERT.jointBERT.
JointBERT
(model_config, device, slot_dim, intent_dim, intent_weight=None)¶ Bases:
torch.nn.modules.module.Module
-
forward
(word_seq_tensor, word_mask_tensor, tag_seq_tensor=None, tag_mask_tensor=None, intent_tensor=None, context_seq_tensor=None, context_mask_tensor=None)¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-