mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-10-30 13:40:46 +08:00
Better error message if no loss was returned from model.training_step() (#294)
This commit is contained in:
1 parent
63c475c600
commit
42764d18c7
1 file changed
+4
@@ -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