-
Notifications
You must be signed in to change notification settings - Fork 27.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: DAT upscaler is not working in hires fix. #14710
Comments
@rltgjqmcpgjadyd can you reproduce this with --no-half in COMMANDLINE_ARGS of webui-user.bat? If that avoids the problem, remove --no-half and then try what I've mentioned below. I ran into a similar issue rarely with Hires upscale and certain prompts/settings (but not Extras upscale) months back, not related specifically to DAT, and was able to resolve it after encountering it more frequently recently with HAT models by disabling autocast when upscaling. For DAT, HAT, and a few others, this should have no negative effects, since Spandrel enforces Float32/BFloat16 only for those model types anyway (of which webui currently only allows Float32). Assuming you've run into the same problem, you can try applying stable-diffusion-webui/modules/images.py Line 278 in 19c95de
which may be a good idea just in case autocast is causing other rare minor floating-point errors with slim potential for NaNs in other parts of the upscaling code as well. Since I've encountered this issue rarely even with FP16 ESRGAN upscale models during Hires in webui since 1.5.x or even earlier, I'd say the potential for that is very high. To avoid this, upscaling could be made to use manual casts only. or alternatively the line just before here:
but only if you don't care about autocast being partially enabled in other parts of the upscaling code. The last choice would be to do this for each model format specifically on a case-by-case basis (hat_model.py, dat_model.py, etc), likely just before return upscale_with_model. Though I haven't personally tested this location like the other two. From what I can tell, the autocast NaN bug occurs sometime after It is not so obvious in the current code, but when I tested refactoring to use torchvision.transforms.v2 (ToPILImage, ToTorchTensor, ToDtype) instead of numpy directly and split up the code a bit, the NaN occurred after model(tensor).squeeze(0) if autocast was not disabled before then, which also happened to be the first instance of model(tensor) being called (similar to the line linked above). |
fix after 652a7bb |
Checklist
What happened?
DAT upscaler is not working in hires fix.
it is only result in a black square image
Steps to reproduce the problem
What should have happened?
is DAT upscaler not available in hires fix?
What browsers do you use to access the UI ?
Google Chrome
Sysinfo
sysinfo-2024-01-21-00-50.json
Console logs
Additional information
No response
The text was updated successfully, but these errors were encountered: