Better error message if no loss was returned from model.training_step() (#294)
This commit is contained in:
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:
|
||||
|
|
Loading…
Reference in New Issue