Arg
This module contains an extension of the argparse.ArgumentParser class and some parsers that are generally useful for writing training scripts using the neuromancer library. ArgumentParser is extended to take advantage of grouped arguments when passing command line arguments to functions and to abbreviate argparse’s verbose method names.
- class neuromancer.arg.ArgParser(prefix='', **kwargs)[source]
Subclass argparser for abbreviated method calls, separate namespaces for argument groups, and optional command line prefix so that we can reuse parser definitions.
- check_for_group(group_name)[source]
This function will return the argument group if it exists
- Parameters:
group_name – (str) Name of the argument group
- Returns:
(argparse._ArgumentGroup or None)
- group(group_name, prefix=None)[source]
Monkey patch to abbreviate verbose call to add_argument_group. If an argument group exists by the name group_name it will be returned, otherwise a new argument group will be created and returned.
- Parameters:
group_name – (str) Name of the argument group
- Returns:
argparse._ArgumentGroup
- neuromancer.arg.add(self, argname, **kwargs)[source]
Monkey patch for argument group objects.
- Parameters:
self – Refers to instantiated object of class being patched
argname – (str) Command line argument
kwargs – Whatever keyword args this thing accepts
- Returns:
Whatever add_argument returns (I think it is an Action object)
- neuromancer.arg.ctrl_loss(prefix='')[source]
Command line parser for special control loss arguments
- Parameters:
prefix – (str) Optional prefix for command line arguments to resolve naming conflicts when multiple parsers are bundled as parents.
- Returns:
(arg.ArgParse) A command line parser
- neuromancer.arg.data(prefix='', system='CSTR')[source]
Command line parser for data arguments
- Parameters:
prefix – (str) Optional prefix for command line arguments to resolve naming conflicts when multiple parsers are bundled as parents.
- Returns:
(arg.ArgParse) A command line parser
- neuromancer.arg.freeze(prefix='')[source]
Command line parser for weight freezing arguments
- Parameters:
prefix – (str) Optional prefix for command line arguments to resolve naming conflicts when multiple parsers are bundled as parents.
- Returns:
(arg.ArgParse) A command line parser
- neuromancer.arg.lin(prefix='')[source]
Command line parser for linear map arguments
- Parameters:
prefix – (str) Optional prefix for command line arguments to resolve naming conflicts when multiple parsers are bundled as parents.
- Returns:
(arg.ArgParse) A command line parser
- neuromancer.arg.log(prefix='')[source]
Command line parser for logging arguments
- Parameters:
prefix – (str) Optional prefix for command line arguments to resolve naming conflicts when multiple parsers
are bundled as parents. :return: (arg.ArgParse) A command line parser
- neuromancer.arg.loss(prefix='')[source]
Command line parser for loss function arguments
- Parameters:
prefix – (str) Optional prefix for command line arguments to resolve naming conflicts when multiple parsers are bundled as parents.
- Returns:
(arg.ArgParse) A command line parser
- neuromancer.arg.opt(prefix='')[source]
Command line parser for optimization arguments
- Parameters:
prefix – (str) Optional prefix for command line arguments to resolve naming conflicts when multiple parsers are bundled as parents.
- Returns:
(arg.ArgParse) A command line parser