QualityScaler icon indicating copy to clipboard operation
QualityScaler copied to clipboard

Cannot convert float NaN to integer

Open samuelgbrown opened this issue 9 months ago • 14 comments

Attempting to convert a 2 minute long mp4 file (trimmed from a larger file using VLC). After performing the conversion, get an "Upscale error" with the message "cannot convert float NaN to integer". Settings attached:

Image

RTX 4090, AMD Ryzen 7 5800X

samuelgbrown avatar Feb 11 '25 15:02 samuelgbrown

Hi my friend,

When does this error occur? Immediately at the beginning of upscaling?

In any case, doesn't the terminal give any other info of the error?

Djdefrag avatar Feb 11 '25 15:02 Djdefrag

This was at the end of the conversion. Here is the terminal output:

Frames supported simultaneously by GPU: 68
1. Upscaling video
1. Upscaling video (8 threads)
1. Upscaling video 0.00% (09m50s)
1. Upscaling video 0.67% (08m21s)
1. Upscaling video 1.11% (05m25s)
1. Upscaling video 1.78% (05m03s)
[...]
1. Upscaling video 95.72% (03s)
C:\Users\sambr\AI Video Upscaling\QualityScaler-4.0.0\.venv\lib\site-packages\numpy\core\fromnumeric.py:3504: RuntimeWarning: Mean of empty slice.
  return _methods._mean(a, axis=axis, dtype=dtype,
C:\Users\sambr\AI Video Upscaling\QualityScaler-4.0.0\.venv\lib\site-packages\numpy\core\_methods.py:129: RuntimeWarning: invalid value encountered in scalar divide
  ret = ret.dtype.type(ret / rcount)
1. Upscaling video 96.75% (02s)
1. Upscaling video 96.78% (02s)
1. Upscaling video 97.19% (01s)
1. Upscaling video 97.69% (01s)
1. Upscaling video 98.39% (01s)
Error cannot convert float NaN to integer

I can include the original file, if that would be helpful.

samuelgbrown avatar Feb 11 '25 15:02 samuelgbrown

Thank you my friend, maibe i found the problem, i will release a fix asap.

Should be when calculating the mean time processing

Djdefrag avatar Feb 11 '25 16:02 Djdefrag

UPDATE: Hi my friend, the problem is that with 8 threads the upscale process crash, sadly is a random issue, i will remove the 8 threads option (with 6 threads the error seems not present)

UPDATE 2: seems happening also with 6 threads :(

In any case, if an error like this happens, if you stop an start again the upscale will resume

Djdefrag avatar Feb 11 '25 16:02 Djdefrag

Hi my friend,

i think i fixed the problem, let me know if it works :)

UPDATE: in case the error happens, due to GPU driver timeout, the app will now suggest to retry. thank you :)

Djdefrag avatar Feb 11 '25 17:02 Djdefrag

As you noted, the calculation still failed, but the error message was more helpful when attempting to complete the conversion. I was able to successfully complete a conversion after starting the calculation up again.

Granted, it's still slightly confusing (it gives you instructions to continue and also asks to post an issue on the GitHub), but it's better than before.

Image

One other possible path forward is to silently catch the error (at least the first time), and just restart the conversion behind the scenes.

samuelgbrown avatar Feb 12 '25 15:02 samuelgbrown

yeah, I will investigate this problem better, let's say I did a termporary fix until I understand the problem.

Although unfortunately it is something very random, a friend of mine with a 1660 with 8 threads has no problem at all

Djdefrag avatar Feb 12 '25 16:02 Djdefrag

Done a few upscales the recent day. The error seams to come at the end of the jobs. They happen from ~85% done and forward. Som sort of overflow?

Anders-Falk avatar Feb 16 '25 17:02 Anders-Falk

mmh i think the problem happens only on some GPUs and with some drivers.

Also, the AI multithreading is not fully supported by the AI engine, I hope they will fix it with updates

Djdefrag avatar Feb 17 '25 10:02 Djdefrag

I've been having exactly the same problem for a few days now, always at the end of a conversion (denoise). I have to restart it several times to get it done.

Using the Steam version

i9 13900k RTX 4090 Strix Drivers 572.42

joel4015 avatar Feb 18 '25 16:02 joel4015

@joel4015

Hi my friend, you too by selecting AI multithreading 8? or even with other values for this widget?

Djdefrag avatar Feb 18 '25 16:02 Djdefrag

Yes, 8 threads.

I switched to 6, and it worked. I don't know if this has any influence and if it's normal, but I've also noticed that RAM usage gradually rises to 100% (with 8 threads). I have 32GB DDR5

joel4015 avatar Feb 18 '25 16:02 joel4015

@joel4015 this should not happen, thank you very much, I will investigate this problem

Djdefrag avatar Feb 18 '25 17:02 Djdefrag

I use 6 threads but tried 4 also but the same problem. Always in the end ~20%

Anders-Falk avatar Feb 18 '25 18:02 Anders-Falk