melMass / comfy_mtb

Animation oriented nodes pack for ComfyUI
MIT License
414 stars 45 forks source link

[bug] faceenhance RuntimeError: start (12) + length (1) exceeds dimension size (12). #195

Open drmbt opened 2 weeks ago

drmbt commented 2 weeks ago

Describe the bug

ace restore breaks on default workflow. Using stability matrix

Reproduction

I finally got the first part of the face-swap workflow working after installing your wheels, and following this advice: https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/13985#issuecomment-1814243471

just trying to run faceswap example workflow

Expected behavior

it runs faceenhance.py successfully

Operating System

Windows (Default)

Comfy Mode

Other (online services, containers etc..)

Console output

occurred when executing Restore Face (mtb):

start (12) + length (1) exceeds dimension size (12).

File "D:\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI-clean\execution.py", line 317, in execute
output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
File "D:\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI-clean\execution.py", line 192, in get_output_data
return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
File "D:\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI-clean\execution.py", line 169, in _map_node_over_list
process_inputs(input_dict, i)
File "D:\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI-clean\execution.py", line 158, in process_inputs
results.append(getattr(obj, func)(**inputs))
File "D:\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI-clean\custom_nodes\comfy_mtb\nodes\faceenhance.py", line 247, in restore
out = [
File "D:\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI-clean\custom_nodes\comfy_mtb\nodes\faceenhance.py", line 248, in
self.do_restore(
File "D:\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI-clean\custom_nodes\comfy_mtb\nodes\faceenhance.py", line 208, in do_restore
cropped_faces, restored_faces, restored_img = model.enhance(
File "D:\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI-clean\venv\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "D:\AI/StabilityMatrix-win-x64/Data/Packages/ComfyUI-clean/custom_nodes/comfy_mtb/extern/GFPGAN\gfpgan\utils.py", line 139, in enhance
bg_img = self.bg_upsampler.enhance(img, outscale=self.upscale)[0]
File "D:\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI-clean\custom_nodes\comfy_mtb\nodes\faceenhance.py", line 139, in enhance
s = comfy.utils.tiled_scale(
File "D:\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI-clean\comfy\utils.py", line 761, in tiled_scale
return tiled_scale_multidim(samples, function, (tile_y, tile_x), overlap, upscale_amount, out_channels, output_device, pbar)
File "D:\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI-clean\venv\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "D:\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI-clean\comfy\utils.py", line 740, in tiled_scale_multidim
m = mask.narrow(d, t, 1)

Additional context

No response

melMass commented 1 week ago

I'm going to look into it, can you share your workflow?