Add cleanup only on the error exit (when tile < 128) before re-raising the OOM exception

This commit is contained in:
yash-711 2026-02-25 13:04:24 +05:30 committed by GitHub
parent 70408503fb
commit b749e0db49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -89,6 +89,7 @@ class ImageUpscaleWithModel(io.ComfyNode):
except model_management.OOM_EXCEPTION as e:
tile //= 2
if tile < 128:
upscale_model.to("cpu")
raise e
# upscale_model.to("cpu") # Commented out to keep model on GPU because when processing batch images then model unnecessarily moves to CPU