MAIN#

This script is the main entry point for the Mammoth project. It contains the main function main() that orchestrates the training process.

The script performs the following tasks: - Imports necessary modules and libraries. - Sets up the necessary paths and configurations. - Parses command-line arguments. - Initializes the dataset, model, and other components. - Trains the model using the train() function.

To run the script, execute it directly or import it as a module and call the main() function.

Functions#

utils.main.add_help(parser)[source]#

Add the help argument to the parser

utils.main.check_args(args, dataset=None)[source]#

Just a (non complete) stream of asserts to ensure the validity of the arguments.

utils.main.extend_args(args, dataset)[source]#

Extend the command-line arguments with the default values from the dataset and the model.

utils.main.initialize(args=None)[source]#
Return type:

Tuple[ContinualModel, ContinualDataset, Namespace]

utils.main.lecun_fix()[source]#
utils.main.load_configs(parser, cmd=None)[source]#
Return type:

dict

utils.main.main(args=None)[source]#

Main function to run the Mammoth framework. It loads the model and dataset, checks the arguments, and starts the training process.

utils.main.merge_namespace(args, ckpt_args)[source]#

Merge the command line arguments with the checkpoint arguments. If a key is present in both, the value from the command line arguments takes precedence.

Return type:

Namespace

utils.main.parse_args(cmd=None, return_parser_only=False, verbose=False)[source]#

Parse command line arguments for the mammoth program and sets up the args object. This function initializes the argument parser, adds the necessary arguments, and parses the command line arguments. It also loads the configuration files for the model and dataset, sets defaults, and performs some checks on the arguments. If return_parser_only is True, it returns the parser instead of the parsed arguments.

Parameters:
  • cmd (Optional[List[str]]) – Command line arguments to parse. If None, uses sys.argv[1:].

  • return_parser_only (bool) – If True, returns the parser instead of the parsed arguments.

Returns:

Parsed command line arguments.

Return type:

args (argparse.Namespace)

utils.main.add_help(parser)[source]#

Add the help argument to the parser

utils.main.check_args(args, dataset=None)[source]#

Just a (non complete) stream of asserts to ensure the validity of the arguments.

utils.main.extend_args(args, dataset)[source]#

Extend the command-line arguments with the default values from the dataset and the model.

utils.main.initialize(args=None)[source]#
Return type:

Tuple[ContinualModel, ContinualDataset, Namespace]

utils.main.lecun_fix()[source]#
utils.main.load_configs(parser, cmd=None)[source]#
Return type:

dict

utils.main.main(args=None)[source]#

Main function to run the Mammoth framework. It loads the model and dataset, checks the arguments, and starts the training process.

utils.main.merge_namespace(args, ckpt_args)[source]#

Merge the command line arguments with the checkpoint arguments. If a key is present in both, the value from the command line arguments takes precedence.

Return type:

Namespace

utils.main.parse_args(cmd=None, return_parser_only=False, verbose=False)[source]#

Parse command line arguments for the mammoth program and sets up the args object. This function initializes the argument parser, adds the necessary arguments, and parses the command line arguments. It also loads the configuration files for the model and dataset, sets defaults, and performs some checks on the arguments. If return_parser_only is True, it returns the parser instead of the parsed arguments.

Parameters:
  • cmd (Optional[List[str]]) – Command line arguments to parse. If None, uses sys.argv[1:].

  • return_parser_only (bool) – If True, returns the parser instead of the parsed arguments.

Returns:

Parsed command line arguments.

Return type:

args (argparse.Namespace)