mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-08-14 12:16:41 +08:00
fix(comfy_extras): Fix OOM Tile
This commit is contained in:
parent
3a3b5babf2
commit
ddec938cde
@ -87,14 +87,18 @@ class ImageUpscaleWithModel:
|
|||||||
pbar = comfy.utils.ProgressBar(steps)
|
pbar = comfy.utils.ProgressBar(steps)
|
||||||
s = comfy.utils.tiled_scale(in_img, parallel_model, tile_x=tile, tile_y=tile, overlap=overlap, upscale_amount=upscale_model.scale, pbar=pbar, output_device=device)
|
s = comfy.utils.tiled_scale(in_img, parallel_model, tile_x=tile, tile_y=tile, overlap=overlap, upscale_amount=upscale_model.scale, pbar=pbar, output_device=device)
|
||||||
oom = False
|
oom = False
|
||||||
|
except torch.OutOfMemoryError as e:
|
||||||
|
tile //= 2
|
||||||
|
if tile < 128:
|
||||||
|
raise e
|
||||||
except model_management.OOM_EXCEPTION as e:
|
except model_management.OOM_EXCEPTION as e:
|
||||||
tile //= 2
|
tile //= 2
|
||||||
if tile < 128:
|
if tile < 128:
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
upscale_model.to("cpu")
|
upscale_model.to("cpu")
|
||||||
s = torch.clamp(s.movedim(-3,-1), min=0, max=1.0)
|
|
||||||
s.to("cpu")
|
s.to("cpu")
|
||||||
|
s = torch.clamp(s.movedim(-3,-1), min=0, max=1.0)
|
||||||
return (s,)
|
return (s,)
|
||||||
|
|
||||||
NODE_CLASS_MAPPINGS = {
|
NODE_CLASS_MAPPINGS = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user