Skip to content

Commit

Permalink
Replace Wandb callback's finalize with no-op (Lightning-AI#1193)
Browse files Browse the repository at this point in the history
* Replace Wandb callback's finalize with no-op

* Update pytorch_lightning/loggers/wandb.py

* Update wandb.py

* remove wandb logger's finalize and update tests

* update changelog

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: William Falcon <waf2107@columbia.edu>
  • Loading branch information
3 people authored and akarnachev committed Apr 3, 2020
1 parent a683186 commit fa1f5b5
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 22 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
### Removed

- Removed duplicated module `pytorch_lightning.utilities.arg_parse` for loading CLI arguments ([#1167](https://github.com/PyTorchLightning/pytorch-lightning/issues/1167))
- Removed wandb logger's finalize ([#1193](https://github.com/PyTorchLightning/pytorch-lightning/pull/1193))
- Dropped `torchvision` dependency in tests and added own MNIST dataset class instead ([#986](https://github.com/PyTorchLightning/pytorch-lightning/issues/986))

### Fixed
Expand Down
8 changes: 0 additions & 8 deletions pytorch_lightning/loggers/wandb.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,6 @@ def log_metrics(self, metrics: Dict[str, float], step: Optional[int] = None) ->
metrics['global_step'] = step
self.experiment.log(metrics)

@rank_zero_only
def finalize(self, status: str = 'success') -> None:
try:
exit_code = 0 if status == 'success' else 1
wandb.join(exit_code)
except TypeError:
wandb.join()

@property
def name(self) -> str:
return self.experiment.project_name()
Expand Down
14 changes: 0 additions & 14 deletions tests/loggers/test_wandb.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,6 @@ def test_wandb_logger(wandb):
logger.watch('model', 'log', 10)
wandb.watch.assert_called_once_with('model', log='log', log_freq=10)

logger.finalize('fail')
wandb.join.assert_called_once_with(1)

wandb.join.reset_mock()
logger.finalize('success')
wandb.join.assert_called_once_with(0)

wandb.join.reset_mock()
wandb.join.side_effect = TypeError
with pytest.raises(TypeError):
logger.finalize('any')

wandb.join.assert_called()

assert logger.name == wandb.init().project_name()
assert logger.version == wandb.init().id

Expand Down

0 comments on commit fa1f5b5

Please sign in to comment.