Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/pytorch_lightning/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).


## [unreleased] - 2022-MM-DD

### Changed

- Moved the warning about saving nn.Module in `save_hyperparameters()` to before the deepcopy ([#15132](https://github.com/Lightning-AI/lightning/pull/15132))


## [1.8.0] - 2022-MM-DD


Expand Down
5 changes: 3 additions & 2 deletions src/pytorch_lightning/utilities/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,6 @@ def save_hyperparameters(

# `hparams` are expected here
obj._set_hparams(hp)
# make deep copy so there is not other runtime changes reflected
obj._hparams_initial = copy.deepcopy(obj._hparams)

for k, v in obj._hparams.items():
if isinstance(v, nn.Module):
Expand All @@ -266,6 +264,9 @@ def save_hyperparameters(
f" It is recommended to ignore them using `self.save_hyperparameters(ignore=[{k!r}])`."
)

# make a deep copy so there are no other runtime changes reflected
obj._hparams_initial = copy.deepcopy(obj._hparams)


class AttributeDict(Dict):
"""Extended dictionary accessible with dot notation.
Expand Down