From 0f99fcfc39ae7c218d652546ce52da1bd184b97c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Thu, 20 Jan 2022 13:35:43 +0100 Subject: [PATCH] [CLI] Save only the configuration used (#11532) --- CHANGELOG.md | 3 ++- tests/utilities/test_cli.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 444f58fef63f7..6f7a7602136ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). ### Fixed -- +- Fixed the format of the configuration saved automatically by the CLI's `SaveConfigCallback` ([#11532](https://github.com/PyTorchLightning/pytorch-lightning/pull/11532)) + - diff --git a/tests/utilities/test_cli.py b/tests/utilities/test_cli.py index dd2132d40c63d..954f5196536b3 100644 --- a/tests/utilities/test_cli.py +++ b/tests/utilities/test_cli.py @@ -1259,6 +1259,10 @@ def test_lightning_cli_config_before_subcommand(): validate_mock.assert_called_once_with(cli.trainer, cli.model, verbose=False, ckpt_path="barfoo") assert cli.trainer.limit_val_batches == 1 + save_config_callback = cli.trainer.callbacks[0] + assert save_config_callback.config["trainer"]["limit_val_batches"] == 1 + assert save_config_callback.parser.subcommand == "validate" + @RunIf(min_python="3.7.3") def test_lightning_cli_config_before_subcommand_two_configs():