class_docstr: Wrapper for a DropoutPoly agent.
  
  Provides interface to RagModel as query/document encoder (separate), and provides
  interface to retrievers as a full poly-encoder.
class_docstr_tok: ["Wrapper","for","a","DropoutPoly","agent",".","Provides","interface","to","RagModel","as","query\/document","encoder","(","separate",")",",","and","provides","interface","to","retrievers","as","a","full","poly-encoder","."]
docstr: Build poly-encoder module.
  
  :param opt:
      options from base RAG Model
  
  :return dropout poly-encoder:
      return dropout poly agent.
docstr_tok: ["Build","poly-encoder","module",".",":","param","opt",":","options","from","base","RAG","Model",":","return","dropout","poly-encoder",":","return","dropout","poly","agent","."]
code: def _build_model(
      self, opt: Opt
  ) -> Tuple[PolyEncoderModule, DictionaryAgent]:
      """
      Build poly-encoder module.
  
      :param opt:
          options from base RAG Model
  
      :return dropout poly-encoder:
          return dropout poly agent.
      """
      model_file = modelzoo_path(
          opt["datapath"], opt["poly_faiss_model_file"]
      )
      model_opt = Opt.load(f"{model_file}.opt")
  
      create_model_opt = {
          **{k: model_opt[k] for k in TRANSFORMER_RANKER_BASE_OPT},
          **{k: model_opt[k] for k in POLYENCODER_OPT_KEYS},
          "model": "transformer/dropout_poly",
          "init_model": model_file,
          "dict_file": f"{model_file}.dict",
          # necessary opt args
          "multitask_weights": [1],
          # dropout_poly args
          "poly_dropout_reduction_type": model_opt[
              "poly_dropout_reduction_type"
          ],
          "poly_dropout_use_codes": model_opt.get(
              "poly_dropout_use_codes", True
          ),
      }
      logging.disable()
      agent = create_agent(Opt(create_model_opt))
      logging.enable()
      assert isinstance(agent, DropoutPolyAgent)
      return agent.model, agent.dict
  
file_path: ParlAI/parlai/agents/rag/polyfaiss.py
imports: import torch
  import torch.cuda
  import torch.nn
  from typing import Tuple
  from parlai.agents.transformer.polyencoder import PolyEncoderModule
  from parlai.core.agents import create_agent
  from parlai.core.build_data import modelzoo_path
  from parlai.core.dict import DictionaryAgent
  from parlai.core.opt import Opt
  import parlai.utils.logging
  from parlai.agents.transformer.dropout_poly import DropoutPolyAgent, reduce_ctxt
  from parlai.agents.rag.args import POLYENCODER_OPT_KEYS, TRANSFORMER_RANKER_BASE_OPT
label_desc: Use image node_id 2 for calling the RagDropoutPolyWrapper obj's underlying member method code with example usage: obj._build_model(opt) and returns: agent,  agent