'Initializes the ParlAI argparser.
- add_parlai_args (default True) initializes the default arguments for the
ParlAI package, including the data download paths and task arguments.
- add_model_args (default False) initializes the default arguments for
loading models, including initializing arguments from that model.
- model_argv (default None uses sys.argv) specifies the list of
arguments which includes the model name (e.g. `-m drqa`).'

def __init__(self, add_parlai_args=True, add_model_args=False, model_argv=None):

    super().__init__(description='ParlAI    parser.')
    self.register('type', 'bool', str2bool)
    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
    if add_parlai_args:
        self.add_parlai_args()
        self.add_image_args()
    if add_model_args:
        self.add_model_args(model_argv)
