Looks like at some point in training the model is outputting value outside the range of 0 to 1. Are you sure that the predicted value from the model are in range 0 to 1?
Can you put a try-except to see the value of the model prediction when Error is raised?