Page 1 of 1

Solution to convert error: invalid value encountered in rint patched_face = np.rint

Posted: Thu Jan 05, 2023 11:47 am
by fscjp

During two separate training sessions I've received the following error during the convert process:

C:\Users\fs\faceswap_amd\lib\convert.py:197: RuntimeWarning: invalid value encountered in rint
patched_face = np.rint(patched_face,...

This results in black boxes being shown over the swapped face. The issue is only present during convert and not evident during training since everything appears normal.

I read in some previous posts that this was likely due to a NaN somewhere in the model and that the session is corrupted with little hope of recovery. I did run the model through Nan-Scan which did not uncover any issues.

Being curious as to why the training process showed no signs of problems, I modified the training configuration to disable Mixed Precision and then reran the training for as many iterations to ensure a [Saved model] step was run at least twice.

I then reran the conversion and the rint warning/error disappeared. I was able to convert successfully and continue training with no loss in progress or data.

Hope this helps some else out there that might run into this same issue.