class_docstr: A ready-to-use Response Generator  model
  
  The class can be used to generate and continue dialogue given the user input.
  The given YAML must contain the fields specified in the *_NEEDED[] lists.
  It needs to be used with custom.py to load the expanded GPT model with added tokens like bos,eos, and speaker's tokens.
  
  Example
  -------
  >>> from speechbrain.inference.text import GPTResponseGenerator
  
  >>> tmpdir = getfixture("tmpdir")
  >>> res_gen_model = GPTResponseGenerator.from_hparams(source="speechbrain/MultiWOZ-GPT-Response_Generation",
  ... savedir="tmpdir",
  ... pymodule_file="custom.py")  # doctest: +SKIP
  >>> response = res_gen_model.generate_response("I want to book a table for dinner")  # doctest: +SKIP
docstr: Complete a dialogue given the user's input.
  Arguments
  ---------
  inputs: tuple
      history_bos which is the tokenized history+input values with appropriate speaker token appended before each turn and history_token_type which determines
      the type of each token basd on who is uttered that token (either User or Sytem).
  
  Returns
  -------
  response
      Generated hypothesis for the user input based on the dialogue history.
docstr_tok: ["Complete","a","dialogue","given","the","user","'s","input",".","Arguments","--","--","--","--","-","inputs",":","tuple","history_bos","which","is","the","tokenized","history+input","values","with","appropriate","speaker","token","appended","before","each","turn","and","history_token_type","which","determines","the","type","of","each","token","basd","on","who","is","uttered","that","token","(","either","User","or","Sytem",")",".","Returns","--","--","--","-","response","Generated","hypothesis","for","the","user","input","based","on","the","dialogue","history","."]
code: def generate(self, inputs):
      """
      Complete a dialogue given the user's input.
      Arguments
      ---------
      inputs: tuple
          history_bos which is the tokenized history+input values with appropriate speaker token appended before each turn and history_token_type which determines
          the type of each token basd on who is uttered that token (either User or Sytem).
  
      Returns
      -------
      response
          Generated hypothesis for the user input based on the dialogue history.
      """
  
      history_bos, history_token_type = inputs
      padding_mask = ~self.hparams.padding_mask(
          history_bos, pad_idx=self.model.tokenizer.unk_token_id
      )
      hyps = self.model.generate(
          history_bos.detach(),
          history_token_type.detach(),
          padding_mask.detach(),
          "beam",
      )
      return hyps
  
imports: import torch
  from itertools import chain
  from speechbrain.inference.interfaces import Pretrained, EncodeDecodePipelineMixin
label_desc: Use image node_id 2 for calling the GPTResponseGenerator obj's underlying member method code with example usage: obj.generate(inputs) and returns: hyps