core.params

Provides an argument parser and a set of default command line options for using the ParlAI package.

parlai.core.params.str2class(value)

From import path string, returns the class specified. For example, the string ‘parlai.agents.drqa.drqa:SimpleDictionaryAgent’ returns <class ‘parlai.agents.drqa.drqa.SimpleDictionaryAgent’>.

parlai.core.params.class2str(value)

Inverse of params.str2class().

class parlai.core.params.ParlaiParser(add_parlai_args=True, add_model_args=False, model_argv=None)

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 example, see parlai.core.dict.DictionaryAgent.add_cmdline_args.

__init__(add_parlai_args=True, add_model_args=False, model_argv=None)

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).

parse_args(args=None, namespace=None, print_args=True)

Parses the provided arguments and returns a dictionary of the args. We specifically remove items with None as values in order to support the style opt.get(key, default), which would otherwise return None.

print_args()

Print out all the arguments in this parser.