diff --git a/CHANGELOG.md b/CHANGELOG.md index 91d8068a0a3a3..0a168db7b486d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -240,7 +240,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Fixed a bug that caused incorrect batch indices to be passed to the `BasePredictionWriter` hooks when using a dataloader with `num_workers > 0` ([#10870](https://github.com/PyTorchLightning/pytorch-lightning/pull/10870)) -- +- Fixed an issue with item assignment on the logger on rank > 0 for those who support it ([#10917](https://github.com/PyTorchLightning/pytorch-lightning/pull/10917)) diff --git a/pytorch_lightning/loggers/base.py b/pytorch_lightning/loggers/base.py index e5ccae435d8c9..0698a409762b4 100644 --- a/pytorch_lightning/loggers/base.py +++ b/pytorch_lightning/loggers/base.py @@ -474,6 +474,9 @@ def __getitem__(self, idx) -> "DummyExperiment": # enables self.logger.experiment[0].add_image(...) return self + def __setitem__(self, *args, **kwargs) -> None: + pass + class DummyLogger(LightningLoggerBase): """Dummy logger for internal use. diff --git a/tests/loggers/test_base.py b/tests/loggers/test_base.py index d6b753c0439ee..f4a91f63b50c4 100644 --- a/tests/loggers/test_base.py +++ b/tests/loggers/test_base.py @@ -241,6 +241,13 @@ def test_dummylogger_noop_method_calls(): logger.log_metrics("1", 2, three="three") +def test_dummyexperiment_support_item_assignment(): + """Test that the DummyExperiment supports item assignment.""" + experiment = DummyExperiment() + experiment["variable"] = "value" + assert experiment["variable"] != "value" # this is only a stateless mock experiment + + def test_np_sanitization(): class CustomParamsLogger(CustomLogger): def __init__(self):