mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-10 12:21:57 +08:00
fix(wandb): use same logger on multiple training loops (#2055)
* fix(wandb): use same logger on multiple training loops New training loops reset step to 0 which would previously try to overwrite logs fix #2015 * docs(changelog.md): add reference to PR 2055
This commit is contained in:
@@ -66,6 +66,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
- Fixed `save_weights_only` in ModelCheckpoint ([#1780](https://github.com/PyTorchLightning/pytorch-lightning/pull/1780))
|
||||
|
||||
- Allow use of same `WandbLogger` instance for multiple training loops ([#2055](https://github.com/PyTorchLightning/pytorch-lightning/pull/2055))
|
||||
|
||||
## [0.7.6] - 2020-05-16
|
||||
|
||||
### Added
|
||||
|
||||
@@ -128,7 +128,7 @@ class WandbLogger(LightningLoggerBase):
|
||||
|
||||
@rank_zero_only
|
||||
def log_metrics(self, metrics: Dict[str, float], step: Optional[int] = None) -> None:
|
||||
self.experiment.log(metrics, step=step)
|
||||
self.experiment.log({'global_step': step, **metrics} if step is not None else metrics)
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
|
||||
@@ -13,11 +13,11 @@ def test_wandb_logger(wandb):
|
||||
logger = WandbLogger(anonymous=True, offline=True)
|
||||
|
||||
logger.log_metrics({'acc': 1.0})
|
||||
wandb.init().log.assert_called_once_with({'acc': 1.0}, step=None)
|
||||
wandb.init().log.assert_called_once_with({'acc': 1.0})
|
||||
|
||||
wandb.init().log.reset_mock()
|
||||
logger.log_metrics({'acc': 1.0}, step=3)
|
||||
wandb.init().log.assert_called_once_with({'acc': 1.0}, step=3)
|
||||
wandb.init().log.assert_called_once_with({'global_step': 3, 'acc': 1.0})
|
||||
|
||||
logger.log_hyperparams({'test': None})
|
||||
wandb.init().config.update.assert_called_once_with({'test': None}, allow_val_change=True)
|
||||
|
||||
Reference in New Issue
Block a user