Skip to content

Commit

Permalink
Lite: Don't pop value if they don't exist (#10613)
Browse files Browse the repository at this point in the history
  • Loading branch information
tchaton authored Nov 19, 2021
1 parent 8950354 commit 94390ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
### Fixed


- Fixed LigtningLite `_wrap_init` popping unexisting keys from DataLoader signature parameters ([#10613](https://github.com/PyTorchLightning/pytorch-lightning/pull/10613))


- Fixed signals being registered within threads ([#10610](https://github.com/PyTorchLightning/pytorch-lightning/pull/10610))


Expand Down
4 changes: 2 additions & 2 deletions pytorch_lightning/lite/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ def _wrap_init(f: Callable) -> Callable:
@functools.wraps(f)
def wrapper(module: Any, *args: Any, **kwargs: Dict[str, Any]) -> None:
params = dict(inspect.signature(module._old_init).parameters)
params.pop("args")
params.pop("kwargs")
params.pop("args", None)
params.pop("kwargs", None)
for init_name, init_arg in chain(zip(params, args), kwargs.items()):
setattr(module, init_name, init_arg)
f(module, *args, **kwargs)
Expand Down

0 comments on commit 94390ab

Please sign in to comment.