cli¶
Functions
|
|
Classes
Initialize argument parser that supports configuration file input. |
|
Receives as input pytorch-lightning classes (or callables which return pytorch-lightning classes), which are called / instantiated using a parsed configuration file and / or command line args. |
|
Deprecated utilities for LightningCLI.
- class pytorch_lightning.utilities.cli.LightningArgumentParser(*args, **kwargs)[source]¶
Bases:
pytorch_lightning.cli.LightningArgumentParserInitialize argument parser that supports configuration file input.
For full details of accepted arguments see ArgumentParser.__init__.
- class pytorch_lightning.utilities.cli.LightningCLI(*args, **kwargs)[source]¶
Bases:
pytorch_lightning.cli.LightningCLIReceives as input pytorch-lightning classes (or callables which return pytorch-lightning classes), which are called / instantiated using a parsed configuration file and / or command line args.
Parsing of configuration from environment variables can be enabled by setting
env_parse=True. A full configuration yaml would be parsed fromPL_CONFIGif set. Individual settings are so parsed from variables named for examplePL_TRAINER__MAX_EPOCHS.For more info, read the CLI docs.
Warning
LightningCLIis in beta and subject to change.- Parameters:
model_class¶ – An optional
LightningModuleclass to train on or a callable which returns aLightningModuleinstance when called. IfNone, you can pass a registered model with--model=MyModel.datamodule_class¶ – An optional
LightningDataModuleclass or a callable which returns aLightningDataModuleinstance when called. IfNone, you can pass a registered datamodule with--data=MyDataModule.save_config_callback¶ – A callback class to save the config.
save_config_kwargs¶ – Parameters that will be used to instantiate the save_config_callback.
trainer_class¶ – An optional subclass of the
Trainerclass or a callable which returns aTrainerinstance when called.trainer_defaults¶ – Set to override Trainer defaults or add persistent callbacks. The callbacks added through this argument will not be configurable from a configuration file and will always be present for this particular CLI. Alternatively, configurable callbacks can be added as explained in the CLI docs.
seed_everything_default¶ – Number for the
seed_everything()seed value. Set to True to automatically choose a seed value. Setting it to False will avoid callingseed_everything.description¶ – Description of the tool shown when running
--help.env_prefix¶ – Prefix for environment variables.
env_parse¶ – Whether environment variable parsing is enabled.
parser_kwargs¶ – Additional arguments to instantiate each
LightningArgumentParser.subclass_mode_model¶ – Whether model can be any subclass of the given class.
subclass_mode_data¶ –
Whether datamodule can be any subclass of the given class.
args¶ (
Any) – Arguments to parse. IfNonethe arguments are taken fromsys.argv. Command line style arguments can be given in alist. Alternatively, structured config options can be given in adictorjsonargparse.Namespace.run¶ – Whether subcommands should be added to run a
Trainermethod. If set toFalse, the trainer and model classes will be instantiated only.auto_registry¶ – Whether to automatically fill up the registries with all defined subclasses.