Commit Graph

25 Commits

Author SHA1 Message Date
Dan Black 19c57f65b9
Fix M series Mac bug
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
https://github.com/comfyanonymous/ComfyUI/issues/5075#issuecomment-2451867268
2025-02-11 13:10:00 -05:00
Sergii Dymchenko da3d4d006f
Use weights_only for loading (#3427)
Co-authored-by: Manuel Schmid <9307310+mashb1t@users.noreply.github.com>
2024-08-03 12:33:01 +02:00
licyk 34f67c01a8
feat: add restart sampler (#3219) 2024-07-01 14:24:21 +02:00
Manuel Schmid 04d764820e
fix: correctly set alphas_cumprod (#3106) 2024-06-06 13:42:26 +02:00
Manuel Schmid b58bc7774e
fix: correct sampling when gamma is 0 (#3093) 2024-06-04 21:03:37 +02:00
Manuel Schmid 2d55a5f257
feat: add support for playground v2.5 (#3073)
* feat: add support for playground v2.5

* feat: add preset for playground v2.5

* feat: change URL to mashb1t

* feat: optimize playground v2.5 preset
2024-06-04 20:15:49 +02:00
Manuel Schmid 7899261755
fix: turbo scheduler loading issue (#3065)
* fix: correctly load ModelPatcher

* feat: do not load model at all, not needed
2024-05-31 22:24:19 +02:00
Manuel Schmid 2e2e8f851a
feat: add tcd sampler and discrete distilled tcd scheduler based on sgm_uniform (same as lcm) (#2907) 2024-05-19 13:08:33 +02:00
Manuel Schmid 3a55e7e391
feat: add AlignYourStepsScheduler (#2905) 2024-05-18 15:53:34 +02:00
Manuel Schmid c32bc5e199
feat: add optional model VAE select (#2867)
* Revert "fix: use LF as line breaks for Docker entrypoint.sh (#2843)" (#2865)

False alarm, worked as intended before. Sorry for the fuzz.
This reverts commit d16a54edd6.

* feat: add VAE select

* feat: use different default label, add translation

* fix: do not reload model when VAE stays the same

* refactor: code cleanup

* feat: add metadata handling
2024-05-09 18:59:35 +02:00
delta_lt_0 5ada070d88
feat: support download of huggingface files from a mirror website (#2637)
* fix: load image number from preset (#2611)

* fix: add default_image_number to preset handling

* fix: use minimum image number of preset and config to prevent UI overflow

* fix: use correct base dimensions for outpaint mask padding (#2612)

* fix: add Civitai compatibility for LoRAs in a1111 metadata scheme by switching schema (#2615)

* feat: update sha256 generation functions

29be1da7cf/modules/hashes.py

* feat: add compatibility for LoRAs in a1111 metadata scheme

* feat: add backwards compatibility

* refactor: extract remove_special_loras

* fix: correctly apply LoRA weight for legacy schema

* docs: bump version number to 2.3.1, add changelog (#2616)

* feat:support download huggingface files from a  mirror site

---------

Co-authored-by: Manuel Schmid <9307310+mashb1t@users.noreply.github.com>
2024-04-06 15:25:19 +02:00
Manuel Schmid d3113f5c3f
feat: use consistent file name in gradio (#1932)
* feat: use consistent file name in gradio

returns and uses filepaths instead of numpy image by saving to temp dir
uses double the temp dir file storage on disk as it saves to temp dir and gradio temp dir when displaying the image, but reuses logged output image

* feat: delete temp images after yielding to gradio

* feat: use args temp path if given

* chore: code cleanup, remove redundant if statement
2024-02-25 22:56:38 +01:00
Maxim Saplin 4d34f31a72
feat: allow users to specify the number of threads when running on CPU (#1601)
* CPU_NUM_THREADS

* refactor: optimize code, type is already strict

---------

Co-authored-by: Manuel Schmid <manuel.schmid@odt.net>
2024-02-25 17:14:17 +01:00
Manuel Schmid 2037de3fcb
chore: fix typos and adjust wording (#1521, #1644, #1691, #1772) 2024-02-10 21:54:50 +01:00
Praveen Kumar Sridhar b9d7e77b0d
replaced the custom lcm function with math.lcm (#1122)
Co-authored-by: Manuel Schmid <manuel.schmid@odt.net>
2024-02-10 19:28:10 +01:00
Justin Dhillon 71eb040afc
Fix broken links (#2217)
* https://github.com/rlaphoenix/VSGAN/blob/master/vsgan/archs/esrgan.py

* https://github.com/huggingface/pytorch-image-models/blob/main/timm/layers/drop.py

* https://kornia.readthedocs.io/en/latest/
2024-02-10 17:36:56 +01:00
lllyasviel 1cc40d24d7 backend 2024-01-27 05:12:34 -08:00
lllyasviel 8e62a72a63
(requested) support AMD 8GB GPUs via Windows DirectML
this update is requested by users
2023-12-30 06:30:59 -08:00
lllyasviel 0e1aa8d084
better caster (#1480)
related to mps/rocm/cpu casting for fp16 and etc on clip
2023-12-17 17:09:15 -08:00
lllyasviel 3a727fd240
2.1.844
* maintain clip vision device
* update links in troubleshoot
2023-12-16 10:34:47 -08:00
lllyasviel 26ea508588
backend maintain (#1429) 2023-12-15 11:37:45 -08:00
lllyasviel 179bcb2c4e
Fix inpaint device problem in `--always-gpu` mode. (#1420)
2.1.841
2023-12-14 19:15:16 -08:00
lllyasviel 5b99e3a1e4
2.1.839 2023-12-13 21:14:50 -08:00
lllyasviel d4a062f8e1 SegmindVega 2023-12-12 16:22:54 -08:00
lllyasviel e8d88d3e25 2.1.826 2023-12-12 11:38:05 -08:00