mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-10-28 13:20:31 +08:00
1 parent
4df4d4cc03
commit
8347a6c87e
1 file changed
+7
@@ -32,10 +32,17 @@ class TrainerIOMixin(object):
|
||||
:param model:
|
||||
:return:
|
||||
"""
|
||||
# clear cache before restore
|
||||
if self.on_gpu:
|
||||
torch.cuda.empty_cache()
|
||||
|
||||
# if script called from hpc resubmit, load weights
|
||||
did_restore_hpc_weights = self.restore_hpc_weights_if_needed(model)
|
||||
|
||||
# clear cache after restore
|
||||
if self.on_gpu:
|
||||
torch.cuda.empty_cache()
|
||||
|
||||
if not did_restore_hpc_weights:
|
||||
# restore weights if same exp version
|
||||
self.restore_state_if_checkpoint_exists(model)
|
||||
|
||||
Reference in new issue
Block a user