Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: ModuleNotFoundError: No module named 'torchvision.transforms.functional_tensor' torchvision 0.17 promblem #13985

Closed
1 task done
KEDI103 opened this issue Nov 16, 2023 · 12 comments
Labels
bug-report Report of a bug, yet to be confirmed

Comments

@KEDI103
Copy link

KEDI103 commented Nov 16, 2023

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What happened?

ModuleNotFoundError: No module named 'torchvision.transforms.functional_tensor'
crash
pytorch/pytorch#103973 (comment)

Steps to reproduce the problem

  1. Install
    gfx906 ROCM print black images all ai torch: 2.0.1+rocm5.4.2/rocm5.5 only works with torch=1.13.0+rocm5.2 pytorch/pytorch#103973 (comment)
  2. Run webui

What should have happened?

Run normaly

Sysinfo

AMD Radeon VII
AMD® Fx(tm)-9590 eight-core processor × 8 (not supporting pci atomics)
32 gb ram
Ubuntu 22.04.3 LTS x64

What browsers do you use to access the UI ?

Mozilla Firefox

Console logs

(venv) b_cansin@b-cansin-ubuntu:/media/b_cansin/ai/ai/stable-diffusion-webui$ ./webui.sh

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################

################################################################
Running on b_cansin user
################################################################

################################################################
Repo already cloned, using it as install directory
################################################################

################################################################
python venv already activate or run without venv: /media/b_cansin/ai/ai/stable-diffusion-webui/venv
################################################################

################################################################
Launching launch.py...
################################################################
Using TCMalloc: libtcmalloc_minimal.so.4
fatal: No names found, cannot describe anything.
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
Version: 1.6.1
Commit hash: 7ba3923d5b494b7756d0b12f33acb3716d830b9a
Launching Web UI with arguments: 
2023-11-16 00:38:11.762329: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
*** Error setting up CodeFormer
    Traceback (most recent call last):
      File "/media/b_cansin/ai/ai/stable-diffusion-webui/modules/codeformer_model.py", line 30, in setup_model
        from modules.codeformer.codeformer_arch import CodeFormer
      File "/media/b_cansin/ai/ai/stable-diffusion-webui/modules/codeformer/codeformer_arch.py", line 9, in <module>
        from modules.codeformer.vqgan_arch import VQAutoEncoder, ResBlock
      File "/media/b_cansin/ai/ai/stable-diffusion-webui/modules/codeformer/vqgan_arch.py", line 11, in <module>
        from basicsr.utils import get_root_logger
      File "/media/b_cansin/ai/ai/stable-diffusion-webui/venv/lib/python3.10/site-packages/basicsr/__init__.py", line 4, in <module>
        from .data import *
      File "/media/b_cansin/ai/ai/stable-diffusion-webui/venv/lib/python3.10/site-packages/basicsr/data/__init__.py", line 22, in <module>
        _dataset_modules = [importlib.import_module(f'basicsr.data.{file_name}') for file_name in dataset_filenames]
      File "/media/b_cansin/ai/ai/stable-diffusion-webui/venv/lib/python3.10/site-packages/basicsr/data/__init__.py", line 22, in <listcomp>
        _dataset_modules = [importlib.import_module(f'basicsr.data.{file_name}') for file_name in dataset_filenames]
      File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "/media/b_cansin/ai/ai/stable-diffusion-webui/venv/lib/python3.10/site-packages/basicsr/data/realesrgan_dataset.py", line 11, in <module>
        from basicsr.data.degradations import circular_lowpass_kernel, random_mixed_kernels
      File "/media/b_cansin/ai/ai/stable-diffusion-webui/venv/lib/python3.10/site-packages/basicsr/data/degradations.py", line 8, in <module>
        from torchvision.transforms.functional_tensor import rgb_to_grayscale
    ModuleNotFoundError: No module named 'torchvision.transforms.functional_tensor'

---
Traceback (most recent call last):
  File "/media/b_cansin/ai/ai/stable-diffusion-webui/launch.py", line 48, in <module>
    main()
  File "/media/b_cansin/ai/ai/stable-diffusion-webui/launch.py", line 44, in main
    start()
  File "/media/b_cansin/ai/ai/stable-diffusion-webui/modules/launch_utils.py", line 436, in start
    webui.webui()
  File "/media/b_cansin/ai/ai/stable-diffusion-webui/webui.py", line 52, in webui
    initialize.initialize()
  File "/media/b_cansin/ai/ai/stable-diffusion-webui/modules/initialize.py", line 71, in initialize
    from modules import gfpgan_model
  File "/media/b_cansin/ai/ai/stable-diffusion-webui/modules/gfpgan_model.py", line 4, in <module>
    import gfpgan
  File "/media/b_cansin/ai/ai/stable-diffusion-webui/venv/lib/python3.10/site-packages/gfpgan/__init__.py", line 3, in <module>
    from .data import *
  File "/media/b_cansin/ai/ai/stable-diffusion-webui/venv/lib/python3.10/site-packages/gfpgan/data/__init__.py", line 10, in <module>
    _dataset_modules = [importlib.import_module(f'gfpgan.data.{file_name}') for file_name in dataset_filenames]
  File "/media/b_cansin/ai/ai/stable-diffusion-webui/venv/lib/python3.10/site-packages/gfpgan/data/__init__.py", line 10, in <listcomp>
    _dataset_modules = [importlib.import_module(f'gfpgan.data.{file_name}') for file_name in dataset_filenames]
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/media/b_cansin/ai/ai/stable-diffusion-webui/venv/lib/python3.10/site-packages/gfpgan/data/ffhq_degradation_dataset.py", line 7, in <module>
    from basicsr.data import degradations as degradations
  File "/media/b_cansin/ai/ai/stable-diffusion-webui/venv/lib/python3.10/site-packages/basicsr/__init__.py", line 4, in <module>
    from .data import *
  File "/media/b_cansin/ai/ai/stable-diffusion-webui/venv/lib/python3.10/site-packages/basicsr/data/__init__.py", line 22, in <module>
    _dataset_modules = [importlib.import_module(f'basicsr.data.{file_name}') for file_name in dataset_filenames]
  File "/media/b_cansin/ai/ai/stable-diffusion-webui/venv/lib/python3.10/site-packages/basicsr/data/__init__.py", line 22, in <listcomp>
    _dataset_modules = [importlib.import_module(f'basicsr.data.{file_name}') for file_name in dataset_filenames]
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/media/b_cansin/ai/ai/stable-diffusion-webui/venv/lib/python3.10/site-packages/basicsr/data/realesrgan_dataset.py", line 11, in <module>
    from basicsr.data.degradations import circular_lowpass_kernel, random_mixed_kernels
  File "/media/b_cansin/ai/ai/stable-diffusion-webui/venv/lib/python3.10/site-packages/basicsr/data/degradations.py", line 8, in <module>
    from torchvision.transforms.functional_tensor import rgb_to_grayscale
ModuleNotFoundError: No module named 'torchvision.transforms.functional_tensor'
(venv) b_cansin@b-cansin-ubuntu:/media/b_cansin/ai/ai/stable-diffusion-webui$

Additional information

As @hongxiayang said in here:
pytorch/pytorch#103973 (comment)
Need support torchvision 0.17 because of torchvision.transforms.functional deprecated and removed in 0.17. Could we get dev version that support 0.17?
After than we will test if this wheel fix non pci atomics problem of ROCM

@KEDI103 KEDI103 added the bug-report Report of a bug, yet to be confirmed label Nov 16, 2023
@kmsedu
Copy link

kmsedu commented Nov 16, 2023

This looks like it should probably be opened at basicsr's repo,as I believe A1111 just pulls from that repo, it hasn't been updated in a while though.

In the short term - try:

Open ./stable-diffusion-webui/venv/lib/python3.10/site-packages/basicsr/data/degradations.py and on line 8, simply change:

from torchvision.transforms.functional_tensor import rgb_to_grayscale

to:

from torchvision.transforms.functional import rgb_to_grayscale

Which should at least get you past this step.

@TornjV
Copy link

TornjV commented Nov 16, 2023

Opened a PR on basicsr repo XPixelGroup/BasicSR#650

@KEDI103
Copy link
Author

KEDI103 commented Nov 16, 2023

This looks like it should probably be opened at basicsr's repo,as I believe A1111 just pulls from that repo, it hasn't been updated in a while though.

In the short term - try:

Open ./stable-diffusion-webui/venv/lib/python3.10/site-packages/basicsr/data/degradations.py and on line 8, simply change:

from torchvision.transforms.functional_tensor import rgb_to_grayscale

to:

from torchvision.transforms.functional import rgb_to_grayscale

Which should at least get you past this step.

Yes that fix my problem now I can finally gen with pytorch 2 without black image or pci atomics problem

Screenshot from 2023-11-16 13-58-13

@viking1304
Copy link
Contributor

This looks like it should probably be opened at basicsr's repo,as I believe A1111 just pulls from that repo, it hasn't been updated in a while though.

In the short term - try:

Open ./stable-diffusion-webui/venv/lib/python3.10/site-packages/basicsr/data/degradations.py and on line 8, simply change:

from torchvision.transforms.functional_tensor import rgb_to_grayscale

to:

from torchvision.transforms.functional import rgb_to_grayscale

Which should at least get you past this step.

Lazy people (like me) can use sed (on Mac and Linux):

mac

sed -i '' 's/from torchvision.transforms.functional_tensor import rgb_to_grayscale/from torchvision.transforms.functional import rgb_to_grayscale/' venv/lib/python3.10/site-packages/basicsr/data/degradations.py

linux

sed -i 's/from torchvision.transforms.functional_tensor import rgb_to_grayscale/from torchvision.transforms.functional import rgb_to_grayscale/' venv/lib/python3.10/site-packages/basicsr/data/degradations.py

Mac requires an additional parameter for the backup file, but the rest is the same for both.

@akx
Copy link
Collaborator

akx commented Dec 7, 2023

This is fixed in dev via #14186.

@akx akx closed this as completed Dec 7, 2023
martianunlimited added a commit to martianunlimited/stable-diffusion-webui-ux that referenced this issue Jan 25, 2024
* added option to play notification sound or not

* Convert (emphasis) to (emphasis:1.1)

per @SirVeggie's suggestion

* Make attention conversion optional

Fix square brackets multiplier

* put notification.mp3 option at the end of the page

* more general case of adding an infotext when no images have been generated

* use shallow copy for AUTOMATIC1111#13535

* remove duplicated code

* support webui.settings.bat

* Start / Restart generation by Ctrl (Alt) + Enter

Add ability to interrupt current generation and start generation again by Ctrl (Alt) + Enter

* add an option to not print stack traces on ctrl+c.

* repair unload sd checkpoint button

* respect keyedit_precision_attention setting when converting from old (((attention))) syntax

* Update script.js

Exclude lambda

* Update script.js

LF instead CRLF

* Update script.js

* Add files via upload

LF

* wip incorrect OFT implementation

* inference working but SLOW

* faster by using cached R in forward

* faster by calculating R in updown and using cached R in forward

* refactor: fix constraint, re-use get_weight

* style: formatting

* style: fix ambiguous variable name

* rework some of changes for emphasis editing keys, force conversion of old-style emphasis

* fix the situation with emphasis editing (aaaa:1.1) bbbb (cccc:1.1)

* fix bug when using --gfpgan-models-path

* fix Blank line contains whitespace

* refactor: use forward hook instead of custom forward

* fix: return orig weights during updown, merge weights before forward

* fix: support multiplier, no forward pass hook

* style: cleanup oft

* fix: use merge_weight to cache value

* refactor: remove used OFT functions

* fix: multiplier applied twice in finalize_updown

* style: conform style

* Update prompts_from_file script to allow concatenating entries with the general prompt.

* linting issue

* call state.jobnext() before postproces*()

* Fix AUTOMATIC1111#13796

Fix comment error that makes understanding scheduling more confusing.

* test implementation based on kohaku diag-oft implementation

* detect diag_oft type

* no idea what i'm doing, trying to support both type of OFT, kblueleaf diag_oft has MultiheadAttn which kohya's doesn't?, attempt create new module based off network_lora.py, errors about tensor dim mismatch

* added accordion settings options

* Fix parenthesis auto selection

Fixes AUTOMATIC1111#13813

* Update requirements_versions.txt

* skip multihead attn for now

* refactor: move factorization to lyco_helpers, separate calc_updown for kohya and kb

* refactor: use same updown for both kohya OFT and LyCORIS diag-oft

* refactor: remove unused function

* correct a typo

modify "defaul" to "default"

* add a visible checkbox to input accordion

* eslint

* properly apply sort order for extra network cards when selected from dropdown
allow selection of default sort order in settings
remove 'Default' sort order, replace with 'Name'

* Add SSD-1B as a supported model

* Added memory clearance after deletion

* Use devices.torch_gc() instead of empty_cache()

* added compact prompt option

* compact prompt option disabled by default

* linter

* more changes for AUTOMATIC1111#13865: fix formatting, rename the function, add comment and add a readme entry

* fix img2img_tabs error

* fix exception related to the pix2pix

* Add option to set notification sound volume

* fix pix2pix producing bad results

* moved nested with to single line to remove extra tabs

* removed changes that weren't merged properly

* multiline with statement for readibility

* Update README.md

Modify the stablediffusion dependency address

* Update README.md

Modify the stablediffusion dependency address

* - opensuse compatibility

* Enable prompt hotkeys in style editor

* Compatibility with Debian 11, Fedora 34+ and openSUSE 15.4+

* fix added accordion settings options

* ExitStack as alternative to suppress

* implementing script metadata and DAG sorting mechanism

* populate loaded_extensions from extension list instead

* reverse the extension load order so builtin extensions load earlier natively

* add hyperTile

https://github.com/tfernd/HyperTile

* remove the assumption of same name

* allow comma and whitespace as separator

* fix

* bug fix

* dir buttons start with / so only the correct dir will be shown and not dirs with a substrings as name from the dir

* Lint

* Fixes generation restart not working for some users when 'Ctrl+Enter' is pressed

* Adds 'Path' sorting for Extra network cards

* fix gradio video component and canvas fit for inpaint

* hotfix: call shared.state.end() after postprocessing done

* Implement Hypertile

Co-Authored-By: Kieran Hunt <kph@hotmail.ca>

* copy LDM VAE key from XL

* fix: ignore calc_scale() for COFT which has very small alpha

* feat: LyCORIS/kohya OFT network support

* convert/add hypertile options

* fix ruff - add newline

* Adds tqdm handler to logging_config.py for progress bar integration

* Take into account tqdm not being installed before first boot for logging

* actually adds handler to logging_config.py

* Fix critical issue - unet apply

* Fix inverted option issue

I'm pretty sure I was sleepy while implementing this

* set empty value for SD XL 3rd layer

* fix double gc and decoding with unet context

* feat: fix randn found element of type float at pos 2

Signed-off-by: storyicon <storyicon@foxmail.com>

* use metadata.ini for meta filename

* Option to show batch img2img results in UI

shared.opts.img2img_batch_show_results_limit
limit the number of images return to the UI for batch img2img
default limit 32
0 no images are shown
-1 unlimited, all images are shown

* save sysinfo as .json

GitHub now allows uploading of .json files in issues

* rework extensions metadata: use custom sorter that doesn't mess the order as much and ignores cyclic errors, use classes with named fields instead of dictionaries, eliminate some duplicated code

* added option for default behavior of dir buttons

* Add FP32 fallback support on sd_vae_approx

This tries to execute interpolate with FP32 if it failed.

Background is that
on some environment such as Mx chip MacOS devices, we get error as follows:

```
"torch/nn/functional.py", line 3931, in interpolate
        return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
```

In this case, ```--no-half``` doesn't help to solve. Therefore this commits add the FP32 fallback execution to solve it.

Note that the submodule may require additional modifications. The following is the example modification on the other submodule.

```repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py

class Upsample(nn.Module):
..snip..
    def forward(self, x):
        assert x.shape[1] == self.channels
        if self.dims == 3:
            x = F.interpolate(
                x, (x.shape[2], x.shape[3] * 2, x.shape[4] * 2), mode="nearest"
            )
        else:
            try:
                x = F.interpolate(x, scale_factor=2, mode="nearest")
            except:
                x = F.interpolate(x.to(th.float32), scale_factor=2, mode="nearest").to(x.dtype)
        if self.use_conv:
            x = self.conv(x)
        return x
..snip..
```

You can see the FP32 fallback execution as same as sd_vae_approx.py.

* fix  [Bug]: (Dev Branch) Placing "Dimensions" first in "ui_reorder_list" prevents start AUTOMATIC1111#14047

* Update ruff to 0.1.6

* Simplify restart_sampler (suggested by ruff)

* use extension name for determining an extension is installed in the index

* Move exception_records related methods to errors.py

* remove traceback in sysinfo

* move file

* rework hypertile into a built-in extension

* do not save HTML explanations from options page to config

* fix linter errors

* compact prompt layout: preserve scroll when switching between lora tabs

* json.dump(ensure_ascii=False)

improve json readability

* add categories to settings

* also consider extension url

* add Block component creation callback

* catch uncaught exception with ui creation scripts

prevent total webui crash

* Allow use of mutiple styles csv files

* bugfix for warning message (#6)

* bugfix for warning message (#6)

* bugfix for warning message

* bugfix error message

* Allow use of mutiple styles csv files
* AUTOMATIC1111#14122
Fix edge case where style text has multiple {prompt} placeholders
* AUTOMATIC1111#14005

* Support XYZ scripts / split hires path from unet

* cache divisors / fix ruff

* fix ruff in hypertile_xyz.py

* fix ruff - set comprehension

* hypertile_xyz: we don't need isnumeric check for AxisOption

* Update devices.py

fixes issue where "--use-cpu" all properly makes SD run on CPU but leaves ControlNet (and other extensions, I presume) pointed at GPU, causing a crash in ControlNet caused by a mismatch between devices between SD and CN

AUTOMATIC1111#14097

* fix Auto focal point crop for opencv >= 4.8.x

autocrop.download_and_cache_models
in opencv >= 4.8 the face detection model was updated
download the base on opencv version
returns the model path or raise exception

* reformat file with uniform indentation

* Revert "Add FP32 fallback support on sd_vae_approx"

This reverts commit 58c1954.
Since the modification is expected to move to mac_specific.py
(AUTOMATIC1111#14046 (comment))

* Add FP32 fallback support on torch.nn.functional.interpolate

This tries to execute interpolate with FP32 if it failed.

Background is that
on some environment such as Mx chip MacOS devices, we get error as follows:

```
"torch/nn/functional.py", line 3931, in interpolate
        return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
```

In this case, ```--no-half``` doesn't help to solve. Therefore this commits add the FP32 fallback execution to solve it.

Note that the ```upsample_nearest2d``` is called from ```torch.nn.functional.interpolate```.
And the fallback for torch.nn.functional.interpolate is necessary at
```modules/sd_vae_approx.py``` 's ```VAEApprox.forward```
```repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py``` 's ```Upsample.forward```

* Fix the Ruff error about unused import

* Initial IPEX support

* add max-heigh/width to global-popup-inner

prevent the pop-up from being too big as to making exiting the pop-up impossible

* Close popups with escape key

* Fix bug where is_using_v_parameterization_for_sd2 fails because the sd_hijack is only partially undone

* Add support for SD 2.1 Turbo, by converting the state dict from SGM to LDM on load

* infotext updates: add option to disregard certain infotext fields, add option to not include VAE in infotext, add explanation to infotext settings page, move some options to infotext settings page

* Disable ipex autocast due to its bad perf

* split UI settings page into many

* put code that can cause an exception into its own function for AUTOMATIC1111#14120

* Fix fp64

* extras tab batch: actually use original filename
preprocessing upscale: do not do an extra upscale step if it's not needed

* Remove webui-ipex-user.bat

* remove Train/Preprocessing tab and put all its functionality into extras batch images mode

* potential fix for AUTOMATIC1111#14172

* alternate implementation for unet forward replacement that does not depend on hijack being applied

* Fix `save_samples` being checked early when saving masked composite

* Re-add setting lost as part of e294e46

* rework mask and mask_composite logic

* Add import_hook hack to work around basicsr incompatibility

Fixes AUTOMATIC1111#13985

* Update launch_utils.py to fix wrong dep. checks and reinstalls

Fixes failing dependency checks for extensions having a different package name and import name (for example ffmpeg-python / ffmpeg), which currently is causing the unneeded reinstall of packages at runtime.

In fact with current code, the same string is used when installing a package and when checking for its presence, as you can see in the following example:

> launch_utils.run_pip("install ffmpeg-python", "required package")
[ Installing required package: "ffmpeg-python" ... ]
[ Installed ]

> launch_utils.is_installed("ffmpeg-python")
False

... which would actually return true with:

> launch_utils.is_installed("ffmpeg")
True

* Lint

* make webui not crash when running with --disable-all-extensions option

* update changelog

* repair old handler for postprocessing API

* repair old handler for postprocessing API in a way that doesn't break interface

* add hypertile infotext

* Merge pull request AUTOMATIC1111#14203 from AUTOMATIC1111/remove-clean_text()

remove clean_text()

* fix Inpaint Image Appears Behind Some UI Elements anapnoe#206

* fix side panel show/hide button hot zone does not use the entire width anapnoe#204

* Merge pull request AUTOMATIC1111#14300 from AUTOMATIC1111/oft_fixes

Fix wrong implementation in network_oft

* Merge pull request AUTOMATIC1111#14296 from akx/paste-resolution

Allow pasting in WIDTHxHEIGHT strings into the width/height fields

* Merge pull request AUTOMATIC1111#14270 from kaalibro/extra-options-elem-id

Assign id for "extra_options". Replace numeric field with slider.

* Merge pull request AUTOMATIC1111#14276 from AUTOMATIC1111/fix-styles

Fix styles

* Merge pull request AUTOMATIC1111#14266 from kaalibro/dev

Re-add setting lost as part of e294e46

* Merge pull request AUTOMATIC1111#14229 from Nuullll/ipex-embedding

[IPEX] Fix embedding and ControlNet

* Merge pull request AUTOMATIC1111#14230 from AUTOMATIC1111/add-option-Live-preview-in-full-page-image-viewer

add option: Live preview in full page image viewer

* Merge pull request AUTOMATIC1111#14216 from wfjsw/state-dict-ref-comparison

change state dict comparison to ref compare

* Merge pull request AUTOMATIC1111#14237 from ReneKroon/dev

AUTOMATIC1111#13354 : solve lora loading issue

* Merge pull request AUTOMATIC1111#14307 from AUTOMATIC1111/default-Falst-js_live_preview_in_modal_lightbox

default False js_live_preview_in_modal_lightbox

* update to 1.7 from upstream

* Update README.md

* Update screenshot.png

* Update CITATION.cff

* update to latest version

* update to latest version

---------

Signed-off-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Gleb Alekseev <alekseev.gleb@gmail.com>
Co-authored-by: missionfloyd <missionfloyd@users.noreply.github.com>
Co-authored-by: AUTOMATIC1111 <16777216c@gmail.com>
Co-authored-by: Won-Kyu Park <wkpark@gmail.com>
Co-authored-by: Khachatur Avanesian <jailbreakvideo@gmail.com>
Co-authored-by: v0xie <28695009+v0xie@users.noreply.github.com>
Co-authored-by: avantcontra <dadadaluo@gmail.com>
Co-authored-by: David Benson <dben@users.noreply.github.com>
Co-authored-by: Meerkov <GoMeerkov@gmail.com>
Co-authored-by: Emily Zeng <zhixuan.zeng@gmail.com>
Co-authored-by: w-e-w <40751091+w-e-w@users.noreply.github.com>
Co-authored-by: gibiee <37574274+gibiee@users.noreply.github.com>
Co-authored-by: Ritesh Gangnani <riteshgangnani10>
Co-authored-by: GerryDE <gerritfresen4@gmail.com>
Co-authored-by: fuchen.ljl <yjqqqqdx_01@163.com>
Co-authored-by: Alessandro de Oliveira Faria (A.K.A. CABELO) <cabelo@opensuse.org>
Co-authored-by: wfjsw <wfjsw@users.noreply.github.com>
Co-authored-by: aria1th <35677394+aria1th@users.noreply.github.com>
Co-authored-by: Tom Haelbich <65122811+h43lb1t0@users.noreply.github.com>
Co-authored-by: kaalibro <konstantin.adamovich@gmail.com>
Co-authored-by: anapnoe <124302297+anapnoe@users.noreply.github.com>
Co-authored-by: AngelBottomless <aria1th@naver.com>
Co-authored-by: Kieran Hunt <kph@hotmail.ca>
Co-authored-by: Lucas Daniel Velazquez M <19197331+Luxter77@users.noreply.github.com>
Co-authored-by: Your Name <you@example.com>
Co-authored-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Tom Haelbich <haelbito@outlook.com>
Co-authored-by: hidenorly <twitte.harold@gmail.com>
Co-authored-by: Aarni Koskela <akx@iki.fi>
Co-authored-by: Charlie Joynt <cjj1977@users.noreply.github.com>
Co-authored-by: obsol <33932119+read-0nly@users.noreply.github.com>
Co-authored-by: Nuullll <vfirst218@gmail.com>
Co-authored-by: MrCheeze <fishycheeze@yahoo.ca>
Co-authored-by: catboxanon <122327233+catboxanon@users.noreply.github.com>
Co-authored-by: illtellyoulater <3078931+illtellyoulater@users.noreply.github.com>
martianunlimited added a commit to martianunlimited/stable-diffusion-webui-ux that referenced this issue Jan 25, 2024
* added option to play notification sound or not

* Convert (emphasis) to (emphasis:1.1)

per @SirVeggie's suggestion

* Make attention conversion optional

Fix square brackets multiplier

* put notification.mp3 option at the end of the page

* more general case of adding an infotext when no images have been generated

* use shallow copy for AUTOMATIC1111#13535

* remove duplicated code

* support webui.settings.bat

* Start / Restart generation by Ctrl (Alt) + Enter

Add ability to interrupt current generation and start generation again by Ctrl (Alt) + Enter

* add an option to not print stack traces on ctrl+c.

* repair unload sd checkpoint button

* respect keyedit_precision_attention setting when converting from old (((attention))) syntax

* Update script.js

Exclude lambda

* Update script.js

LF instead CRLF

* Update script.js

* Add files via upload

LF

* wip incorrect OFT implementation

* inference working but SLOW

* faster by using cached R in forward

* faster by calculating R in updown and using cached R in forward

* refactor: fix constraint, re-use get_weight

* style: formatting

* style: fix ambiguous variable name

* rework some of changes for emphasis editing keys, force conversion of old-style emphasis

* fix the situation with emphasis editing (aaaa:1.1) bbbb (cccc:1.1)

* fix bug when using --gfpgan-models-path

* fix Blank line contains whitespace

* refactor: use forward hook instead of custom forward

* fix: return orig weights during updown, merge weights before forward

* fix: support multiplier, no forward pass hook

* style: cleanup oft

* fix: use merge_weight to cache value

* refactor: remove used OFT functions

* fix: multiplier applied twice in finalize_updown

* style: conform style

* Update prompts_from_file script to allow concatenating entries with the general prompt.

* linting issue

* call state.jobnext() before postproces*()

* Fix AUTOMATIC1111#13796

Fix comment error that makes understanding scheduling more confusing.

* test implementation based on kohaku diag-oft implementation

* detect diag_oft type

* no idea what i'm doing, trying to support both type of OFT, kblueleaf diag_oft has MultiheadAttn which kohya's doesn't?, attempt create new module based off network_lora.py, errors about tensor dim mismatch

* added accordion settings options

* Fix parenthesis auto selection

Fixes AUTOMATIC1111#13813

* Update requirements_versions.txt

* skip multihead attn for now

* refactor: move factorization to lyco_helpers, separate calc_updown for kohya and kb

* refactor: use same updown for both kohya OFT and LyCORIS diag-oft

* refactor: remove unused function

* correct a typo

modify "defaul" to "default"

* add a visible checkbox to input accordion

* eslint

* properly apply sort order for extra network cards when selected from dropdown
allow selection of default sort order in settings
remove 'Default' sort order, replace with 'Name'

* Add SSD-1B as a supported model

* Added memory clearance after deletion

* Use devices.torch_gc() instead of empty_cache()

* added compact prompt option

* compact prompt option disabled by default

* linter

* more changes for AUTOMATIC1111#13865: fix formatting, rename the function, add comment and add a readme entry

* fix img2img_tabs error

* fix exception related to the pix2pix

* Add option to set notification sound volume

* fix pix2pix producing bad results

* moved nested with to single line to remove extra tabs

* removed changes that weren't merged properly

* multiline with statement for readibility

* Update README.md

Modify the stablediffusion dependency address

* Update README.md

Modify the stablediffusion dependency address

* - opensuse compatibility

* Enable prompt hotkeys in style editor

* Compatibility with Debian 11, Fedora 34+ and openSUSE 15.4+

* fix added accordion settings options

* ExitStack as alternative to suppress

* implementing script metadata and DAG sorting mechanism

* populate loaded_extensions from extension list instead

* reverse the extension load order so builtin extensions load earlier natively

* add hyperTile

https://github.com/tfernd/HyperTile

* remove the assumption of same name

* allow comma and whitespace as separator

* fix

* bug fix

* dir buttons start with / so only the correct dir will be shown and not dirs with a substrings as name from the dir

* Lint

* Fixes generation restart not working for some users when 'Ctrl+Enter' is pressed

* Adds 'Path' sorting for Extra network cards

* fix gradio video component and canvas fit for inpaint

* hotfix: call shared.state.end() after postprocessing done

* Implement Hypertile

Co-Authored-By: Kieran Hunt <kph@hotmail.ca>

* copy LDM VAE key from XL

* fix: ignore calc_scale() for COFT which has very small alpha

* feat: LyCORIS/kohya OFT network support

* convert/add hypertile options

* fix ruff - add newline

* Adds tqdm handler to logging_config.py for progress bar integration

* Take into account tqdm not being installed before first boot for logging

* actually adds handler to logging_config.py

* Fix critical issue - unet apply

* Fix inverted option issue

I'm pretty sure I was sleepy while implementing this

* set empty value for SD XL 3rd layer

* fix double gc and decoding with unet context

* feat: fix randn found element of type float at pos 2

Signed-off-by: storyicon <storyicon@foxmail.com>

* use metadata.ini for meta filename

* Option to show batch img2img results in UI

shared.opts.img2img_batch_show_results_limit
limit the number of images return to the UI for batch img2img
default limit 32
0 no images are shown
-1 unlimited, all images are shown

* save sysinfo as .json

GitHub now allows uploading of .json files in issues

* rework extensions metadata: use custom sorter that doesn't mess the order as much and ignores cyclic errors, use classes with named fields instead of dictionaries, eliminate some duplicated code

* added option for default behavior of dir buttons

* Add FP32 fallback support on sd_vae_approx

This tries to execute interpolate with FP32 if it failed.

Background is that
on some environment such as Mx chip MacOS devices, we get error as follows:

```
"torch/nn/functional.py", line 3931, in interpolate
        return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
```

In this case, ```--no-half``` doesn't help to solve. Therefore this commits add the FP32 fallback execution to solve it.

Note that the submodule may require additional modifications. The following is the example modification on the other submodule.

```repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py

class Upsample(nn.Module):
..snip..
    def forward(self, x):
        assert x.shape[1] == self.channels
        if self.dims == 3:
            x = F.interpolate(
                x, (x.shape[2], x.shape[3] * 2, x.shape[4] * 2), mode="nearest"
            )
        else:
            try:
                x = F.interpolate(x, scale_factor=2, mode="nearest")
            except:
                x = F.interpolate(x.to(th.float32), scale_factor=2, mode="nearest").to(x.dtype)
        if self.use_conv:
            x = self.conv(x)
        return x
..snip..
```

You can see the FP32 fallback execution as same as sd_vae_approx.py.

* fix  [Bug]: (Dev Branch) Placing "Dimensions" first in "ui_reorder_list" prevents start AUTOMATIC1111#14047

* Update ruff to 0.1.6

* Simplify restart_sampler (suggested by ruff)

* use extension name for determining an extension is installed in the index

* Move exception_records related methods to errors.py

* remove traceback in sysinfo

* move file

* rework hypertile into a built-in extension

* do not save HTML explanations from options page to config

* fix linter errors

* compact prompt layout: preserve scroll when switching between lora tabs

* json.dump(ensure_ascii=False)

improve json readability

* add categories to settings

* also consider extension url

* add Block component creation callback

* catch uncaught exception with ui creation scripts

prevent total webui crash

* Allow use of mutiple styles csv files

* bugfix for warning message (#6)

* bugfix for warning message (#6)

* bugfix for warning message

* bugfix error message

* Allow use of mutiple styles csv files
* AUTOMATIC1111#14122
Fix edge case where style text has multiple {prompt} placeholders
* AUTOMATIC1111#14005

* Support XYZ scripts / split hires path from unet

* cache divisors / fix ruff

* fix ruff in hypertile_xyz.py

* fix ruff - set comprehension

* hypertile_xyz: we don't need isnumeric check for AxisOption

* Update devices.py

fixes issue where "--use-cpu" all properly makes SD run on CPU but leaves ControlNet (and other extensions, I presume) pointed at GPU, causing a crash in ControlNet caused by a mismatch between devices between SD and CN

AUTOMATIC1111#14097

* fix Auto focal point crop for opencv >= 4.8.x

autocrop.download_and_cache_models
in opencv >= 4.8 the face detection model was updated
download the base on opencv version
returns the model path or raise exception

* reformat file with uniform indentation

* Revert "Add FP32 fallback support on sd_vae_approx"

This reverts commit 58c1954.
Since the modification is expected to move to mac_specific.py
(AUTOMATIC1111#14046 (comment))

* Add FP32 fallback support on torch.nn.functional.interpolate

This tries to execute interpolate with FP32 if it failed.

Background is that
on some environment such as Mx chip MacOS devices, we get error as follows:

```
"torch/nn/functional.py", line 3931, in interpolate
        return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
```

In this case, ```--no-half``` doesn't help to solve. Therefore this commits add the FP32 fallback execution to solve it.

Note that the ```upsample_nearest2d``` is called from ```torch.nn.functional.interpolate```.
And the fallback for torch.nn.functional.interpolate is necessary at
```modules/sd_vae_approx.py``` 's ```VAEApprox.forward```
```repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py``` 's ```Upsample.forward```

* Fix the Ruff error about unused import

* Initial IPEX support

* add max-heigh/width to global-popup-inner

prevent the pop-up from being too big as to making exiting the pop-up impossible

* Close popups with escape key

* Fix bug where is_using_v_parameterization_for_sd2 fails because the sd_hijack is only partially undone

* Add support for SD 2.1 Turbo, by converting the state dict from SGM to LDM on load

* infotext updates: add option to disregard certain infotext fields, add option to not include VAE in infotext, add explanation to infotext settings page, move some options to infotext settings page

* Disable ipex autocast due to its bad perf

* split UI settings page into many

* put code that can cause an exception into its own function for AUTOMATIC1111#14120

* Fix fp64

* extras tab batch: actually use original filename
preprocessing upscale: do not do an extra upscale step if it's not needed

* Remove webui-ipex-user.bat

* remove Train/Preprocessing tab and put all its functionality into extras batch images mode

* potential fix for AUTOMATIC1111#14172

* alternate implementation for unet forward replacement that does not depend on hijack being applied

* Fix `save_samples` being checked early when saving masked composite

* Re-add setting lost as part of e294e46

* rework mask and mask_composite logic

* Add import_hook hack to work around basicsr incompatibility

Fixes AUTOMATIC1111#13985

* Update launch_utils.py to fix wrong dep. checks and reinstalls

Fixes failing dependency checks for extensions having a different package name and import name (for example ffmpeg-python / ffmpeg), which currently is causing the unneeded reinstall of packages at runtime.

In fact with current code, the same string is used when installing a package and when checking for its presence, as you can see in the following example:

> launch_utils.run_pip("install ffmpeg-python", "required package")
[ Installing required package: "ffmpeg-python" ... ]
[ Installed ]

> launch_utils.is_installed("ffmpeg-python")
False

... which would actually return true with:

> launch_utils.is_installed("ffmpeg")
True

* Lint

* make webui not crash when running with --disable-all-extensions option

* update changelog

* repair old handler for postprocessing API

* repair old handler for postprocessing API in a way that doesn't break interface

* add hypertile infotext

* Merge pull request AUTOMATIC1111#14203 from AUTOMATIC1111/remove-clean_text()

remove clean_text()

* fix Inpaint Image Appears Behind Some UI Elements anapnoe#206

* fix side panel show/hide button hot zone does not use the entire width anapnoe#204

* Merge pull request AUTOMATIC1111#14300 from AUTOMATIC1111/oft_fixes

Fix wrong implementation in network_oft

* Merge pull request AUTOMATIC1111#14296 from akx/paste-resolution

Allow pasting in WIDTHxHEIGHT strings into the width/height fields

* Merge pull request AUTOMATIC1111#14270 from kaalibro/extra-options-elem-id

Assign id for "extra_options". Replace numeric field with slider.

* Merge pull request AUTOMATIC1111#14276 from AUTOMATIC1111/fix-styles

Fix styles

* Merge pull request AUTOMATIC1111#14266 from kaalibro/dev

Re-add setting lost as part of e294e46

* Merge pull request AUTOMATIC1111#14229 from Nuullll/ipex-embedding

[IPEX] Fix embedding and ControlNet

* Merge pull request AUTOMATIC1111#14230 from AUTOMATIC1111/add-option-Live-preview-in-full-page-image-viewer

add option: Live preview in full page image viewer

* Merge pull request AUTOMATIC1111#14216 from wfjsw/state-dict-ref-comparison

change state dict comparison to ref compare

* Merge pull request AUTOMATIC1111#14237 from ReneKroon/dev

AUTOMATIC1111#13354 : solve lora loading issue

* Merge pull request AUTOMATIC1111#14307 from AUTOMATIC1111/default-Falst-js_live_preview_in_modal_lightbox

default False js_live_preview_in_modal_lightbox

* update to 1.7 from upstream

* Update README.md

* Update screenshot.png

* Update CITATION.cff

* update to latest version

* update to latest version

---------

Signed-off-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Gleb Alekseev <alekseev.gleb@gmail.com>
Co-authored-by: missionfloyd <missionfloyd@users.noreply.github.com>
Co-authored-by: AUTOMATIC1111 <16777216c@gmail.com>
Co-authored-by: Won-Kyu Park <wkpark@gmail.com>
Co-authored-by: Khachatur Avanesian <jailbreakvideo@gmail.com>
Co-authored-by: v0xie <28695009+v0xie@users.noreply.github.com>
Co-authored-by: avantcontra <dadadaluo@gmail.com>
Co-authored-by: David Benson <dben@users.noreply.github.com>
Co-authored-by: Meerkov <GoMeerkov@gmail.com>
Co-authored-by: Emily Zeng <zhixuan.zeng@gmail.com>
Co-authored-by: w-e-w <40751091+w-e-w@users.noreply.github.com>
Co-authored-by: gibiee <37574274+gibiee@users.noreply.github.com>
Co-authored-by: Ritesh Gangnani <riteshgangnani10>
Co-authored-by: GerryDE <gerritfresen4@gmail.com>
Co-authored-by: fuchen.ljl <yjqqqqdx_01@163.com>
Co-authored-by: Alessandro de Oliveira Faria (A.K.A. CABELO) <cabelo@opensuse.org>
Co-authored-by: wfjsw <wfjsw@users.noreply.github.com>
Co-authored-by: aria1th <35677394+aria1th@users.noreply.github.com>
Co-authored-by: Tom Haelbich <65122811+h43lb1t0@users.noreply.github.com>
Co-authored-by: kaalibro <konstantin.adamovich@gmail.com>
Co-authored-by: anapnoe <124302297+anapnoe@users.noreply.github.com>
Co-authored-by: AngelBottomless <aria1th@naver.com>
Co-authored-by: Kieran Hunt <kph@hotmail.ca>
Co-authored-by: Lucas Daniel Velazquez M <19197331+Luxter77@users.noreply.github.com>
Co-authored-by: Your Name <you@example.com>
Co-authored-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Tom Haelbich <haelbito@outlook.com>
Co-authored-by: hidenorly <twitte.harold@gmail.com>
Co-authored-by: Aarni Koskela <akx@iki.fi>
Co-authored-by: Charlie Joynt <cjj1977@users.noreply.github.com>
Co-authored-by: obsol <33932119+read-0nly@users.noreply.github.com>
Co-authored-by: Nuullll <vfirst218@gmail.com>
Co-authored-by: MrCheeze <fishycheeze@yahoo.ca>
Co-authored-by: catboxanon <122327233+catboxanon@users.noreply.github.com>
Co-authored-by: illtellyoulater <3078931+illtellyoulater@users.noreply.github.com>
martianunlimited added a commit to martianunlimited/stable-diffusion-webui-ux that referenced this issue Jan 25, 2024
* pull (#11)

* added option to play notification sound or not

* Convert (emphasis) to (emphasis:1.1)

per @SirVeggie's suggestion

* Make attention conversion optional

Fix square brackets multiplier

* put notification.mp3 option at the end of the page

* more general case of adding an infotext when no images have been generated

* use shallow copy for AUTOMATIC1111#13535

* remove duplicated code

* support webui.settings.bat

* Start / Restart generation by Ctrl (Alt) + Enter

Add ability to interrupt current generation and start generation again by Ctrl (Alt) + Enter

* add an option to not print stack traces on ctrl+c.

* repair unload sd checkpoint button

* respect keyedit_precision_attention setting when converting from old (((attention))) syntax

* Update script.js

Exclude lambda

* Update script.js

LF instead CRLF

* Update script.js

* Add files via upload

LF

* wip incorrect OFT implementation

* inference working but SLOW

* faster by using cached R in forward

* faster by calculating R in updown and using cached R in forward

* refactor: fix constraint, re-use get_weight

* style: formatting

* style: fix ambiguous variable name

* rework some of changes for emphasis editing keys, force conversion of old-style emphasis

* fix the situation with emphasis editing (aaaa:1.1) bbbb (cccc:1.1)

* fix bug when using --gfpgan-models-path

* fix Blank line contains whitespace

* refactor: use forward hook instead of custom forward

* fix: return orig weights during updown, merge weights before forward

* fix: support multiplier, no forward pass hook

* style: cleanup oft

* fix: use merge_weight to cache value

* refactor: remove used OFT functions

* fix: multiplier applied twice in finalize_updown

* style: conform style

* Update prompts_from_file script to allow concatenating entries with the general prompt.

* linting issue

* call state.jobnext() before postproces*()

* Fix AUTOMATIC1111#13796

Fix comment error that makes understanding scheduling more confusing.

* test implementation based on kohaku diag-oft implementation

* detect diag_oft type

* no idea what i'm doing, trying to support both type of OFT, kblueleaf diag_oft has MultiheadAttn which kohya's doesn't?, attempt create new module based off network_lora.py, errors about tensor dim mismatch

* added accordion settings options

* Fix parenthesis auto selection

Fixes AUTOMATIC1111#13813

* Update requirements_versions.txt

* skip multihead attn for now

* refactor: move factorization to lyco_helpers, separate calc_updown for kohya and kb

* refactor: use same updown for both kohya OFT and LyCORIS diag-oft

* refactor: remove unused function

* correct a typo

modify "defaul" to "default"

* add a visible checkbox to input accordion

* eslint

* properly apply sort order for extra network cards when selected from dropdown
allow selection of default sort order in settings
remove 'Default' sort order, replace with 'Name'

* Add SSD-1B as a supported model

* Added memory clearance after deletion

* Use devices.torch_gc() instead of empty_cache()

* added compact prompt option

* compact prompt option disabled by default

* linter

* more changes for AUTOMATIC1111#13865: fix formatting, rename the function, add comment and add a readme entry

* fix img2img_tabs error

* fix exception related to the pix2pix

* Add option to set notification sound volume

* fix pix2pix producing bad results

* moved nested with to single line to remove extra tabs

* removed changes that weren't merged properly

* multiline with statement for readibility

* Update README.md

Modify the stablediffusion dependency address

* Update README.md

Modify the stablediffusion dependency address

* - opensuse compatibility

* Enable prompt hotkeys in style editor

* Compatibility with Debian 11, Fedora 34+ and openSUSE 15.4+

* fix added accordion settings options

* ExitStack as alternative to suppress

* implementing script metadata and DAG sorting mechanism

* populate loaded_extensions from extension list instead

* reverse the extension load order so builtin extensions load earlier natively

* add hyperTile

https://github.com/tfernd/HyperTile

* remove the assumption of same name

* allow comma and whitespace as separator

* fix

* bug fix

* dir buttons start with / so only the correct dir will be shown and not dirs with a substrings as name from the dir

* Lint

* Fixes generation restart not working for some users when 'Ctrl+Enter' is pressed

* Adds 'Path' sorting for Extra network cards

* fix gradio video component and canvas fit for inpaint

* hotfix: call shared.state.end() after postprocessing done

* Implement Hypertile

Co-Authored-By: Kieran Hunt <kph@hotmail.ca>

* copy LDM VAE key from XL

* fix: ignore calc_scale() for COFT which has very small alpha

* feat: LyCORIS/kohya OFT network support

* convert/add hypertile options

* fix ruff - add newline

* Adds tqdm handler to logging_config.py for progress bar integration

* Take into account tqdm not being installed before first boot for logging

* actually adds handler to logging_config.py

* Fix critical issue - unet apply

* Fix inverted option issue

I'm pretty sure I was sleepy while implementing this

* set empty value for SD XL 3rd layer

* fix double gc and decoding with unet context

* feat: fix randn found element of type float at pos 2

Signed-off-by: storyicon <storyicon@foxmail.com>

* use metadata.ini for meta filename

* Option to show batch img2img results in UI

shared.opts.img2img_batch_show_results_limit
limit the number of images return to the UI for batch img2img
default limit 32
0 no images are shown
-1 unlimited, all images are shown

* save sysinfo as .json

GitHub now allows uploading of .json files in issues

* rework extensions metadata: use custom sorter that doesn't mess the order as much and ignores cyclic errors, use classes with named fields instead of dictionaries, eliminate some duplicated code

* added option for default behavior of dir buttons

* Add FP32 fallback support on sd_vae_approx

This tries to execute interpolate with FP32 if it failed.

Background is that
on some environment such as Mx chip MacOS devices, we get error as follows:

```
"torch/nn/functional.py", line 3931, in interpolate
        return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
```

In this case, ```--no-half``` doesn't help to solve. Therefore this commits add the FP32 fallback execution to solve it.

Note that the submodule may require additional modifications. The following is the example modification on the other submodule.

```repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py

class Upsample(nn.Module):
..snip..
    def forward(self, x):
        assert x.shape[1] == self.channels
        if self.dims == 3:
            x = F.interpolate(
                x, (x.shape[2], x.shape[3] * 2, x.shape[4] * 2), mode="nearest"
            )
        else:
            try:
                x = F.interpolate(x, scale_factor=2, mode="nearest")
            except:
                x = F.interpolate(x.to(th.float32), scale_factor=2, mode="nearest").to(x.dtype)
        if self.use_conv:
            x = self.conv(x)
        return x
..snip..
```

You can see the FP32 fallback execution as same as sd_vae_approx.py.

* fix  [Bug]: (Dev Branch) Placing "Dimensions" first in "ui_reorder_list" prevents start AUTOMATIC1111#14047

* Update ruff to 0.1.6

* Simplify restart_sampler (suggested by ruff)

* use extension name for determining an extension is installed in the index

* Move exception_records related methods to errors.py

* remove traceback in sysinfo

* move file

* rework hypertile into a built-in extension

* do not save HTML explanations from options page to config

* fix linter errors

* compact prompt layout: preserve scroll when switching between lora tabs

* json.dump(ensure_ascii=False)

improve json readability

* add categories to settings

* also consider extension url

* add Block component creation callback

* catch uncaught exception with ui creation scripts

prevent total webui crash

* Allow use of mutiple styles csv files

* bugfix for warning message (#6)

* bugfix for warning message (#6)

* bugfix for warning message

* bugfix error message

* Allow use of mutiple styles csv files
* AUTOMATIC1111#14122
Fix edge case where style text has multiple {prompt} placeholders
* AUTOMATIC1111#14005

* Support XYZ scripts / split hires path from unet

* cache divisors / fix ruff

* fix ruff in hypertile_xyz.py

* fix ruff - set comprehension

* hypertile_xyz: we don't need isnumeric check for AxisOption

* Update devices.py

fixes issue where "--use-cpu" all properly makes SD run on CPU but leaves ControlNet (and other extensions, I presume) pointed at GPU, causing a crash in ControlNet caused by a mismatch between devices between SD and CN

AUTOMATIC1111#14097

* fix Auto focal point crop for opencv >= 4.8.x

autocrop.download_and_cache_models
in opencv >= 4.8 the face detection model was updated
download the base on opencv version
returns the model path or raise exception

* reformat file with uniform indentation

* Revert "Add FP32 fallback support on sd_vae_approx"

This reverts commit 58c1954.
Since the modification is expected to move to mac_specific.py
(AUTOMATIC1111#14046 (comment))

* Add FP32 fallback support on torch.nn.functional.interpolate

This tries to execute interpolate with FP32 if it failed.

Background is that
on some environment such as Mx chip MacOS devices, we get error as follows:

```
"torch/nn/functional.py", line 3931, in interpolate
        return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
```

In this case, ```--no-half``` doesn't help to solve. Therefore this commits add the FP32 fallback execution to solve it.

Note that the ```upsample_nearest2d``` is called from ```torch.nn.functional.interpolate```.
And the fallback for torch.nn.functional.interpolate is necessary at
```modules/sd_vae_approx.py``` 's ```VAEApprox.forward```
```repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py``` 's ```Upsample.forward```

* Fix the Ruff error about unused import

* Initial IPEX support

* add max-heigh/width to global-popup-inner

prevent the pop-up from being too big as to making exiting the pop-up impossible

* Close popups with escape key

* Fix bug where is_using_v_parameterization_for_sd2 fails because the sd_hijack is only partially undone

* Add support for SD 2.1 Turbo, by converting the state dict from SGM to LDM on load

* infotext updates: add option to disregard certain infotext fields, add option to not include VAE in infotext, add explanation to infotext settings page, move some options to infotext settings page

* Disable ipex autocast due to its bad perf

* split UI settings page into many

* put code that can cause an exception into its own function for AUTOMATIC1111#14120

* Fix fp64

* extras tab batch: actually use original filename
preprocessing upscale: do not do an extra upscale step if it's not needed

* Remove webui-ipex-user.bat

* remove Train/Preprocessing tab and put all its functionality into extras batch images mode

* potential fix for AUTOMATIC1111#14172

* alternate implementation for unet forward replacement that does not depend on hijack being applied

* Fix `save_samples` being checked early when saving masked composite

* Re-add setting lost as part of e294e46

* rework mask and mask_composite logic

* Add import_hook hack to work around basicsr incompatibility

Fixes AUTOMATIC1111#13985

* Update launch_utils.py to fix wrong dep. checks and reinstalls

Fixes failing dependency checks for extensions having a different package name and import name (for example ffmpeg-python / ffmpeg), which currently is causing the unneeded reinstall of packages at runtime.

In fact with current code, the same string is used when installing a package and when checking for its presence, as you can see in the following example:

> launch_utils.run_pip("install ffmpeg-python", "required package")
[ Installing required package: "ffmpeg-python" ... ]
[ Installed ]

> launch_utils.is_installed("ffmpeg-python")
False

... which would actually return true with:

> launch_utils.is_installed("ffmpeg")
True

* Lint

* make webui not crash when running with --disable-all-extensions option

* update changelog

* repair old handler for postprocessing API

* repair old handler for postprocessing API in a way that doesn't break interface

* add hypertile infotext

* Merge pull request AUTOMATIC1111#14203 from AUTOMATIC1111/remove-clean_text()

remove clean_text()

* fix Inpaint Image Appears Behind Some UI Elements anapnoe#206

* fix side panel show/hide button hot zone does not use the entire width anapnoe#204

* Merge pull request AUTOMATIC1111#14300 from AUTOMATIC1111/oft_fixes

Fix wrong implementation in network_oft

* Merge pull request AUTOMATIC1111#14296 from akx/paste-resolution

Allow pasting in WIDTHxHEIGHT strings into the width/height fields

* Merge pull request AUTOMATIC1111#14270 from kaalibro/extra-options-elem-id

Assign id for "extra_options". Replace numeric field with slider.

* Merge pull request AUTOMATIC1111#14276 from AUTOMATIC1111/fix-styles

Fix styles

* Merge pull request AUTOMATIC1111#14266 from kaalibro/dev

Re-add setting lost as part of e294e46

* Merge pull request AUTOMATIC1111#14229 from Nuullll/ipex-embedding

[IPEX] Fix embedding and ControlNet

* Merge pull request AUTOMATIC1111#14230 from AUTOMATIC1111/add-option-Live-preview-in-full-page-image-viewer

add option: Live preview in full page image viewer

* Merge pull request AUTOMATIC1111#14216 from wfjsw/state-dict-ref-comparison

change state dict comparison to ref compare

* Merge pull request AUTOMATIC1111#14237 from ReneKroon/dev

AUTOMATIC1111#13354 : solve lora loading issue

* Merge pull request AUTOMATIC1111#14307 from AUTOMATIC1111/default-Falst-js_live_preview_in_modal_lightbox

default False js_live_preview_in_modal_lightbox

* update to 1.7 from upstream

* Update README.md

* Update screenshot.png

* Update CITATION.cff

* update to latest version

* update to latest version

---------

Signed-off-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Gleb Alekseev <alekseev.gleb@gmail.com>
Co-authored-by: missionfloyd <missionfloyd@users.noreply.github.com>
Co-authored-by: AUTOMATIC1111 <16777216c@gmail.com>
Co-authored-by: Won-Kyu Park <wkpark@gmail.com>
Co-authored-by: Khachatur Avanesian <jailbreakvideo@gmail.com>
Co-authored-by: v0xie <28695009+v0xie@users.noreply.github.com>
Co-authored-by: avantcontra <dadadaluo@gmail.com>
Co-authored-by: David Benson <dben@users.noreply.github.com>
Co-authored-by: Meerkov <GoMeerkov@gmail.com>
Co-authored-by: Emily Zeng <zhixuan.zeng@gmail.com>
Co-authored-by: w-e-w <40751091+w-e-w@users.noreply.github.com>
Co-authored-by: gibiee <37574274+gibiee@users.noreply.github.com>
Co-authored-by: Ritesh Gangnani <riteshgangnani10>
Co-authored-by: GerryDE <gerritfresen4@gmail.com>
Co-authored-by: fuchen.ljl <yjqqqqdx_01@163.com>
Co-authored-by: Alessandro de Oliveira Faria (A.K.A. CABELO) <cabelo@opensuse.org>
Co-authored-by: wfjsw <wfjsw@users.noreply.github.com>
Co-authored-by: aria1th <35677394+aria1th@users.noreply.github.com>
Co-authored-by: Tom Haelbich <65122811+h43lb1t0@users.noreply.github.com>
Co-authored-by: kaalibro <konstantin.adamovich@gmail.com>
Co-authored-by: anapnoe <124302297+anapnoe@users.noreply.github.com>
Co-authored-by: AngelBottomless <aria1th@naver.com>
Co-authored-by: Kieran Hunt <kph@hotmail.ca>
Co-authored-by: Lucas Daniel Velazquez M <19197331+Luxter77@users.noreply.github.com>
Co-authored-by: Your Name <you@example.com>
Co-authored-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Tom Haelbich <haelbito@outlook.com>
Co-authored-by: hidenorly <twitte.harold@gmail.com>
Co-authored-by: Aarni Koskela <akx@iki.fi>
Co-authored-by: Charlie Joynt <cjj1977@users.noreply.github.com>
Co-authored-by: obsol <33932119+read-0nly@users.noreply.github.com>
Co-authored-by: Nuullll <vfirst218@gmail.com>
Co-authored-by: MrCheeze <fishycheeze@yahoo.ca>
Co-authored-by: catboxanon <122327233+catboxanon@users.noreply.github.com>
Co-authored-by: illtellyoulater <3078931+illtellyoulater@users.noreply.github.com>

* Z (#12)

* added option to play notification sound or not

* Convert (emphasis) to (emphasis:1.1)

per @SirVeggie's suggestion

* Make attention conversion optional

Fix square brackets multiplier

* put notification.mp3 option at the end of the page

* more general case of adding an infotext when no images have been generated

* use shallow copy for AUTOMATIC1111#13535

* remove duplicated code

* support webui.settings.bat

* Start / Restart generation by Ctrl (Alt) + Enter

Add ability to interrupt current generation and start generation again by Ctrl (Alt) + Enter

* add an option to not print stack traces on ctrl+c.

* repair unload sd checkpoint button

* respect keyedit_precision_attention setting when converting from old (((attention))) syntax

* Update script.js

Exclude lambda

* Update script.js

LF instead CRLF

* Update script.js

* Add files via upload

LF

* wip incorrect OFT implementation

* inference working but SLOW

* faster by using cached R in forward

* faster by calculating R in updown and using cached R in forward

* refactor: fix constraint, re-use get_weight

* style: formatting

* style: fix ambiguous variable name

* rework some of changes for emphasis editing keys, force conversion of old-style emphasis

* fix the situation with emphasis editing (aaaa:1.1) bbbb (cccc:1.1)

* fix bug when using --gfpgan-models-path

* fix Blank line contains whitespace

* refactor: use forward hook instead of custom forward

* fix: return orig weights during updown, merge weights before forward

* fix: support multiplier, no forward pass hook

* style: cleanup oft

* fix: use merge_weight to cache value

* refactor: remove used OFT functions

* fix: multiplier applied twice in finalize_updown

* style: conform style

* Update prompts_from_file script to allow concatenating entries with the general prompt.

* linting issue

* call state.jobnext() before postproces*()

* Fix AUTOMATIC1111#13796

Fix comment error that makes understanding scheduling more confusing.

* test implementation based on kohaku diag-oft implementation

* detect diag_oft type

* no idea what i'm doing, trying to support both type of OFT, kblueleaf diag_oft has MultiheadAttn which kohya's doesn't?, attempt create new module based off network_lora.py, errors about tensor dim mismatch

* added accordion settings options

* Fix parenthesis auto selection

Fixes AUTOMATIC1111#13813

* Update requirements_versions.txt

* skip multihead attn for now

* refactor: move factorization to lyco_helpers, separate calc_updown for kohya and kb

* refactor: use same updown for both kohya OFT and LyCORIS diag-oft

* refactor: remove unused function

* correct a typo

modify "defaul" to "default"

* add a visible checkbox to input accordion

* eslint

* properly apply sort order for extra network cards when selected from dropdown
allow selection of default sort order in settings
remove 'Default' sort order, replace with 'Name'

* Add SSD-1B as a supported model

* Added memory clearance after deletion

* Use devices.torch_gc() instead of empty_cache()

* added compact prompt option

* compact prompt option disabled by default

* linter

* more changes for AUTOMATIC1111#13865: fix formatting, rename the function, add comment and add a readme entry

* fix img2img_tabs error

* fix exception related to the pix2pix

* Add option to set notification sound volume

* fix pix2pix producing bad results

* moved nested with to single line to remove extra tabs

* removed changes that weren't merged properly

* multiline with statement for readibility

* Update README.md

Modify the stablediffusion dependency address

* Update README.md

Modify the stablediffusion dependency address

* - opensuse compatibility

* Enable prompt hotkeys in style editor

* Compatibility with Debian 11, Fedora 34+ and openSUSE 15.4+

* fix added accordion settings options

* ExitStack as alternative to suppress

* implementing script metadata and DAG sorting mechanism

* populate loaded_extensions from extension list instead

* reverse the extension load order so builtin extensions load earlier natively

* add hyperTile

https://github.com/tfernd/HyperTile

* remove the assumption of same name

* allow comma and whitespace as separator

* fix

* bug fix

* dir buttons start with / so only the correct dir will be shown and not dirs with a substrings as name from the dir

* Lint

* Fixes generation restart not working for some users when 'Ctrl+Enter' is pressed

* Adds 'Path' sorting for Extra network cards

* fix gradio video component and canvas fit for inpaint

* hotfix: call shared.state.end() after postprocessing done

* Implement Hypertile

Co-Authored-By: Kieran Hunt <kph@hotmail.ca>

* copy LDM VAE key from XL

* fix: ignore calc_scale() for COFT which has very small alpha

* feat: LyCORIS/kohya OFT network support

* convert/add hypertile options

* fix ruff - add newline

* Adds tqdm handler to logging_config.py for progress bar integration

* Take into account tqdm not being installed before first boot for logging

* actually adds handler to logging_config.py

* Fix critical issue - unet apply

* Fix inverted option issue

I'm pretty sure I was sleepy while implementing this

* set empty value for SD XL 3rd layer

* fix double gc and decoding with unet context

* feat: fix randn found element of type float at pos 2

Signed-off-by: storyicon <storyicon@foxmail.com>

* use metadata.ini for meta filename

* Option to show batch img2img results in UI

shared.opts.img2img_batch_show_results_limit
limit the number of images return to the UI for batch img2img
default limit 32
0 no images are shown
-1 unlimited, all images are shown

* save sysinfo as .json

GitHub now allows uploading of .json files in issues

* rework extensions metadata: use custom sorter that doesn't mess the order as much and ignores cyclic errors, use classes with named fields instead of dictionaries, eliminate some duplicated code

* added option for default behavior of dir buttons

* Add FP32 fallback support on sd_vae_approx

This tries to execute interpolate with FP32 if it failed.

Background is that
on some environment such as Mx chip MacOS devices, we get error as follows:

```
"torch/nn/functional.py", line 3931, in interpolate
        return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
```

In this case, ```--no-half``` doesn't help to solve. Therefore this commits add the FP32 fallback execution to solve it.

Note that the submodule may require additional modifications. The following is the example modification on the other submodule.

```repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py

class Upsample(nn.Module):
..snip..
    def forward(self, x):
        assert x.shape[1] == self.channels
        if self.dims == 3:
            x = F.interpolate(
                x, (x.shape[2], x.shape[3] * 2, x.shape[4] * 2), mode="nearest"
            )
        else:
            try:
                x = F.interpolate(x, scale_factor=2, mode="nearest")
            except:
                x = F.interpolate(x.to(th.float32), scale_factor=2, mode="nearest").to(x.dtype)
        if self.use_conv:
            x = self.conv(x)
        return x
..snip..
```

You can see the FP32 fallback execution as same as sd_vae_approx.py.

* fix  [Bug]: (Dev Branch) Placing "Dimensions" first in "ui_reorder_list" prevents start AUTOMATIC1111#14047

* Update ruff to 0.1.6

* Simplify restart_sampler (suggested by ruff)

* use extension name for determining an extension is installed in the index

* Move exception_records related methods to errors.py

* remove traceback in sysinfo

* move file

* rework hypertile into a built-in extension

* do not save HTML explanations from options page to config

* fix linter errors

* compact prompt layout: preserve scroll when switching between lora tabs

* json.dump(ensure_ascii=False)

improve json readability

* add categories to settings

* also consider extension url

* add Block component creation callback

* catch uncaught exception with ui creation scripts

prevent total webui crash

* Allow use of mutiple styles csv files

* bugfix for warning message (#6)

* bugfix for warning message (#6)

* bugfix for warning message

* bugfix error message

* Allow use of mutiple styles csv files
* AUTOMATIC1111#14122
Fix edge case where style text has multiple {prompt} placeholders
* AUTOMATIC1111#14005

* Support XYZ scripts / split hires path from unet

* cache divisors / fix ruff

* fix ruff in hypertile_xyz.py

* fix ruff - set comprehension

* hypertile_xyz: we don't need isnumeric check for AxisOption

* Update devices.py

fixes issue where "--use-cpu" all properly makes SD run on CPU but leaves ControlNet (and other extensions, I presume) pointed at GPU, causing a crash in ControlNet caused by a mismatch between devices between SD and CN

AUTOMATIC1111#14097

* fix Auto focal point crop for opencv >= 4.8.x

autocrop.download_and_cache_models
in opencv >= 4.8 the face detection model was updated
download the base on opencv version
returns the model path or raise exception

* reformat file with uniform indentation

* Revert "Add FP32 fallback support on sd_vae_approx"

This reverts commit 58c1954.
Since the modification is expected to move to mac_specific.py
(AUTOMATIC1111#14046 (comment))

* Add FP32 fallback support on torch.nn.functional.interpolate

This tries to execute interpolate with FP32 if it failed.

Background is that
on some environment such as Mx chip MacOS devices, we get error as follows:

```
"torch/nn/functional.py", line 3931, in interpolate
        return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
```

In this case, ```--no-half``` doesn't help to solve. Therefore this commits add the FP32 fallback execution to solve it.

Note that the ```upsample_nearest2d``` is called from ```torch.nn.functional.interpolate```.
And the fallback for torch.nn.functional.interpolate is necessary at
```modules/sd_vae_approx.py``` 's ```VAEApprox.forward```
```repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py``` 's ```Upsample.forward```

* Fix the Ruff error about unused import

* Initial IPEX support

* add max-heigh/width to global-popup-inner

prevent the pop-up from being too big as to making exiting the pop-up impossible

* Close popups with escape key

* Fix bug where is_using_v_parameterization_for_sd2 fails because the sd_hijack is only partially undone

* Add support for SD 2.1 Turbo, by converting the state dict from SGM to LDM on load

* infotext updates: add option to disregard certain infotext fields, add option to not include VAE in infotext, add explanation to infotext settings page, move some options to infotext settings page

* Disable ipex autocast due to its bad perf

* split UI settings page into many

* put code that can cause an exception into its own function for AUTOMATIC1111#14120

* Fix fp64

* extras tab batch: actually use original filename
preprocessing upscale: do not do an extra upscale step if it's not needed

* Remove webui-ipex-user.bat

* remove Train/Preprocessing tab and put all its functionality into extras batch images mode

* potential fix for AUTOMATIC1111#14172

* alternate implementation for unet forward replacement that does not depend on hijack being applied

* Fix `save_samples` being checked early when saving masked composite

* Re-add setting lost as part of e294e46

* rework mask and mask_composite logic

* Add import_hook hack to work around basicsr incompatibility

Fixes AUTOMATIC1111#13985

* Update launch_utils.py to fix wrong dep. checks and reinstalls

Fixes failing dependency checks for extensions having a different package name and import name (for example ffmpeg-python / ffmpeg), which currently is causing the unneeded reinstall of packages at runtime.

In fact with current code, the same string is used when installing a package and when checking for its presence, as you can see in the following example:

> launch_utils.run_pip("install ffmpeg-python", "required package")
[ Installing required package: "ffmpeg-python" ... ]
[ Installed ]

> launch_utils.is_installed("ffmpeg-python")
False

... which would actually return true with:

> launch_utils.is_installed("ffmpeg")
True

* Lint

* make webui not crash when running with --disable-all-extensions option

* update changelog

* repair old handler for postprocessing API

* repair old handler for postprocessing API in a way that doesn't break interface

* add hypertile infotext

* Merge pull request AUTOMATIC1111#14203 from AUTOMATIC1111/remove-clean_text()

remove clean_text()

* fix Inpaint Image Appears Behind Some UI Elements anapnoe#206

* fix side panel show/hide button hot zone does not use the entire width anapnoe#204

* Merge pull request AUTOMATIC1111#14300 from AUTOMATIC1111/oft_fixes

Fix wrong implementation in network_oft

* Merge pull request AUTOMATIC1111#14296 from akx/paste-resolution

Allow pasting in WIDTHxHEIGHT strings into the width/height fields

* Merge pull request AUTOMATIC1111#14270 from kaalibro/extra-options-elem-id

Assign id for "extra_options". Replace numeric field with slider.

* Merge pull request AUTOMATIC1111#14276 from AUTOMATIC1111/fix-styles

Fix styles

* Merge pull request AUTOMATIC1111#14266 from kaalibro/dev

Re-add setting lost as part of e294e46

* Merge pull request AUTOMATIC1111#14229 from Nuullll/ipex-embedding

[IPEX] Fix embedding and ControlNet

* Merge pull request AUTOMATIC1111#14230 from AUTOMATIC1111/add-option-Live-preview-in-full-page-image-viewer

add option: Live preview in full page image viewer

* Merge pull request AUTOMATIC1111#14216 from wfjsw/state-dict-ref-comparison

change state dict comparison to ref compare

* Merge pull request AUTOMATIC1111#14237 from ReneKroon/dev

AUTOMATIC1111#13354 : solve lora loading issue

* Merge pull request AUTOMATIC1111#14307 from AUTOMATIC1111/default-Falst-js_live_preview_in_modal_lightbox

default False js_live_preview_in_modal_lightbox

* update to 1.7 from upstream

* Update README.md

* Update screenshot.png

* Update CITATION.cff

* update to latest version

* update to latest version

---------

Signed-off-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Gleb Alekseev <alekseev.gleb@gmail.com>
Co-authored-by: missionfloyd <missionfloyd@users.noreply.github.com>
Co-authored-by: AUTOMATIC1111 <16777216c@gmail.com>
Co-authored-by: Won-Kyu Park <wkpark@gmail.com>
Co-authored-by: Khachatur Avanesian <jailbreakvideo@gmail.com>
Co-authored-by: v0xie <28695009+v0xie@users.noreply.github.com>
Co-authored-by: avantcontra <dadadaluo@gmail.com>
Co-authored-by: David Benson <dben@users.noreply.github.com>
Co-authored-by: Meerkov <GoMeerkov@gmail.com>
Co-authored-by: Emily Zeng <zhixuan.zeng@gmail.com>
Co-authored-by: w-e-w <40751091+w-e-w@users.noreply.github.com>
Co-authored-by: gibiee <37574274+gibiee@users.noreply.github.com>
Co-authored-by: Ritesh Gangnani <riteshgangnani10>
Co-authored-by: GerryDE <gerritfresen4@gmail.com>
Co-authored-by: fuchen.ljl <yjqqqqdx_01@163.com>
Co-authored-by: Alessandro de Oliveira Faria (A.K.A. CABELO) <cabelo@opensuse.org>
Co-authored-by: wfjsw <wfjsw@users.noreply.github.com>
Co-authored-by: aria1th <35677394+aria1th@users.noreply.github.com>
Co-authored-by: Tom Haelbich <65122811+h43lb1t0@users.noreply.github.com>
Co-authored-by: kaalibro <konstantin.adamovich@gmail.com>
Co-authored-by: anapnoe <124302297+anapnoe@users.noreply.github.com>
Co-authored-by: AngelBottomless <aria1th@naver.com>
Co-authored-by: Kieran Hunt <kph@hotmail.ca>
Co-authored-by: Lucas Daniel Velazquez M <19197331+Luxter77@users.noreply.github.com>
Co-authored-by: Your Name <you@example.com>
Co-authored-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Tom Haelbich <haelbito@outlook.com>
Co-authored-by: hidenorly <twitte.harold@gmail.com>
Co-authored-by: Aarni Koskela <akx@iki.fi>
Co-authored-by: Charlie Joynt <cjj1977@users.noreply.github.com>
Co-authored-by: obsol <33932119+read-0nly@users.noreply.github.com>
Co-authored-by: Nuullll <vfirst218@gmail.com>
Co-authored-by: MrCheeze <fishycheeze@yahoo.ca>
Co-authored-by: catboxanon <122327233+catboxanon@users.noreply.github.com>
Co-authored-by: illtellyoulater <3078931+illtellyoulater@users.noreply.github.com>

---------

Signed-off-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Gleb Alekseev <alekseev.gleb@gmail.com>
Co-authored-by: missionfloyd <missionfloyd@users.noreply.github.com>
Co-authored-by: AUTOMATIC1111 <16777216c@gmail.com>
Co-authored-by: Won-Kyu Park <wkpark@gmail.com>
Co-authored-by: Khachatur Avanesian <jailbreakvideo@gmail.com>
Co-authored-by: v0xie <28695009+v0xie@users.noreply.github.com>
Co-authored-by: avantcontra <dadadaluo@gmail.com>
Co-authored-by: David Benson <dben@users.noreply.github.com>
Co-authored-by: Meerkov <GoMeerkov@gmail.com>
Co-authored-by: Emily Zeng <zhixuan.zeng@gmail.com>
Co-authored-by: w-e-w <40751091+w-e-w@users.noreply.github.com>
Co-authored-by: gibiee <37574274+gibiee@users.noreply.github.com>
Co-authored-by: GerryDE <gerritfresen4@gmail.com>
Co-authored-by: fuchen.ljl <yjqqqqdx_01@163.com>
Co-authored-by: Alessandro de Oliveira Faria (A.K.A. CABELO) <cabelo@opensuse.org>
Co-authored-by: wfjsw <wfjsw@users.noreply.github.com>
Co-authored-by: aria1th <35677394+aria1th@users.noreply.github.com>
Co-authored-by: Tom Haelbich <65122811+h43lb1t0@users.noreply.github.com>
Co-authored-by: kaalibro <konstantin.adamovich@gmail.com>
Co-authored-by: anapnoe <124302297+anapnoe@users.noreply.github.com>
Co-authored-by: AngelBottomless <aria1th@naver.com>
Co-authored-by: Kieran Hunt <kph@hotmail.ca>
Co-authored-by: Lucas Daniel Velazquez M <19197331+Luxter77@users.noreply.github.com>
Co-authored-by: Your Name <you@example.com>
Co-authored-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Tom Haelbich <haelbito@outlook.com>
Co-authored-by: hidenorly <twitte.harold@gmail.com>
Co-authored-by: Aarni Koskela <akx@iki.fi>
Co-authored-by: Charlie Joynt <cjj1977@users.noreply.github.com>
Co-authored-by: obsol <33932119+read-0nly@users.noreply.github.com>
Co-authored-by: Nuullll <vfirst218@gmail.com>
Co-authored-by: MrCheeze <fishycheeze@yahoo.ca>
Co-authored-by: catboxanon <122327233+catboxanon@users.noreply.github.com>
Co-authored-by: illtellyoulater <3078931+illtellyoulater@users.noreply.github.com>
martianunlimited added a commit to martianunlimited/stable-diffusion-webui-ux that referenced this issue Jan 25, 2024
* fix IndexError: list index out of range error interrupted while postprocess

* added option to play notification sound or not

* Convert (emphasis) to (emphasis:1.1)

per @SirVeggie's suggestion

* Make attention conversion optional

Fix square brackets multiplier

* put notification.mp3 option at the end of the page

* more general case of adding an infotext when no images have been generated

* use shallow copy for AUTOMATIC1111#13535

* remove duplicated code

* support webui.settings.bat

* Start / Restart generation by Ctrl (Alt) + Enter

Add ability to interrupt current generation and start generation again by Ctrl (Alt) + Enter

* add an option to not print stack traces on ctrl+c.

* repair unload sd checkpoint button

* respect keyedit_precision_attention setting when converting from old (((attention))) syntax

* Update script.js

Exclude lambda

* Update script.js

LF instead CRLF

* Update script.js

* Add files via upload

LF

* wip incorrect OFT implementation

* inference working but SLOW

* faster by using cached R in forward

* faster by calculating R in updown and using cached R in forward

* refactor: fix constraint, re-use get_weight

* style: formatting

* style: fix ambiguous variable name

* rework some of changes for emphasis editing keys, force conversion of old-style emphasis

* fix the situation with emphasis editing (aaaa:1.1) bbbb (cccc:1.1)

* fix bug when using --gfpgan-models-path

* fix Blank line contains whitespace

* refactor: use forward hook instead of custom forward

* fix: return orig weights during updown, merge weights before forward

* fix: support multiplier, no forward pass hook

* style: cleanup oft

* fix: use merge_weight to cache value

* refactor: remove used OFT functions

* fix: multiplier applied twice in finalize_updown

* style: conform style

* Update prompts_from_file script to allow concatenating entries with the general prompt.

* linting issue

* call state.jobnext() before postproces*()

* Fix AUTOMATIC1111#13796

Fix comment error that makes understanding scheduling more confusing.

* test implementation based on kohaku diag-oft implementation

* detect diag_oft type

* no idea what i'm doing, trying to support both type of OFT, kblueleaf diag_oft has MultiheadAttn which kohya's doesn't?, attempt create new module based off network_lora.py, errors about tensor dim mismatch

* added accordion settings options

* Fix parenthesis auto selection

Fixes AUTOMATIC1111#13813

* Update requirements_versions.txt

* skip multihead attn for now

* refactor: move factorization to lyco_helpers, separate calc_updown for kohya and kb

* refactor: use same updown for both kohya OFT and LyCORIS diag-oft

* refactor: remove unused function

* correct a typo

modify "defaul" to "default"

* add a visible checkbox to input accordion

* eslint

* properly apply sort order for extra network cards when selected from dropdown
allow selection of default sort order in settings
remove 'Default' sort order, replace with 'Name'

* Add SSD-1B as a supported model

* Added memory clearance after deletion

* Use devices.torch_gc() instead of empty_cache()

* added compact prompt option

* compact prompt option disabled by default

* linter

* more changes for AUTOMATIC1111#13865: fix formatting, rename the function, add comment and add a readme entry

* fix img2img_tabs error

* fix exception related to the pix2pix

* Add option to set notification sound volume

* fix pix2pix producing bad results

* moved nested with to single line to remove extra tabs

* removed changes that weren't merged properly

* multiline with statement for readibility

* Update README.md

Modify the stablediffusion dependency address

* Update README.md

Modify the stablediffusion dependency address

* - opensuse compatibility

* Enable prompt hotkeys in style editor

* Compatibility with Debian 11, Fedora 34+ and openSUSE 15.4+

* fix added accordion settings options

* ExitStack as alternative to suppress

* implementing script metadata and DAG sorting mechanism

* populate loaded_extensions from extension list instead

* reverse the extension load order so builtin extensions load earlier natively

* add hyperTile

https://github.com/tfernd/HyperTile

* remove the assumption of same name

* allow comma and whitespace as separator

* fix

* bug fix

* dir buttons start with / so only the correct dir will be shown and not dirs with a substrings as name from the dir

* Lint

* Fixes generation restart not working for some users when 'Ctrl+Enter' is pressed

* Adds 'Path' sorting for Extra network cards

* hotfix: call shared.state.end() after postprocessing done

* Implement Hypertile

Co-Authored-By: Kieran Hunt <kph@hotmail.ca>

* copy LDM VAE key from XL

* fix: ignore calc_scale() for COFT which has very small alpha

* feat: LyCORIS/kohya OFT network support

* convert/add hypertile options

* fix ruff - add newline

* Adds tqdm handler to logging_config.py for progress bar integration

* Take into account tqdm not being installed before first boot for logging

* actually adds handler to logging_config.py

* Fix critical issue - unet apply

* Fix inverted option issue

I'm pretty sure I was sleepy while implementing this

* set empty value for SD XL 3rd layer

* fix double gc and decoding with unet context

* feat: fix randn found element of type float at pos 2

Signed-off-by: storyicon <storyicon@foxmail.com>

* use metadata.ini for meta filename

* Option to show batch img2img results in UI

shared.opts.img2img_batch_show_results_limit
limit the number of images return to the UI for batch img2img
default limit 32
0 no images are shown
-1 unlimited, all images are shown

* save sysinfo as .json

GitHub now allows uploading of .json files in issues

* rework extensions metadata: use custom sorter that doesn't mess the order as much and ignores cyclic errors, use classes with named fields instead of dictionaries, eliminate some duplicated code

* added option for default behavior of dir buttons

* Add FP32 fallback support on sd_vae_approx

This tries to execute interpolate with FP32 if it failed.

Background is that
on some environment such as Mx chip MacOS devices, we get error as follows:

```
"torch/nn/functional.py", line 3931, in interpolate
        return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
```

In this case, ```--no-half``` doesn't help to solve. Therefore this commits add the FP32 fallback execution to solve it.

Note that the submodule may require additional modifications. The following is the example modification on the other submodule.

```repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py

class Upsample(nn.Module):
..snip..
    def forward(self, x):
        assert x.shape[1] == self.channels
        if self.dims == 3:
            x = F.interpolate(
                x, (x.shape[2], x.shape[3] * 2, x.shape[4] * 2), mode="nearest"
            )
        else:
            try:
                x = F.interpolate(x, scale_factor=2, mode="nearest")
            except:
                x = F.interpolate(x.to(th.float32), scale_factor=2, mode="nearest").to(x.dtype)
        if self.use_conv:
            x = self.conv(x)
        return x
..snip..
```

You can see the FP32 fallback execution as same as sd_vae_approx.py.

* fix  [Bug]: (Dev Branch) Placing "Dimensions" first in "ui_reorder_list" prevents start AUTOMATIC1111#14047

* Update ruff to 0.1.6

* Simplify restart_sampler (suggested by ruff)

* use extension name for determining an extension is installed in the index

* Move exception_records related methods to errors.py

* remove traceback in sysinfo

* move file

* rework hypertile into a built-in extension

* do not save HTML explanations from options page to config

* fix linter errors

* compact prompt layout: preserve scroll when switching between lora tabs

* json.dump(ensure_ascii=False)

improve json readability

* add categories to settings

* also consider extension url

* add Block component creation callback

* catch uncaught exception with ui creation scripts

prevent total webui crash

* Allow use of mutiple styles csv files

* bugfix for warning message (#6)

* bugfix for warning message (#6)

* bugfix for warning message

* bugfix error message

* Allow use of mutiple styles csv files
* AUTOMATIC1111#14122
Fix edge case where style text has multiple {prompt} placeholders
* AUTOMATIC1111#14005

* Support XYZ scripts / split hires path from unet

* cache divisors / fix ruff

* fix ruff in hypertile_xyz.py

* fix ruff - set comprehension

* hypertile_xyz: we don't need isnumeric check for AxisOption

* Update devices.py

fixes issue where "--use-cpu" all properly makes SD run on CPU but leaves ControlNet (and other extensions, I presume) pointed at GPU, causing a crash in ControlNet caused by a mismatch between devices between SD and CN

AUTOMATIC1111#14097

* fix Auto focal point crop for opencv >= 4.8.x

autocrop.download_and_cache_models
in opencv >= 4.8 the face detection model was updated
download the base on opencv version
returns the model path or raise exception

* reformat file with uniform indentation

* Revert "Add FP32 fallback support on sd_vae_approx"

This reverts commit 58c1954.
Since the modification is expected to move to mac_specific.py
(AUTOMATIC1111#14046 (comment))

* Add FP32 fallback support on torch.nn.functional.interpolate

This tries to execute interpolate with FP32 if it failed.

Background is that
on some environment such as Mx chip MacOS devices, we get error as follows:

```
"torch/nn/functional.py", line 3931, in interpolate
        return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
```

In this case, ```--no-half``` doesn't help to solve. Therefore this commits add the FP32 fallback execution to solve it.

Note that the ```upsample_nearest2d``` is called from ```torch.nn.functional.interpolate```.
And the fallback for torch.nn.functional.interpolate is necessary at
```modules/sd_vae_approx.py``` 's ```VAEApprox.forward```
```repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py``` 's ```Upsample.forward```

* Fix the Ruff error about unused import

* Initial IPEX support

* add max-heigh/width to global-popup-inner

prevent the pop-up from being too big as to making exiting the pop-up impossible

* Close popups with escape key

* Fix bug where is_using_v_parameterization_for_sd2 fails because the sd_hijack is only partially undone

* Add support for SD 2.1 Turbo, by converting the state dict from SGM to LDM on load

* infotext updates: add option to disregard certain infotext fields, add option to not include VAE in infotext, add explanation to infotext settings page, move some options to infotext settings page

* Disable ipex autocast due to its bad perf

* split UI settings page into many

* put code that can cause an exception into its own function for AUTOMATIC1111#14120

* Fix fp64

* extras tab batch: actually use original filename
preprocessing upscale: do not do an extra upscale step if it's not needed

* Remove webui-ipex-user.bat

* remove Train/Preprocessing tab and put all its functionality into extras batch images mode

* potential fix for AUTOMATIC1111#14172

* alternate implementation for unet forward replacement that does not depend on hijack being applied

* Fix `save_samples` being checked early when saving masked composite

* Re-add setting lost as part of e294e46

* rework mask and mask_composite logic

* Add import_hook hack to work around basicsr incompatibility

Fixes AUTOMATIC1111#13985

* Update launch_utils.py to fix wrong dep. checks and reinstalls

Fixes failing dependency checks for extensions having a different package name and import name (for example ffmpeg-python / ffmpeg), which currently is causing the unneeded reinstall of packages at runtime.

In fact with current code, the same string is used when installing a package and when checking for its presence, as you can see in the following example:

> launch_utils.run_pip("install ffmpeg-python", "required package")
[ Installing required package: "ffmpeg-python" ... ]
[ Installed ]

> launch_utils.is_installed("ffmpeg-python")
False

... which would actually return true with:

> launch_utils.is_installed("ffmpeg")
True

* Lint

* make webui not crash when running with --disable-all-extensions option

* update changelog

* repair old handler for postprocessing API

* repair old handler for postprocessing API in a way that doesn't break interface

* add hypertile infotext

* Merge pull request AUTOMATIC1111#14203 from AUTOMATIC1111/remove-clean_text()

remove clean_text()

* fix Inpaint Image Appears Behind Some UI Elements anapnoe#206

* fix side panel show/hide button hot zone does not use the entire width anapnoe#204

* Merge pull request AUTOMATIC1111#14300 from AUTOMATIC1111/oft_fixes

Fix wrong implementation in network_oft

* Merge pull request AUTOMATIC1111#14296 from akx/paste-resolution

Allow pasting in WIDTHxHEIGHT strings into the width/height fields

* Merge pull request AUTOMATIC1111#14270 from kaalibro/extra-options-elem-id

Assign id for "extra_options". Replace numeric field with slider.

* Merge pull request AUTOMATIC1111#14276 from AUTOMATIC1111/fix-styles

Fix styles

* Merge pull request AUTOMATIC1111#14266 from kaalibro/dev

Re-add setting lost as part of e294e46

* Merge pull request AUTOMATIC1111#14229 from Nuullll/ipex-embedding

[IPEX] Fix embedding and ControlNet

* Merge pull request AUTOMATIC1111#14230 from AUTOMATIC1111/add-option-Live-preview-in-full-page-image-viewer

add option: Live preview in full page image viewer

* Merge pull request AUTOMATIC1111#14216 from wfjsw/state-dict-ref-comparison

change state dict comparison to ref compare

* Merge pull request AUTOMATIC1111#14237 from ReneKroon/dev

AUTOMATIC1111#13354 : solve lora loading issue

* Merge pull request AUTOMATIC1111#14307 from AUTOMATIC1111/default-Falst-js_live_preview_in_modal_lightbox

default False js_live_preview_in_modal_lightbox

* update to 1.7 from upstream

* Update README.md

* Update screenshot.png

* Update CITATION.cff

* update to latest version

* update to latest version

---------

Signed-off-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Won-Kyu Park <wkpark@gmail.com>
Co-authored-by: Gleb Alekseev <alekseev.gleb@gmail.com>
Co-authored-by: missionfloyd <missionfloyd@users.noreply.github.com>
Co-authored-by: AUTOMATIC1111 <16777216c@gmail.com>
Co-authored-by: Khachatur Avanesian <jailbreakvideo@gmail.com>
Co-authored-by: v0xie <28695009+v0xie@users.noreply.github.com>
Co-authored-by: avantcontra <dadadaluo@gmail.com>
Co-authored-by: David Benson <dben@users.noreply.github.com>
Co-authored-by: Meerkov <GoMeerkov@gmail.com>
Co-authored-by: Emily Zeng <zhixuan.zeng@gmail.com>
Co-authored-by: w-e-w <40751091+w-e-w@users.noreply.github.com>
Co-authored-by: gibiee <37574274+gibiee@users.noreply.github.com>
Co-authored-by: Ritesh Gangnani <riteshgangnani10>
Co-authored-by: GerryDE <gerritfresen4@gmail.com>
Co-authored-by: fuchen.ljl <yjqqqqdx_01@163.com>
Co-authored-by: Alessandro de Oliveira Faria (A.K.A. CABELO) <cabelo@opensuse.org>
Co-authored-by: wfjsw <wfjsw@users.noreply.github.com>
Co-authored-by: aria1th <35677394+aria1th@users.noreply.github.com>
Co-authored-by: Tom Haelbich <65122811+h43lb1t0@users.noreply.github.com>
Co-authored-by: kaalibro <konstantin.adamovich@gmail.com>
Co-authored-by: AngelBottomless <aria1th@naver.com>
Co-authored-by: Kieran Hunt <kph@hotmail.ca>
Co-authored-by: Lucas Daniel Velazquez M <19197331+Luxter77@users.noreply.github.com>
Co-authored-by: Your Name <you@example.com>
Co-authored-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Tom Haelbich <haelbito@outlook.com>
Co-authored-by: hidenorly <twitte.harold@gmail.com>
Co-authored-by: Aarni Koskela <akx@iki.fi>
Co-authored-by: Charlie Joynt <cjj1977@users.noreply.github.com>
Co-authored-by: obsol <33932119+read-0nly@users.noreply.github.com>
Co-authored-by: Nuullll <vfirst218@gmail.com>
Co-authored-by: MrCheeze <fishycheeze@yahoo.ca>
Co-authored-by: catboxanon <122327233+catboxanon@users.noreply.github.com>
Co-authored-by: illtellyoulater <3078931+illtellyoulater@users.noreply.github.com>
Co-authored-by: anapnoe <124302297+anapnoe@users.noreply.github.com>
bolasim pushed a commit to basetenlabs/truss-examples that referenced this issue Feb 1, 2024
# Context

While i was testing an unrelated change (truss types), the gfp-gan truss
started failing in CI examples. After retrying a few times, it looked it
like it was an issue with the latest version of torchvision
(AUTOMATIC1111/stable-diffusion-webui#13985).

Because we were not pinning torchvision, we were getting this later
version, that does not seem to be compatible with gfp-gan.

The quick fix here is pinning torchvision, although I will acknowledge
that this is not sustainable, at some point we will need to update
gfp-gan library. This at least gets us back to passing CI.

# Testing

Tested by deploying gfp-gan on staging, it worked successfully.
@Vigsterkr92
Copy link

Anybody Knows How to fix it on colab?

im getting this issue

Launching Web UI with arguments: --share --disable-safe-unpickle --no-half-vae --xformers --enable-insecure-extension --gradio-queue
2024-03-15 16:08:59.652961: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2024-03-15 16:08:59.653063: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2024-03-15 16:08:59.764688: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2024-03-15 16:09:00.001480: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX512F FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-03-15 16:09:02.400902: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
/usr/local/lib/python3.10/dist-packages/gradio_client/documentation.py:103: UserWarning: Could not get documentation group for <class 'gradio.mix.Parallel'>: No known documentation group for module 'gradio.mix'
warnings.warn(f"Could not get documentation group for {cls}: {exc}")
/usr/local/lib/python3.10/dist-packages/gradio_client/documentation.py:103: UserWarning: Could not get documentation group for <class 'gradio.mix.Series'>: No known documentation group for module 'gradio.mix'
warnings.warn(f"Could not get documentation group for {cls}: {exc}")
WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for:
PyTorch 2.0.1+cu118 with CUDA 1108 (you have 2.2.1+cu121)
Python 3.10.11 (you have 3.10.12)
Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers)
Memory-efficient attention, SwiGLU, sparse and more won't be available.
Set XFORMERS_MORE_DETAILS=1 for more details
Traceback (most recent call last):
File "/content/microsoftexcel/launch.py", line 39, in
main()
File "/content/microsoftexcel/launch.py", line 35, in main
start()
File "/content/microsoftexcel/modules/launch_utils.py", line 390, in start
import webui
File "/content/microsoftexcel/webui.py", line 61, in
from modules import shared, sd_samplers, upscaler, extensions, localization, ui_tempdir, ui_extra_networks, config_states
File "/content/microsoftexcel/modules/ui_extra_networks.py", line 7, in
from modules.ui import up_down_symbol
File "/content/microsoftexcel/modules/ui.py", line 26, in
import modules.gfpgan_model
File "/content/microsoftexcel/modules/gfpgan_model.py", line 4, in
import gfpgan
File "/usr/local/lib/python3.10/dist-packages/gfpgan/init.py", line 2, in
from .archs import *
File "/usr/local/lib/python3.10/dist-packages/gfpgan/archs/init.py", line 2, in
from basicsr.utils import scandir
File "/usr/local/lib/python3.10/dist-packages/basicsr/init.py", line 4, in
from .data import *
File "/usr/local/lib/python3.10/dist-packages/basicsr/data/init.py", line 22, in
_dataset_modules = [importlib.import_module(f'basicsr.data.{file_name}') for file_name in dataset_filenames]
File "/usr/local/lib/python3.10/dist-packages/basicsr/data/init.py", line 22, in
_dataset_modules = [importlib.import_module(f'basicsr.data.{file_name}') for file_name in dataset_filenames]
File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/usr/local/lib/python3.10/dist-packages/basicsr/data/realesrgan_dataset.py", line 11, in
from basicsr.data.degradations import circular_lowpass_kernel, random_mixed_kernels
File "/usr/local/lib/python3.10/dist-packages/basicsr/data/degradations.py", line 8, in
from torchvision.transforms.functional_tensor import rgb_to_grayscale
ModuleNotFoundError: No module named 'torchvision.transforms.functional_tensor'

@Dolers
Copy link

Dolers commented Mar 16, 2024

Vigsterkr92 Just had the same issue in Colab. You can navigate to the "/usr/local/lib/python3.10/dist-packages/basicsr/data/degradations.py" file with the file explorer and correct it as stated before

@yuxiaobopp
Copy link

This looks like it should probably be opened at basicsr's repo,as I believe A1111 just pulls from that repo, it hasn't been updated in a while though.

In the short term - try:

Open ./stable-diffusion-webui/venv/lib/python3.10/site-packages/basicsr/data/degradations.py and on line 8, simply change:

from torchvision.transforms.functional_tensor import rgb_to_grayscale

to:

from torchvision.transforms.functional import rgb_to_grayscale

Which should at least get you past this step.

this is worked!

@timlenardo
Copy link

I recently ran into this issue in a HuggingFace space, where as far as I know, it's not possible to edit the dependency files after installation. Thankfully, this issue was addressed in basicsr as of a month ago (commit 8d56e3a045f9fb3e1d8872f92ee4a4f07f886b0a )

The fix hasn't made it's way into a version that's available on pip yet, but you can install the packaged directly from from Github commit:

pip install git+https://github.com/XPixelGroup/BasicSR@8d56e3a045f9fb3e1d8872f92ee4a4f07f886b0a

Or in a requirements.txt file:

basicsr @ git+https://github.com/XPixelGroup/BasicSR@8d56e3a045f9fb3e1d8872f92ee4a4f07f886b0a

@yuxiaobopp
Copy link

yuxiaobopp commented Jun 18, 2024 via email

@wladradchenko
Copy link

Hi! Modifying the library code, as suggested in the answer by @viking1304 on Nov 16, 2023, is not ideal, and locking to specific versions can also introduce limitations. Instead, you can handle the missing function without changing the library code directly.

Here’s an approach that dynamically adds the rgb_to_grayscale function into the torchvision.transforms.functional_tensor module:

import sys
import types
from torchvision.transforms.functional import rgb_to_grayscale

# Create a module for `torchvision.transforms.functional_tensor`
functional_tensor = types.ModuleType("torchvision.transforms.functional_tensor")
functional_tensor.rgb_to_grayscale = rgb_to_grayscale

# Add this module to sys.modules so other imports can access it
sys.modules["torchvision.transforms.functional_tensor"] = functional_tensor

This approach makes the missing function available where it’s expected, without requiring any modifications to the library code itself. It's especially useful for introducing back functions that may have been removed in recent library updates, providing a clean and maintainable solution.

@yuxiaobopp
Copy link

yuxiaobopp commented Oct 27, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Report of a bug, yet to be confirmed
Projects
None yet
Development

No branches or pull requests

10 participants