class_docstr: Stacked model that generates first the knowledge, and then the dialogue response.
class_docstr_tok: ["Stacked","model","that","generates","first","the","knowledge",",","and","then","the","dialogue","response","."]
code: def _init_dialogue_models(self):
      ## Init dialogue models.
  
      # Initialize dialogue agent that uses the predicted knowledge.
      self.dialogue_agent = create_agent(
          self.opts["dialogue_agent"], requireModelExists=True
      )
      # Monkey patch the get_batch_context to ignore the knowledge for
      # beam-context-blocking.
      if self.opts["init"][
          "beam_disregard_knowledge_for_context_blocking"
      ]:
          orig_fun = self.dialogue_agent._get_batch_context
          self.dialogue_agent._get_batch_context = MethodType(
              lambda self, batch: wow_get_batch_context(
                  self, batch, orig_fun=orig_fun
              ),
              self.dialogue_agent,
          )
  
      print("Options for Dialogue Response Agent")
      self.dialogue_agent.opt.log()
  
      # Initialize dialogue agent that doesn't use knowledge.
      if self.has_no_knowledge_dialogue_model:
          self.dialogue_agent_no_knowledge = create_agent(
              self.opts["dialogue_agent_no_knowledge"],
              requireModelExists=True,
          )
  
      # Initialize dialogue agent that uses RAG with Wiki.
      if self.has_rag_wiki_dialogue_model:
          self.dialogue_agent_rag_wiki = create_agent(
              self.opts["dialogue_agent_rag_wiki"],
              requireModelExists=True,
          )
  
imports: from copy import deepcopy
  from typing import Optional, List
  from types import MethodType
  from collections import defaultdict
  from nltk.tokenize import sent_tokenize
  from nltk.corpus import stopwords
  import random
  import spacy
  import torch
  from parlai.core.agents import create_agent, create_agent_from_shared
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  from parlai.core.message import Message
  from parlai.core.agents import Agent
  from parlai.core.metrics import F1Metric
  from parlai.agents.rag.args import setup_rag_args
  from parlai.agents.bart.bart import BartAgent
  from parlai.core.metrics import normalize_answer
  from parlai.tasks.wizard_of_wikipedia.agents import TOKEN_NOCHOSEN
  from parlai.tasks.wizard_of_wikipedia.agents import TOKEN_KNOWLEDGE, TOKEN_END_KNOWLEDGE
label_desc: Use image node_id 9 for calling the StackedKnowledgeDialogueAgent obj's underlying member method code with example usage: obj._init_dialogue_models() without return types