diff --git a/CHANGELOG.md b/CHANGELOG.md index adf5113e9eba6..ceeb42ecb6fb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,13 +35,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Changed the behaviour when logging evaluation step metrics to no longer append `/epoch_*` to the metric name ([#7351](https://github.com/PyTorchLightning/pytorch-lightning/pull/7351)) -- Changed `resolve_training_type_plugins` to allow setting `num_nodes` and `sync_batchnorm` from `Trainer` setting ([7026](https://github.com/PyTorchLightning/pytorch-lightning/pull/7026)) +- Changed `resolve_training_type_plugins` to allow setting `num_nodes` and `sync_batchnorm` from `Trainer` setting ([#7026](https://github.com/PyTorchLightning/pytorch-lightning/pull/7026)) -- Changed `model.state_dict()` in `CheckpointConnector` to allow `training_type_plugin` to customize the model's `state_dict()` ([7474](https://github.com/PyTorchLightning/pytorch-lightning/pull/7474)) +- Default `seed_everything(workers=True)` in the `LightningCLI` ([#7504](https://github.com/PyTorchLightning/pytorch-lightning/pull/7504)) -- MLflowLogger now uses the env variable `MLFLOW_TRACKING_URI` as default tracking uri ([7457](https://github.com/PyTorchLightning/pytorch-lightning/pull/7457)) +- Changed `model.state_dict()` in `CheckpointConnector` to allow `training_type_plugin` to customize the model's `state_dict()` ([#7474](https://github.com/PyTorchLightning/pytorch-lightning/pull/7474)) + + +- MLflowLogger now uses the env variable `MLFLOW_TRACKING_URI` as default tracking uri ([#7457](https://github.com/PyTorchLightning/pytorch-lightning/pull/7457)) ### Deprecated diff --git a/docs/source/common/lightning_cli.rst b/docs/source/common/lightning_cli.rst index b11d505c502ad..1df80e1ccf830 100644 --- a/docs/source/common/lightning_cli.rst +++ b/docs/source/common/lightning_cli.rst @@ -91,8 +91,8 @@ practice to create a configuration file and provide this to the tool. A way to d The instantiation of the :class:`~pytorch_lightning.utilities.cli.LightningCLI` class takes care of parsing command line and config file options, instantiating the classes, setting up a callback to save the config in the log directory and -finally running :func:`trainer.fit`. The resulting object :code:`cli` can be used for instance to get the result of fit, -i.e., :code:`cli.fit_result`. +finally running the trainer. The resulting object :code:`cli` can be used for example to get the instance of the +model, (:code:`cli.model`). After multiple trainings with different configurations, each run will have in its respective log directory a :code:`config.yaml` file. This file can be used for reference to know in detail all the settings that were used for each diff --git a/pl_examples/basic_examples/autoencoder.py b/pl_examples/basic_examples/autoencoder.py index a574adb40d6e0..8ea03dabc9bdb 100644 --- a/pl_examples/basic_examples/autoencoder.py +++ b/pl_examples/basic_examples/autoencoder.py @@ -116,8 +116,7 @@ def test_dataloader(self): def cli_main(): cli = LightningCLI(LitAutoEncoder, MyDataModule, seed_everything_default=1234) - result = cli.trainer.test(cli.model, datamodule=cli.datamodule) - print(result) + cli.trainer.test(cli.model, datamodule=cli.datamodule) if __name__ == '__main__': diff --git a/pl_examples/basic_examples/backbone_image_classifier.py b/pl_examples/basic_examples/backbone_image_classifier.py index 53a24dfdb221f..57cf97be00023 100644 --- a/pl_examples/basic_examples/backbone_image_classifier.py +++ b/pl_examples/basic_examples/backbone_image_classifier.py @@ -129,8 +129,7 @@ def test_dataloader(self): def cli_main(): cli = LightningCLI(LitClassifier, MyDataModule, seed_everything_default=1234) - result = cli.trainer.test(cli.model, datamodule=cli.datamodule) - print(result) + cli.trainer.test(cli.model, datamodule=cli.datamodule) if __name__ == '__main__': diff --git a/pl_examples/basic_examples/dali_image_classifier.py b/pl_examples/basic_examples/dali_image_classifier.py index 1a9dc46c81137..eca5c21b3242c 100644 --- a/pl_examples/basic_examples/dali_image_classifier.py +++ b/pl_examples/basic_examples/dali_image_classifier.py @@ -222,8 +222,7 @@ def cli_main(): return cli = LightningCLI(LitClassifier, MyDataModule, seed_everything_default=1234) - result = cli.trainer.test(cli.model, datamodule=cli.datamodule) - print(result) + cli.trainer.test(cli.model, datamodule=cli.datamodule) if __name__ == "__main__": diff --git a/pl_examples/basic_examples/simple_image_classifier.py b/pl_examples/basic_examples/simple_image_classifier.py index d401e884a2f18..ffb6434352b2e 100644 --- a/pl_examples/basic_examples/simple_image_classifier.py +++ b/pl_examples/basic_examples/simple_image_classifier.py @@ -77,8 +77,7 @@ def configure_optimizers(self): def cli_main(): cli = LightningCLI(LitClassifier, MNISTDataModule, seed_everything_default=1234) - result = cli.trainer.test(cli.model, datamodule=cli.datamodule) - print(result) + cli.trainer.test(cli.model, datamodule=cli.datamodule) if __name__ == '__main__': diff --git a/pytorch_lightning/utilities/cli.py b/pytorch_lightning/utilities/cli.py index 413b06f39f7a6..da6592ae66c18 100644 --- a/pytorch_lightning/utilities/cli.py +++ b/pytorch_lightning/utilities/cli.py @@ -128,13 +128,14 @@ def __init__( .. warning:: ``LightningCLI`` is in beta and subject to change. Args: - model_class: The LightningModule class to train on. - datamodule_class: An optional LightningDataModule class. + model_class: :class:`~pytorch_lightning.core.lightning.LightningModule` class to train on. + datamodule_class: An optional :class:`~pytorch_lightning.core.datamodule.LightningDataModule` class. save_config_callback: A callback class to save the training config. - trainer_class: An optional extension of the Trainer class. + trainer_class: An optional subclass of the :class:`~pytorch_lightning.trainer.trainer.Trainer` class. trainer_defaults: Set to override Trainer defaults or add persistent callbacks. - seed_everything_default: Default value for seed_everything argument. - description: Description of the tool shown when running --help. + seed_everything_default: Default value for the :func:`~pytorch_lightning.utilities.seed.seed_everything` + seed argument. + 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 LightningArgumentParser. @@ -165,7 +166,7 @@ def __init__( self.add_arguments_to_parser(self.parser) self.parse_arguments() if self.config['seed_everything'] is not None: - seed_everything(self.config['seed_everything']) + seed_everything(self.config['seed_everything'], workers=True) self.before_instantiate_classes() self.instantiate_classes() self.prepare_fit_kwargs()