From 422c60c78771fc927e20884466a43152edbcdcf6 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Wed, 5 Jul 2023 20:49:39 +0300 Subject: [PATCH 1/6] Patch torch.Generator --- modules/devices.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/devices.py b/modules/devices.py index ddd02fb28..87734c4e1 100644 --- a/modules/devices.py +++ b/modules/devices.py @@ -190,9 +190,9 @@ if backend == 'ipex': lambda orig_func, *args, **kwargs: orig_func(args[0].to("cpu"), args[1].to("cpu")).to(get_cuda_device_string()), lambda *args, **kwargs: args[1].device != torch.device("cpu")) #SDE Samplers: - CondFunc('torchsde._brownian.brownian_interval._randn', - lambda _, size, dtype, device, seed: torch.randn(size, dtype=dtype, device=device, generator=torch.xpu.Generator(device).manual_seed(int(seed))), - lambda _, size, dtype, device, seed: device != torch.device("cpu")) + CondFunc('torch.Generator', + lambda orig_func, *args, **kwargs: torch.xpu.Generator(args[0]), + lambda *args, **kwargs: args[1] != torch.device("cpu")) #ControlNet: CondFunc('torch.batch_norm', lambda orig_func, *args, **kwargs: orig_func(args[0].to("cpu"), From 3bcca6f92b4d457eff8616e157ba13421f59527f Mon Sep 17 00:00:00 2001 From: Disty0 Date: Thu, 6 Jul 2023 02:51:27 +0300 Subject: [PATCH 2/6] Patch torch.Generator again --- modules/devices.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/devices.py b/modules/devices.py index 87734c4e1..67e01cd06 100644 --- a/modules/devices.py +++ b/modules/devices.py @@ -191,8 +191,8 @@ if backend == 'ipex': lambda *args, **kwargs: args[1].device != torch.device("cpu")) #SDE Samplers: CondFunc('torch.Generator', - lambda orig_func, *args, **kwargs: torch.xpu.Generator(args[0]), - lambda *args, **kwargs: args[1] != torch.device("cpu")) + lambda _, device: torch.xpu.Generator(device), + lambda _, device: device != torch.device("cpu") and device != "cpu") #ControlNet: CondFunc('torch.batch_norm', lambda orig_func, *args, **kwargs: orig_func(args[0].to("cpu"), From 205b5164872aadc61b49ee409352c0a5c736aa84 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Fri, 7 Jul 2023 22:41:26 +0300 Subject: [PATCH 3/6] Fix diffusers_sdxl on ipex --- modules/devices.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/devices.py b/modules/devices.py index 67e01cd06..dbc7b94a7 100644 --- a/modules/devices.py +++ b/modules/devices.py @@ -175,8 +175,10 @@ else: backend = 'cpu' if backend == 'ipex': - #Fix broken function in ipex 1.13.120+xpu + #Fix broken functions with ipex from modules.sd_hijack_utils import CondFunc + torch.cuda.empty_cache = torch.xpu.empty_cache + #Functions with dtype errors: CondFunc('torch.nn.modules.GroupNorm.forward', lambda orig_func, *args, **kwargs: orig_func(args[0], args[1].to(args[0].weight.data.dtype)), @@ -184,6 +186,7 @@ if backend == 'ipex': CondFunc('torch.nn.modules.Linear.forward', lambda orig_func, *args, **kwargs: orig_func(args[0], args[1].to(args[0].weight.data.dtype)), lambda *args, **kwargs: args[2].dtype != args[1].weight.data.dtype) + #Functions that does not work with the XPU: #UniPC: CondFunc('torch.linalg.solve', @@ -191,8 +194,12 @@ if backend == 'ipex': lambda *args, **kwargs: args[1].device != torch.device("cpu")) #SDE Samplers: CondFunc('torch.Generator', - lambda _, device: torch.xpu.Generator(device), - lambda _, device: device != torch.device("cpu") and device != "cpu") + lambda orig_func, device: torch.xpu.Generator(device), + lambda orig_func, device: device != torch.device("cpu") and device != "cpu") + #Diffusers Float64 (ARC GPUs doesn't support double or Float64): + CondFunc('torch.from_numpy', + lambda orig_func, *args, **kwargs: orig_func(args[0].astype('float32')), + lambda *args, **kwargs: args[1].dtype == float) #ControlNet: CondFunc('torch.batch_norm', lambda orig_func, *args, **kwargs: orig_func(args[0].to("cpu"), From 1822242b3f202f8902b2ef7701bf2d6ddfd804c8 Mon Sep 17 00:00:00 2001 From: QuantumSoul Date: Sat, 8 Jul 2023 14:27:29 +0200 Subject: [PATCH 4/6] Update README.md - Fix typos - Add trailing dots - Fix formatting --- README.md | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index eb9bcbac2..6464e5a93 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,9 @@ **Stable Diffusion implementation with modern UI and advanced features** -This project started as a form from [Automatic1111 WebUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui/) and it grew siginificantly since then, but although it diverged significanly, any substantial features to original work is ported to this repository as well +This project started as a fork from [Automatic1111 WebUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui/) and it grew significantly since then, but although it diverged considerably, any substantial features to original work is ported to this repository as well. -Individual features are not listed here, instead check [Changelog](CHANGELOG.md) for full list of changes +Individual features are not listed here, instead check [Changelog](CHANGELOG.md) for full list of changes. ## Platform support @@ -32,12 +32,13 @@ Individual features are not listed here, instead check [Changelog](CHANGELOG.md) `webui.bat` or `webui.sh`: - Platform specific wrapper scripts For Windows, Linux and OSX - Starts `sdnext.py` in a Python virtual environment (`venv`) - - Uses `install.py` to handle all actual requirements and dependencies - - *Note*: Server can run without virtual environment, but it is recommended to use it to avoid library version conflicts with other applications + - Uses `install.py` to handle all actual requirements and dependencies -*Note*: **nVidia/CUDA** and **AMD/ROCm** are auto-detected is present and available, but for any other use case specify required parameter explicitly or wrong packages may be installed as installer will assume CPU-only environment +*Note*: Server can run without virtual environment, but it is recommended to use it to avoid library version conflicts with other applications -Full startup sequence is logged in `sdnext.log`, so if you encounter any issues, please check it first +*Note*: **nVidia/CUDA** and **AMD/ROCm** are auto-detected is present and available, but for any other use case specify required parameter explicitly or wrong packages may be installed as installer will assume CPU-only environment. + +Full startup sequence is logged in `sdnext.log`, so if you encounter any issues, please check it first. Below is partial list of all available parameters, run `webui --help` for the full list: @@ -64,14 +65,16 @@ Below is partial list of all available parameters, run `webui --help` for the fu ### **Collab** - To avoid having this repo rely just on me, I'd love to have additional maintainers with full admin rights. If you're interested, ping me! -- In addition to general cross-platform code, desire is to have a lead for each of the main platforms -This should be fully cross-platform, but I would really love to have additional contibutors and/or maintainers to join and help lead the efforts on different platforms +- In addition to general cross-platform code, desire is to have a lead for each of the main platforms. +This should be fully cross-platform, but I would really love to have additional contibutors and/or maintainers to join and help lead the efforts on different platforms. ### **Goals** -The idea behind the fork is to enable latest technologies and advances in text-to-image generation -*Sometimes this is not the same as "as simple as possible to use"* -If you are looking an amazing simple-to-use Stable Diffusion tool, I'd suggest [InvokeAI](https://invoke-ai.github.io/InvokeAI/) specifically due to its automated installer and ease of use +The idea behind the fork is to enable latest technologies and advances in text-to-image generation. + +*Sometimes this is not the same as "as simple as possible to use".* + +If you are looking an amazing simple-to-use Stable Diffusion tool, I'd suggest [InvokeAI](https://invoke-ai.github.io/InvokeAI/) specifically due to its automated installer and ease of use. General goals: From 7e665ab5c0eda460b4d75e40e84fb8dd7343d62a Mon Sep 17 00:00:00 2001 From: QuantumSoul Date: Sat, 8 Jul 2023 15:03:52 +0200 Subject: [PATCH 5/6] Beautiful README.md formatting --- README.md | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 6464e5a93..953a5c268 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,17 @@ -[![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/vladmandic) -![Last Commit](https://img.shields.io/github/last-commit/vladmandic/automatic?style=flat-square&svg=true) -![License](https://img.shields.io/github/license/vladmandic/automatic?style=flat-square&svg=true) -![GitHub Status Checks](https://img.shields.io/github/checks-status/vladmandic/automatic/main?style=flat-square&svg=true) -![Discord](https://img.shields.io/discord/1101998836328697867) - +
+ # SD.Next +**🫧 Stable Diffusion implementation with modern UI and advanced features 🫧** +
+[![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/vladmandic) +![Last Commit](https://img.shields.io/github/last-commit/vladmandic/automatic?svg=true) +![License](https://img.shields.io/github/license/vladmandic/automatic?svg=true) +![GitHub Status Checks](https://img.shields.io/github/checks-status/vladmandic/automatic/main?svg=true) +[![Discord](https://img.shields.io/discord/1101998836328697867?logo=Discord&svg=true)](https://discord.gg/VjvR2tabEX) -**Stable Diffusion implementation with modern UI and advanced features** +### [Docs](README.md#docs) | [Discord](https://discord.gg/VjvR2tabEX) | [Changelog](CHANGELOG.md) + +
This project started as a fork from [Automatic1111 WebUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui/) and it grew significantly since then, but although it diverged considerably, any substantial features to original work is ported to this repository as well. @@ -34,9 +39,9 @@ Individual features are not listed here, instead check [Changelog](CHANGELOG.md) - Starts `sdnext.py` in a Python virtual environment (`venv`) - Uses `install.py` to handle all actual requirements and dependencies -*Note*: Server can run without virtual environment, but it is recommended to use it to avoid library version conflicts with other applications +> Server can run without virtual environment, but it is recommended to use it to avoid library version conflicts with other applications -*Note*: **nVidia/CUDA** and **AMD/ROCm** are auto-detected is present and available, but for any other use case specify required parameter explicitly or wrong packages may be installed as installer will assume CPU-only environment. +> **nVidia/CUDA** and **AMD/ROCm** are auto-detected is present and available, but for any other use case specify required parameter explicitly or wrong packages may be installed as installer will assume CPU-only environment. Full startup sequence is logged in `sdnext.log`, so if you encounter any issues, please check it first. @@ -72,7 +77,7 @@ This should be fully cross-platform, but I would really love to have additional The idea behind the fork is to enable latest technologies and advances in text-to-image generation. -*Sometimes this is not the same as "as simple as possible to use".* +> *Sometimes this is not the same as "as simple as possible to use".* If you are looking an amazing simple-to-use Stable Diffusion tool, I'd suggest [InvokeAI](https://invoke-ai.github.io/InvokeAI/) specifically due to its automated installer and ease of use. @@ -98,6 +103,7 @@ General goals: ### **Docs** +- [Wiki](https://github.com/vladmandic/automatic/wiki) - [ReadMe](README.md) - [ToDo](TODO.md) - [Changelog](CHANGELOG.md) From 9dd1ce837a7be04183db178e14e40c0c82a59fc5 Mon Sep 17 00:00:00 2001 From: QuantumSoul Date: Sat, 8 Jul 2023 15:38:54 +0200 Subject: [PATCH 6/6] README.md title --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 953a5c268..c4e55125d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@
# SD.Next -**🫧 Stable Diffusion implementation with modern UI and advanced features 🫧** +**Stable Diffusion implementation with advanced features**
[![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/vladmandic) ![Last Commit](https://img.shields.io/github/last-commit/vladmandic/automatic?svg=true)