mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-10 12:21:57 +08:00
Better error message if no loss was returned from model.training_step() (#294)
This commit is contained in:
committed by
William Falcon
parent
63c475c600
commit
42764d18c7
@@ -1156,6 +1156,10 @@ class Trainer(TrainerIO):
|
||||
except Exception:
|
||||
if type(output) is torch.Tensor:
|
||||
loss = output
|
||||
else:
|
||||
raise RuntimeError(
|
||||
'No `loss` value in the dictionary returned from `model.training_step()`.'
|
||||
)
|
||||
|
||||
# when using dp need to reduce the loss
|
||||
if self.use_dp:
|
||||
|
||||
Reference in New Issue
Block a user