mirror of
https://github.com/Comfy-Org/ComfyUI.git
synced 2026-08-26 19:02:36 +08:00
Defer @pollockjj's tiled-VAE and UPSCALE_MODEL MultiGPU lanes (#14066)
* Revert "Add tiled VAE lane to MultiGPU Work Units" This reverts commit4d3d68e473. The tiled VAE lane will land as part of a follow-up PR alongside the UPSCALE_MODEL lane, separated from the threaded-loader fix PR (#14052) to keep the upstream merge focused. * Revert "Add UPSCALE_MODEL lane to MultiGPU CFG Split" This reverts commit74b0a826ea. The UPSCALE_MODEL lane will land as part of a follow-up PR alongside the tiled VAE lane, separated from the threaded-loader fix PR (#14052) to keep the upstream merge focused. --------- Co-authored-by: John Pollock <pollockjj@gmail.com>
This commit is contained in:
@@ -81,33 +81,13 @@ class ImageUpscaleWithModel(io.ComfyNode):
|
||||
|
||||
output_device = comfy.model_management.intermediate_device()
|
||||
|
||||
multigpu_clones = getattr(upscale_model, 'multigpu_clones', None)
|
||||
if multigpu_clones:
|
||||
for dev, desc in multigpu_clones.items():
|
||||
model_management.free_memory(memory_required, dev)
|
||||
desc.to(dev)
|
||||
|
||||
oom = True
|
||||
try:
|
||||
while oom:
|
||||
try:
|
||||
steps = in_img.shape[0] * comfy.utils.get_tiled_scale_steps(in_img.shape[3], in_img.shape[2], tile_x=tile, tile_y=tile, overlap=overlap)
|
||||
pbar = comfy.utils.ProgressBar(steps)
|
||||
if multigpu_clones:
|
||||
functions = {device: lambda a: upscale_model(a.float())}
|
||||
for dev, desc in multigpu_clones.items():
|
||||
functions[dev] = lambda a, d=desc: d(a.float())
|
||||
s = comfy.utils.tiled_scale_multidim_multigpu(
|
||||
in_img,
|
||||
functions,
|
||||
tile=(tile, tile),
|
||||
overlap=overlap,
|
||||
upscale_amount=upscale_model.scale,
|
||||
pbar=pbar,
|
||||
output_device=output_device,
|
||||
)
|
||||
else:
|
||||
s = comfy.utils.tiled_scale(in_img, lambda a: upscale_model(a.float()), tile_x=tile, tile_y=tile, overlap=overlap, upscale_amount=upscale_model.scale, pbar=pbar, output_device=output_device)
|
||||
s = comfy.utils.tiled_scale(in_img, lambda a: upscale_model(a.float()), tile_x=tile, tile_y=tile, overlap=overlap, upscale_amount=upscale_model.scale, pbar=pbar, output_device=output_device)
|
||||
oom = False
|
||||
except Exception as e:
|
||||
model_management.raise_non_oom(e)
|
||||
@@ -116,9 +96,6 @@ class ImageUpscaleWithModel(io.ComfyNode):
|
||||
raise e
|
||||
finally:
|
||||
upscale_model.to("cpu")
|
||||
if multigpu_clones:
|
||||
for desc in multigpu_clones.values():
|
||||
desc.to("cpu")
|
||||
|
||||
s = torch.clamp(s.movedim(-3,-1), min=0, max=1.0).to(comfy.model_management.intermediate_dtype())
|
||||
return io.NodeOutput(s)
|
||||
|
||||
Reference in New Issue
Block a user