deeppavlov.models.go_bot

class deeppavlov.models.go_bot.network.GoalOrientedBot(tokenizer: deeppavlov.core.models.component.Component, tracker: deeppavlov.models.go_bot.tracker.Tracker, template_path: str, save_path: str, hidden_size: int = 128, obs_size: int = None, action_size: int = None, dropout_rate: float = 0.0, l2_reg_coef: float = 0.0, dense_size: int = None, attention_mechanism: dict = None, network_parameters: Dict[str, Any] = {}, load_path: str = None, template_type: str = 'DefaultTemplate', word_vocab: deeppavlov.core.models.component.Component = None, bow_embedder: deeppavlov.core.models.component.Component = None, embedder: deeppavlov.core.models.component.Component = None, slot_filler: deeppavlov.core.models.component.Component = None, intent_classifier: deeppavlov.core.models.component.Component = None, database: deeppavlov.core.models.component.Component = None, api_call_action: str = None, use_action_mask: bool = False, debug: bool = False, **kwargs)[source]

The dialogue bot is based on https://arxiv.org/abs/1702.03274, which introduces Hybrid Code Networks that combine an RNN with domain-specific knowledge and system action templates.

The network handles dialogue policy management. Inputs features of an utterance and predicts label of a bot action (classification task).

An LSTM with a dense layer for input features and a dense layer for it’s output. Softmax is used as an output activation function.

Parameters
  • tokenizer – one of tokenizers from deeppavlov.models.tokenizers module.

  • tracker – dialogue state tracker from deeppavlov.models.go_bot.tracker.

  • hidden_size – size of rnn hidden layer.

  • action_size – size of rnn output (equals to number of bot actions).

  • obs_size – input features’ size (must be equal to sum of output sizes of bow_embedder, embedder, intent_classifier, tracker.num_features plus size of context features(=6) and action_size).

  • dropout_rate – probability of weights dropping out.

  • l2_reg_coef – l2 regularization weight (applied to input and output layer).

  • dense_size – rnn input size.

  • attention_mechanism

    describes attention applied to embeddings of input tokens.

    • type – type of attention mechanism, possible values are 'general', 'bahdanau', 'light_general', 'light_bahdanau', 'cs_general' and 'cs_bahdanau'.

    • hidden_size – attention hidden state size.

    • max_num_tokens – maximum number of input tokens.

    • depth – number of averages used in constrained attentions ('cs_bahdanau' or 'cs_general').

    • action_as_key – whether to use action from previous timestep as key to attention.

    • intent_as_key – use utterance intents as attention key or not.

    • projected_align – whether to use output projection.

  • network_parameters – dictionary with network parameters (for compatibility with release 0.1.1, deprecated in the future)

  • template_path – file with mapping between actions and text templates for response generation.

  • template_type – type of used response templates in string format.

  • word_vocab – vocabulary of input word tokens (DefaultVocabulary recommended).

  • bow_embedder – instance of one-hot word encoder BoWEmbedder.

  • embedder – one of embedders from deeppavlov.models.embedders module.

  • slot_filler – component that outputs slot values for a given utterance (DstcSlotFillingNetwork recommended).

  • intent_classifier – component that outputs intents probability distribution for a given utterance ( KerasClassificationModel recommended).

  • database – database that will be used during inference to perform api_call_action actions and get 'db_result' result ( Sqlite3Database recommended).

  • api_call_action – label of the action that corresponds to database api call (it must be present in your template_path file), during interaction it will be used to get 'db_result' from database.

  • use_action_mask – if True, network output will be applied with a mask over allowed actions.

  • debug – whether to display debug output.

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

Load model parameters from self.load_path

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

Save model parameters to self.save_path

class deeppavlov.models.go_bot.tracker.Tracker[source]

An abstract class for trackers: a model that holds a dialogue state and generates state features.

class deeppavlov.models.go_bot.tracker.DefaultTracker(slot_names: List[str])[source]

Tracker that overwrites slots with new values. Features are binary indicators: slot is present/absent.

Parameters

slot_names – list of slots that should be tracked.

class deeppavlov.models.go_bot.tracker.FeaturizedTracker(slot_names: List[str])[source]

Tracker that overwrites slots with new values. Features are binary features (slot is present/absent) plus difference features (slot value is (the same)/(not the same) as before last update) and count features (sum of present slots and sum of changed during last update slots).

Parameters

slot_names – list of slots that should be tracked.