google-ai-edge / mediapipe-samples

Apache License 2.0
1.5k stars 386 forks source link

RuntimeWarning: overflow encountered in cast v.numpy().astype("float16").tofile(output_bin_file) #408

Open mansoorvm opened 3 months ago

mansoorvm commented 3 months ago

Got following warning when converting model

E:\Project\AiTheme\convert.py:42: RuntimeWarning: overflow encountered in cast v.numpy().astype("float16").tofile(output_bin_file)

codezjx commented 3 months ago

+1, same error on MacOS, using the runwayml/stable-diffusion-v1-5 ckpt file.

SagiHatzabi commented 3 months ago

+1, same error on MacOS RuntimeWarning: overflow encountered in cast v.numpy().astype("float16").tofile(output_bin_file)

ShiftHackZ commented 3 weeks ago

I faced the same error on Arch Linux, with Intel Core i9 10th gen CPU:

Tried this models.

To avoid this error, I changed float16 type to float32 type in convert.py script like this:

v.numpy().astype("float32").tofile(output_bin_file)

After patching type in the convert.py script, all 3 models converted without issues.