"lib/bindings/git@developer.sourcefind.cn:OpenDAS/dynamo.git" did not exist on "183941fae1250a658807eb9f88076de857d69750"
Commit 5a004f04 authored by Marta's avatar Marta
Browse files

zero out nan components in loss

parent 45a98436
......@@ -1473,6 +1473,9 @@ class AlphaFoldLoss(nn.Module):
weight = self.config[k].weight
if weight:
loss = loss_fn()
if(torch.isnan(loss) or torch.isinf(loss)):
logging.warning(f"{k} loss is NaN. Skipping example...")
loss = loss.new_tensor(0., requires_grad=True)
cum_loss = cum_loss + weight * loss
return cum_loss
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment