mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-10 12:21:57 +08:00
added warning to crash (#1625)
* added warning to crash * formatting Co-authored-by: J. Borovec <jirka.borovec@seznam.cz>
This commit is contained in:
co-authored by
J. Borovec
parent
2ec8d61e94
commit
d40425d257
@@ -1162,9 +1162,9 @@ class LightningModule(ABC, GradInformation, ModelIO, ModelHooks):
|
||||
|
||||
# native amp + lbfgs is a no go right now
|
||||
if self.trainer.use_amp and self.trainer.use_native_amp:
|
||||
m = 'native PyTorch amp and lbfgs are not compatible. To request, please file' \
|
||||
'a Github issue in PyTorch and tag @mcarilli'
|
||||
raise MisconfigurationException(m)
|
||||
raise MisconfigurationException(
|
||||
'native PyTorch amp and lbfgs are not compatible.'
|
||||
' To request, please file a Github issue in PyTorch and tag @mcarilli')
|
||||
optimizer.step(second_order_closure)
|
||||
else:
|
||||
if self.trainer.use_amp and self.trainer.use_native_amp:
|
||||
|
||||
@@ -251,9 +251,11 @@ class TrainerIOMixin(ABC):
|
||||
# do the actual save
|
||||
try:
|
||||
self._atomic_save(checkpoint, filepath)
|
||||
except AttributeError:
|
||||
except AttributeError as e:
|
||||
if 'hparams' in checkpoint:
|
||||
del checkpoint['hparams']
|
||||
rank_zero_warn('warning, `hparams` dropped from checkpoint.'
|
||||
f' An attribute is not picklable {e}')
|
||||
|
||||
self._atomic_save(checkpoint, filepath)
|
||||
|
||||
@@ -434,9 +436,11 @@ class TrainerIOMixin(ABC):
|
||||
# TODO: fix for anything with multiprocess DP, DDP, DDP2
|
||||
try:
|
||||
self._atomic_save(checkpoint, filepath)
|
||||
except AttributeError:
|
||||
except AttributeError as e:
|
||||
if 'hparams' in checkpoint:
|
||||
del checkpoint['hparams']
|
||||
rank_zero_warn('warning, `hparams` dropped from checkpoint.'
|
||||
f' An attribute is not picklable {e}')
|
||||
|
||||
self._atomic_save(checkpoint, filepath)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user