I don’t have a clear answer, as I don’t know this particular model, but let’s try to debug-by-questions.

Have you tried to see which tensors require gradient and which don’t? In particular look at loss_face_feature_A and loss_face_feature_B.
Moreover, if you need gradient I assume you want to optimize the model. In that case the call to face_model.eval() is not appropriate I think. When training, the model has to be in training mode.

Or am I missing something?