Open
Conversation
Fooocus inpainting on Mac M series inconsistently produces a bug in sizing/reshaping, this fix was found in ComfyUI repo comments but contains the same core to fix.
Here's the error
```
Upscaling image with shape (712, 781, 3) ...
Traceback (most recent call last):
File "/Users/danielblack/Code/Fooocus/modules/async_worker.py", line 1471, in worker
handler(task)
File "/Users/danielblack/miniconda3/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/danielblack/miniconda3/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/danielblack/Code/Fooocus/modules/async_worker.py", line 1193, in handler
denoising_strength, initial_latent, width, height, current_progress = apply_inpaint(async_task,
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/danielblack/Code/Fooocus/modules/async_worker.py", line 486, in apply_inpaint
inpaint_worker.current_task = inpaint_worker.InpaintWorker(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/danielblack/Code/Fooocus/modules/inpaint_worker.py", line 162, in __init__
self.interested_image = perform_upscale(self.interested_image)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/danielblack/Code/Fooocus/modules/upscaler.py", line 30, in perform_upscale
img = opImageUpscaleWithModel.upscale(model, img)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/danielblack/Code/Fooocus/ldm_patched/contrib/external_upscale_model.py", line 54, in upscale
s = ldm_patched.modules.utils.tiled_scale(in_img, lambda a: upscale_model(a), tile_x=tile, tile_y=tile, overlap=overlap, upscale_amount=upscale_model.scale, pbar=pbar)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/danielblack/miniconda3/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/danielblack/Code/Fooocus/ldm_patched/modules/utils.py", line 418, in tiled_scale
ps = function(s_in).to(output_device)
^^^^^^^^^^^^^^
File "/Users/danielblack/Code/Fooocus/ldm_patched/contrib/external_upscale_model.py", line 54, in <lambda>
s = ldm_patched.modules.utils.tiled_scale(in_img, lambda a: upscale_model(a), tile_x=tile, tile_y=tile, overlap=overlap, upscale_amount=upscale_model.scale, pbar=pbar)
^^^^^^^^^^^^^^^^
File "/Users/danielblack/miniconda3/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1740, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/danielblack/miniconda3/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1751, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/danielblack/Code/Fooocus/ldm_patched/pfn/architecture/RRDB.py", line 296, in forward
return x[:, :, : h * self.scale, : w * self.scale]
^^^^^^^^^^^^^
File "/Users/danielblack/miniconda3/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1740, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/danielblack/miniconda3/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1751, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/danielblack/miniconda3/lib/python3.12/site-packages/torch/nn/modules/container.py", line 250, in forward
input = module(input)
^^^^^^^^^^^^^
File "/Users/danielblack/miniconda3/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1740, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/danielblack/miniconda3/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1751, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/danielblack/miniconda3/lib/python3.12/site-packages/torch/nn/modules/conv.py", line 554, in forward
return self._conv_forward(input, self.weight, self.bias)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/danielblack/miniconda3/lib/python3.12/site-packages/torch/nn/modules/conv.py", line 549, in _conv_forward
return F.conv2d(
^^^^^^^^^
RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.
```
Explanation here
Comfy-Org/ComfyUI#5075 (comment)
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fooocus inpainting on Mac M series inconsistently produces a bug in sizing/reshaping, this fix was found in ComfyUI repo comments but contains the same core to fix.
Explanation here
Comfy-Org/ComfyUI#5075 (comment)
Here's the error