crslab.model.policy.mgcg package

Submodules

MGCG

References

Liu, Zeming, et al. “Towards Conversational Recommendation over Multi-Type Dialogs.” in ACL 2020.

class crslab.model.policy.mgcg.mgcg.MGCGModel(opt, device, vocab, side_data)[source]

Bases: crslab.model.base.BaseModel

topic_class_num

A integer indicating the number of topic.

vocab_size

A integer indicating the size of vocabulary.

embedding_dim

A integer indicating the dimension of embedding layer.

hidden_size

A integer indicating the size of hidden state.

num_layers

A integer indicating the number of layers in GRU.

dropout_hidden

A float indicating the dropout rate of hidden state.

n_sent

A integer indicating sequence length in user profile.

Parameters
  • opt (dict) – A dictionary record the hyper parameters.

  • device (torch.device) – A variable indicating which device to place the data and model.

  • vocab (dict) – A dictionary record the vocabulary information.

  • side_data (dict) – A dictionary record the side data.

build_model(*args, **kwargs)[source]

build model

forward(batch, mode)[source]

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.

get_length(input)[source]

Module contents