The predicted value for the model should be between 0 and 1.
import torch
import torch.nn.functional as F
preds = torch.ones(3) + 0.01
target = torch.ones(3)
F.binary_cross_entropy(preds, target) # Crashes as preds is not between 0 and 1.

I suspect this is what is happening in the epoch in which it is crashing i.e. preds is not in range 0 and 1
For the epoch it crashes can you do,
try:
    # training step
except:
    mask = (preds > 1) + (preds < 0) # see if any of the value in mask is True
    print(mask.sum()) # If non-zero, then predictions are out of the range.

Most probably you have done this but do verify if you have applied sigmoid before passing the preds to the model.
Or you can use https://pytorch.org/docs/stable/nn.functional.html#binary-cross-entropy-with-logits 2
Hope this helps.