class_docstr: Provide an opt-producer and CLI argument parser.
  
  Pseudo-extension of ``argparse`` which sets a number of parameters
  for the ParlAI framework. More options can be added specific to other
  modules by passing this object and calling ``add_arg()`` or
  ``add_argument()`` on it.
  
  For an example, see ``parlai.core.dict.DictionaryAgent.add_cmdline_args``.
  
  :param add_parlai_args:
      (default True) initializes the default arguments for ParlAI
      package, including the data download paths and task arguments.
  :param add_model_args:
      (default False) initializes the default arguments for loading
      models, including initializing arguments from that model.
class_docstr_tok: ["Provide","an","opt-producer","and","CLI","argument","parser",".","Pseudo-extension","of","``","argparse","``","which","sets","a","number","of","parameters","for","the","ParlAI","framework",".","More","options","can","be","added","specific","to","other","modules","by","passing","this","object","and","calling","``","add_arg","(",")","``","or","``","add_argument","(",")","``","on","it",".","For","an","example",",","see","``","parlai.core.dict.DictionaryAgent.add_cmdline_args","``",".",":","param","add_parlai_args",":","(","default","True",")","initializes","the","default","arguments","for","ParlAI","package",",","including","the","data","download","paths","and","task","arguments",".",":","param","add_model_args",":","(","default","False",")","initializes","the","default","arguments","for","loading","models",",","including","initializing","arguments","from","that","model","."]
docstr: Initialize the ParlAI parser.
docstr_tok: ["Initialize","the","ParlAI","parser","."]
code: def __init__(
      self,
      add_parlai_args=True,
      add_model_args=False,
      description=None,
      **kwargs,
  ):
      """
      Initialize the ParlAI parser.
      """
      if "formatter_class" not in kwargs:
          kwargs["formatter_class"] = CustomHelpFormatter
  
      super().__init__(
          description=description,
          allow_abbrev=False,
          conflict_handler="resolve",
          add_help=True,
          **kwargs,
      )
      self.register("action", "helpall", _HelpAllAction)
      self.register("type", "nonestr", str2none)
      self.register("type", "bool", str2bool)
      self.register("type", "floats", str2floats)
      self.register("type", "multitask_weights", str2multitask_weights)
      self.register("type", "class", str2class)
      self.parlai_home = os.path.dirname(
          os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
      )
      os.environ["PARLAI_HOME"] = self.parlai_home
  
      self.add_arg = self.add_argument
  
      # remember which args were specified on the command line
      self.overridable = {}
  
      if add_parlai_args:
          self.add_parlai_args()
      if add_model_args:
          self.add_model_args()
  
imports: import argparse
  import importlib
  import os
  import sys
  import datetime
  import parlai
  import parlai.utils.logging
  from parlai.core.build_data import modelzoo_path
  from parlai.core.loader import load_teacher_module, load_agent_module, load_world_module
  from parlai.tasks.tasks import ids_to_tasks
  from parlai.core.opt import Opt
  from parlai.utils.io import PathManager
  from typing import List, Optional
label_desc: Use image node_id 1 to create a new ParlaiParser object from inherited base classes: argparse with example: obj = ParlaiParser(add_parlai_args, add_model_args, description)