コード例 #1
0
 def get_additional_agent_args(cls) -> ParlaiParser:
     """
     Return a parser with arguments sourced from several sub models.
     """
     additional_agent_parser = ParlaiParser(add_parlai_args=False)
     BartAgent.add_cmdline_args(additional_agent_parser)
     setup_rag_args(additional_agent_parser)
     GoldDocRetrieverFiDAgent.add_cmdline_args(additional_agent_parser)
     SearchQuerySearchEngineFiDAgent.add_cmdline_args(additional_agent_parser)
     WizIntGoldDocRetrieverFiDAgent.add_cmdline_args(additional_agent_parser)
     ComboFidAgent.add_cmdline_args(additional_agent_parser)
     return additional_agent_parser
コード例 #2
0
 def add_cmdline_args(cls,
                      parser: ParlaiParser,
                      partial_opt: Optional[Opt] = None) -> ParlaiParser:
     """
     Add RAG Args.
     """
     PolyencoderAgent.add_cmdline_args(parser, partial_opt=None)
     TransformerGeneratorRagAgent.add_cmdline_args(parser, partial_opt)
     parser = setup_rag_args(parser)
     RagTurn.add_cmdline_args(parser, partial_opt)
     if partial_opt and partial_opt.get('generation_model') == 'bart':
         BartRagAgent.add_cmdline_args(parser, partial_opt=partial_opt)
     T5RagAgent.add_cmdline_args(parser, partial_opt=partial_opt)
     # BART Agent sets these to True; doesn't let you set anything else
     parser.set_defaults(fp16=False, force_fp16_tokens=False)
     return parser