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 _construct_opts(self, opt):
      self.opts = {}
      self.opts["init"] = opt
      override_opts = defaultdict(dict)
      for k, v in opt["override"].items():
          if k.startswith("krm_"):
              if v is not None:
                  override_opts["knowledge_agent"][k] = v
          elif k.startswith("drm_"):
              if v is not None:
                  override_opts["dialogue_agent"][k] = v
          elif k.startswith("drmnk_"):
              if v is not None:
                  override_opts["dialogue_agent_no_knowledge"][k] = v
          elif k.startswith("drmrw_"):
              if v is not None:
                  override_opts["dialogue_agent_rag_wiki"][k] = v
          else:
              override_opts["general"][k] = v
      self.opts["override"] = override_opts
  
      if opt["knowledge_response_model_path"] and opt[
          "knowledge_response_model_path"
      ] not in ["oracle"]:
          self.opts["knowledge_agent"] = self._agent_opt(
              filename=opt["knowledge_response_model_path"],
              specific_override_args=override_opts["knowledge_agent"],
              general_override_args=override_opts["general"],
          )
      self.opts["dialogue_agent"] = self._agent_opt(
          filename=opt["dialogue_response_model_path"],
          specific_override_args=override_opts["dialogue_agent"],
          general_override_args=override_opts["general"],
      )
      if self.has_no_knowledge_dialogue_model:
          self.opts["dialogue_agent_no_knowledge"] = self._agent_opt(
              filename=opt["dialogue_response_no_knowledge_model_path"],
              specific_override_args=override_opts[
                  "dialogue_agent_no_knowledge"
              ],
              general_override_args=override_opts["general"],
          )
      if self.has_rag_wiki_dialogue_model:
          self.opts["dialogue_agent_rag_wiki"] = self._agent_opt(
              filename=opt["dialogue_response_rag_wiki_model_path"],
              specific_override_args=override_opts[
                  "dialogue_agent_rag_wiki"
              ],
              general_override_args=override_opts["general"],
          )
  
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 6 for calling the StackedKnowledgeDialogueAgent obj's underlying member method code with example usage: obj._construct_opts(opt) without return types