Skip to content

Commit

Permalink
CudnnBatchNormBackward nan temporary fix ultralytics#12
Browse files Browse the repository at this point in the history
:)
  • Loading branch information
manole-alexandru committed Apr 10, 2023
1 parent 2975086 commit ef08e87
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion train.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,10 @@ def train(hyp, opt, device, callbacks): # hyp is path/to/hyp.yaml or hyp dictio
loss *= 4.

# Backward
scaler.scale(loss).backward(retain_graph=True)
try:
scaler.scale(loss).backward(retain_graph=True)
except Exception as e:
print('\n-------- FOUND EXCEPTION: ', e, ' Life goes on.-------\n')

scaler_seg.scale(loss_seg).backward()

Expand Down

0 comments on commit ef08e87

Please sign in to comment.