Skip to content

Commit

Permalink
Fix callback default (horror bug!) (#1534)
Browse files Browse the repository at this point in the history
* fix horror bug

* update changelog

* fix doctest

* liine too long
  • Loading branch information
Adrian Wälchli committed Apr 20, 2020
1 parent 452fa85 commit 4fca994
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

- Added a missing call to the `on_before_zero_grad` model hook ([#1493](https://github.com/PyTorchLightning/pytorch-lightning/pull/1493)).

-
- Fixed a bug that caused the `callbacks` Trainer argument to reference a global variable ([#1534](https://github.com/PyTorchLightning/pytorch-lightning/pull/1534)).


## [0.7.3] - 2020-04-09
Expand Down
9 changes: 6 additions & 3 deletions pytorch_lightning/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def __init__(
logger: Union[LightningLoggerBase, Iterable[LightningLoggerBase], bool] = True,
checkpoint_callback: Union[ModelCheckpoint, bool] = True,
early_stop_callback: Optional[Union[EarlyStopping, bool]] = False,
callbacks: List[Callback] = [],
callbacks: Optional[List[Callback]] = None,
default_root_dir: Optional[str] = None,
gradient_clip_val: float = 0,
process_position: int = 0,
Expand Down Expand Up @@ -293,7 +293,7 @@ def __init__(
"""

# Init callbacks
self.callbacks = callbacks
self.callbacks = callbacks or []
self.on_init_start()

# benchmarking
Expand Down Expand Up @@ -546,7 +546,10 @@ def get_init_arguments_and_types(cls) -> List[Tuple[str, Tuple, Any]]:
(<class 'int'>, typing.Dict[int, int], typing.List[list]),
1),
...
('callbacks', (<class 'pytorch_lightning.callbacks.base.Callback'>,), []),
('callbacks',
(typing.List[pytorch_lightning.callbacks.base.Callback],
<class 'NoneType'>),
None),
('check_val_every_n_epoch', (<class 'int'>,), 1),
...
('max_epochs', (<class 'int'>,), 1000),
Expand Down

0 comments on commit 4fca994

Please sign in to comment.