wikl update

Signed-off-by: Vladimir Mandic <mandic00@live.com>
Vladimir Mandic
2024-10-28 09:47:53 -04:00
parent 53def8203b
commit 84d0a46e9d
32 changed files with 182 additions and 569 deletions
+2
@@ -1,3 +1,5 @@
# Advanced Install
## Start Scripts
Start scripts `webui.bat` or `webui.sh` are provided to create and activate VENV and immediately start launcher.
+2
@@ -1,3 +1,5 @@
# Command Line Arguments
**All options listed here are available as arguments to use from the command line or as environment variables, there's no need to do both.**
## General Options
+2
@@ -1,3 +1,5 @@
# Control Guide
## Introduction to Control
SDNext's Control tab is our long awaited effort to bring ControlNet, IP-Adapters, T2I Adapter, ControlNet XS, and ControlNet LLLite to our users.
+1 -1
@@ -1,4 +1,4 @@
# Control
# Control Overview
Native control module for SD.Next for Diffusers backend
Can be used for Control generation as well as Image and Text workflows
-128
@@ -1,128 +0,0 @@
SD.Next includes *experimental* support for additional model pipelines
This includes support for additional models such as:
- **Stable Diffusion XL**
- **Kandinsky**
- **Deep Floyd IF**
And soon:
- **Shap-E**, **UniDiffuser**, **Consistency Models**, **Diffedit Zero-Shot**
- **Text2Video**, **Video2Video**, etc...
*This has been made possible by integration of [huggingface diffusers](https://huggingface.co/docs/diffusers/index) library with the help of huggingface team!*
## How to
Moved to [Installation](https://github.com/vladmandic/automatic/wiki/Installation) and [SDXL](https://github.com/vladmandic/automatic/wiki/SDXL)
## Integration
### Standard workflows
- **txt2img**
- **img2img**
- **inpaint**
- **process**
### Model Access
- For standard **SD 1.5** and **SD 2.1** models, you can use either
standard *safetensor* models (single file) or *diffusers* models (folder structure)
- For additional models, you can use *diffusers* models only
- You can download diffuser models directly from [Huggingface hub](https://huggingface.co/)
or use built-in model search & download in SD.Next: **UI -> Models -> Huggingface**
- Note that access to some models is gated
In which case, you need to accept model EULA and provide your huggingface token
- When loading safetensors models, you must specify model pipeline type in:
**UI -> Settings -> Diffusers -> Pipeline**
When loading huggingface models, pipeline type is automatically detected
- If you get this `Diffuser model downloaded error: model=stabilityai/stable-diffusion-etc [Errno 2] No such file or directory:`
you need to go to the HuggingFace page and accept the EULA for that model.
### Extra Networks
- Lora networks
- Textual inversions (embeddings)
Note that Lora and TI need are still model-specific, so you cannot use Lora trained on SD 1.5 on SD-XL
(just like you couldn't do it on SD 2.1 model) - it needs to be trained for a specific model
Support for SD-XL training is expected shortly
### Diffuser Settings
- UI -> Settings -> Diffuser Settings
contains additional tunable parameters
### Samplers
- Samplers (schedulers) are pipeline specific, so when running with diffuser backend, you'll see a different list of samplers
- UI -> Settings -> Sampler Settings shows different configurable parameters depending on backend
- Recommended sampler for diffusers is **DEIS**
### Other
- Updated **System Info** tab with additional information
- Support for `lowvram` and `medvram` modes - Both work extremely well
Additional tunables are available in UI -> Settings -> Diffuser Settings
- Support for both default **SDP** and **xFormers** cross-optimizations
Other cross-optimization methods are not available
- **Extra Networks UI** will show available diffusers models
- **CUDA model compile**
UI Settings -> Compute settings
Requires GPU with high VRAM
Diffusers recommend `reduce overhead` compile mode, but other methods are available as well
Fullgraph compile is possible (with sufficient vram) when using diffusers
- Note that some CUDA compile modes only work on Linux
## SD-XL Notes
- [SD-XL Technical Report](https://github.com/Stability-AI/generative-models/blob/main/assets/sdxl_report.pdf)
- SD-XL model is designed as two-stage model
You can run SD-XL pipeline using just `base` model or load both `base` and `refiner` models
- `base`: Trained on images with variety of aspect ratios and uses OpenCLIP-ViT/G and CLIP-ViT/L for text encoding
- `refiner`: Trained to denoise small noise levels of high quality data and uses the OpenCLIP model
- Having both `base` model and `refiner` model loaded can require significant VRAM
- If you want to use `refiner` model, it is advised to add `sd_model_refiner` to **quicksettings**
in UI Settings -> User Interface
- SD-XL model was trained on **1024px** images
You can use it with smaller sizes, but you will likely get better results with SD 1.5 models
- SD-XL model NSFW filter has been turned off
### Download SD-XL 1.0
1. Enter `stabilityai/stable-diffusion-xl-base-1.0` in *Select Model* and press *Download*
2. Enter `stabilityai/stable-diffusion-xl-refiner-1.0` in *Select Model* and press *Download*
## Limitations
- Any extension that requires access to model internals will likely not work when using diffusers backend
This for example includes standard extensions such as `ControlNet`, `MultiDiffusion`,
*Note: application will auto-disable incompatible built-in extensions when running in diffusers mode*
- Explicit `refiner` as postprocessing is not yet implemented
- Hypernetworks
- Limited callbacks support for scripts/extensions: additional callbacks will be added as needed
## Performance
Comparison of original stable diffusion pipeline and diffusers pipeline when using standard SD 1.5 model
Performance is measured for `batch-size` 1, 2, 4, 8 16
| pipeline | performance it/s | memory cpu/gpu |
| --- | --- | --- |
| original | 7.99 / 7.93 / 8.83 / 9.14 / 9.2 | 6.7 / 7.2 |
| original medvram | 6.23 / 7.16 / 8.41 / 9.24 / 9.68 | 8.4 / 6.8 |
| original lowvram | 1.05 / 1.94 / 3.2 / 4.81 / 6.46 | 8.8 / 5.2 |
| diffusers | 9 / 7.4 / 8.2 / 8.4 / 7.0 | 4.3 / 9.0 |
| diffusers medvram | 7.5 / 6.7 / 7.5 / 7.8 / 7.2 | 6.6 / 8.2 |
| diffusers lowvram | 7.0 / 7.0 / 7.4 / 7.7 / 7.8 | 4.3 / 7.2 |
| diffusers with safetensors | 8.9 / 7.3 / 8.1 / 8.4 / 7.1 | 5.9 / 9.0 |
Notes:
- Test environment: nVidia RTX 3060 GPU, Torch 2.1-nightly with CUDA 12.1, Cross-optimization: SDP
- All being equal, diffusers seem to:
- Use slightly less RAM and more VRAM
- Have highly efficient medvram/lowvram equivalents which don't lose a lot of performance
- Faster on smaller batch sizes, slower on larger batch sizes
+3 -1
@@ -1,4 +1,6 @@
Starting with the January 2024 release, the search input for the extra networks accepts additional search syntax.
# Extra Networks Search
Search input for the extra networks accepts additional search syntax.
This allows to do more complicated searches, in addition to the searches which were previously available.
## Search Syntax
+39
@@ -0,0 +1,39 @@
# Gated Models
## Huggingface Login
Access to some models is gated by vendor and in those cases, you need to request access to model from the vendor.
For this you need to have a valid Huggingface account: [Login](https://huggingface.co/login) or [Sign Up](https://huggingface.co/join)
Huggingface login and/or access token is not required for non-gated models
### Create Token
*Note*: This is a one-time operation as same access token is used for all gated models.
Once you are logged in, create access token that an external application such as **SD.Next** can use to access **Huggingface** on your behalf:
Go to: *Huggingface -> Profile -> Settings -> Access Token -> Create new token*
Or use [this link](https://huggingface.co/settings/tokens/new?tokenType=read)
- Token type: READ
Do not use fine-grained to avoid complications
Name is your choice
- Create token
Copy the token and store it in a safe place
### Add Token to SD.Next
Go to: *SD.Next -> System -> Settings -> Diffusers*
- Paste the token in the Huggingface Token field
## Requesting Access
*Note*: Requesting access must be done on individual per-model case
Requesting access can be in the form of simply accepting vendors terms of service or filling a form to get access to the model or requesting access and waiting for approval.
In all cases, you need to go to model page on Huggingface and follow instruction.
Examples: [FLUX.1](https://huggingface.co/black-forest-labs/FLUX.1-dev), [SD3.5](https://huggingface.co/stabilityai/stable-diffusion-3.5-large)
Once you have access, you can use the model in SD.Next as usual
+4
@@ -1,3 +1,5 @@
# Hints
## Notes
- Below is a full list of hints as copied from `html/locale_en.json`
@@ -13,6 +15,8 @@
Full list of existing hints:
## Data
```json
{"icons": [
{"id":"","label":"🎲️","localized":"","hint":"Use random seed"},
+14 -11
@@ -1,4 +1,4 @@
# Notes
# IPEX and Intel GPUs
## GPU Support with IPEX and SD.Next
@@ -24,9 +24,9 @@ Diffusers backend is 10%-25% faster than the original backend.
Disable your iGPU (if any, e.g. UHD or Iris Xe) in the device manager.
# Windows Installation
## Windows Installation
## Preparations
### Preparations
- Install `Intel GPU Driver`.
- Install `Git`.
@@ -34,7 +34,7 @@ Disable your iGPU (if any, e.g. UHD or Iris Xe) in the device manager.
- Open CMD in a folder you want to install SD.Next.
## Using SD.Next
### Using SD.Next
Install SD.Next from Github:
@@ -46,13 +46,16 @@ cd automatic
Note: It will install the necessary libraries at the first run so it will take a while depending on your internet.
# Linux and WSL Installation
## Linux and WSL Installation
## Install Intel Compute Runtime
### Ubuntu
### Install Intel Compute Runtime
#### Ubuntu
Use Ubuntu 23.04 or newer.
### Don't use Linux Kernel 6.8 or 6.9!
#### Don't use Linux Kernel 6.8 or 6.9!
<https://github.com/intel/compute-runtime/issues/726>
Note: Updating kernel is not neccesary for WSL.
@@ -74,8 +77,7 @@ Then install the necessary packages:
sudo apt-get install intel-opencl-icd intel-level-zero-gpu level-zero git python3-pip python3-venv libgl1 libglib2.0-0 libgomp1
```
### Arch Linux
#### Arch Linux
Install the necessary packages for Arch Linux:
@@ -83,7 +85,8 @@ Install the necessary packages for Arch Linux:
pacman -S intel-compute-runtime level-zero-headers level-zero-loader git python-pip python-virtualenv
```
## Using SD.Next
### Using SD.Next
Install SD.Next from Github:
```shell
+23 -12
@@ -1,3 +1,5 @@
# MacOS and Python
[TL;DR: Installation Instructions](#installation-instructions)
The MacOS operating system requires Python, so it is installed by default. However, if you are going to start using Python on your own, it is likely that you'll want to install new packages, perform package updates, and so on -- which can be a problem for MacOS -- it's important to let the operating system handle its own Python.
@@ -9,15 +11,16 @@ Homebrew's Python is there to support other packages. Importantly, Homebrew del
The solution is to use another way to manage the Python version(s) that you use on your own. I use [asdf](https://asdf-vm.com/), which has a [Python plugin](https://github.com/asdf-community/asdf-python), but there are others if you prefer something else.
Sources / Further Reading:
- https://justinmayer.com/posts/homebrew-python-is-not-for-you/
- https://hackercodex.com/guide/python-development-environment-on-mac-osx/
- https://github.com/asdf-community/asdf-python
- https://asdf-vm.com/
- https://docs.brew.sh/Installation
- <https://justinmayer.com/posts/homebrew-python-is-not-for-you/>
- <https://hackercodex.com/guide/python-development-environment-on-mac-osx/>
- <https://github.com/asdf-community/asdf-python>
- <https://asdf-vm.com/>
- <https://docs.brew.sh/Installation>
## Installation Instructions
0. If you haven't got Homebrew installed already:
1. If you haven't got Homebrew installed already:
```zsh
mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip-components 1 -C homebrew
@@ -26,16 +29,21 @@ brew update --force --quiet
chmod -R go-w "$(brew --prefix)/share/zsh"
```
1. Install asdf and python build dependencies:
2. Install asdf and python build dependencies:
```zsh
brew install asdf openssl readline sqlite3 xz zlib
```
2. Add asdf to `.zshrc` to use it immediately and persistently:
3. Add asdf to `.zshrc` to use it immediately and persistently:
```zsh
. $(brew --prefix asdf)/asdf.sh
echo -e "\n. $(brew --prefix asdf)/asdf.sh" >> ~/.zshrc
```
3. Add the python asdf plugin:
4. Add the python asdf plugin:
```zsh
asdf plugin add python
@@ -45,15 +53,18 @@ asdf install python 3.10.14
# you may want the latest version too; take note of which version is installed
asdf install python latest
```
4. Set the default global version of python. Since you will always want 3.10 for SD.Next, you will want to always specifically use that version. You will probably want to use the command `python` in most contexts, and `python3.10` for version-specific uses.
5. Set the default global version of python. Since you will always want 3.10 for SD.Next, you will want to always specifically use that version. You will probably want to use the command `python` in most contexts, and `python3.10` for version-specific uses.
```zsh
asdf global python 3.12.2
# or whatever version you installed
```
5. Run SD.Next using python3.10:
6. Run SD.Next using python3.10:
```zsh
export PYTHON=$(which python3.10)
cd /path/to/SD.Next
./webui.sh --debug
```
+1 -1
@@ -1,4 +1,4 @@
## Save to metadata
# Image Metadata
Notes:
+1 -1
@@ -39,7 +39,7 @@ Original URL: <https://github.com/vladmandic/automatic/wiki/Models>
| VectorSpaceLab | OmniGen | v1 | 15.47GB | Transformer | 3.76B | None | 0 | VAE | Phi-3 |
## Notes:
## Notes
- Created using [SD.Next](https://github.com/vladmandic/automatic/) built-in model analyzer
- Number of parameters is proportional to model complexity and ability to learn
@@ -1,4 +1,7 @@
# NNCF Model Comporession
## Usage
0. Use Diffusers backend. `Execution & Models` -> `Execution backend`
1. Go into `Compute Settings`
2. Enable `Compress Model weights with NNCF` options
@@ -9,9 +12,12 @@ VAE Upcast (in Diffusers settings) has to be set to false if you use the VAE opt
If you get black images with SDXL models, use the [FP16 Fixed VAE](https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/blob/main/sdxl_vae.safetensors).
### Features
* Uses INT8, halves the model size
Saves 3.4 GB of VRAM with SDXL
### Disadvantages
* It is Autocast, GPU will still use 16 Bit to run the model and will be slower
* Not implemented in Original backend
* Fused projections are not compatible with NNCF
@@ -19,6 +25,7 @@ Saves 3.4 GB of VRAM with SDXL
## Options
These results compares NNCF 8 bit to 16 bit.
- Model:
+3 -2
@@ -144,9 +144,10 @@ TBA
## FAQ
### My execution provider does not show up in my settings.
### My execution provider does not show up in my settings
After activating python venv, run this command and try again:
```
(venv) $ pip uninstall onnxruntime onnxruntime-... -y
```
```
+33 -27
@@ -1,4 +1,5 @@
# OpenVINO
OpenVINO is an open-source toolkit for optimizing and deploying deep learning models.
* Compiles models for your hardware.
* Supports **Linux and Windows**
@@ -7,60 +8,68 @@ OpenVINO is an open-source toolkit for optimizing and deploying deep learning mo
* Supports **INTEL** dGPUs and iGPUs.
* Supports **NVIDIA** GPUs.
* Supports **CPUs** with **BF16** and **INT8** support.
* Supports **Quantization** and **Model Compression**.
* Supports **Quantization** and **Model Compression**.
* Supports multiple devices at the same time using **Hetero Device**.
It is basically a TensorRT / Olive competitor that works with any hardware.
# Installation
## Preparations
## Installation
### Preparations
- Install the drivers for your device.
- Install `git` and `python`.
- Open CMD in a folder you want to install SD.Next.
Note: Do not mix OpenVINO with your old install. Treat OpenVINO as a seperate backend.
## Using SD.Next with OpenVINO
### Using SD.Next with OpenVINO
Install SD.Next from Github:
```
```shell
git clone https://github.com/vladmandic/automatic
```
Then enter into the automatic folder:
```
```shell
cd automatic
```
Then start WebUI with this command:
Then start WebUI with this command:
Windows:
```
```shell
.\webui.bat --use-openvino
```
Linux:
```
```shell
./webui.sh --use-openvino
```
# More Info
## More Info
## Limitations
- Same limitations with TensorRT / Olive applies here too.
- Compilation takes a few minutes and any change to Resolution / Batch Size / LoRa will trigger recompilation.
- Attention Slicing and HyperTile will not work.
- OpenVINO will lock you in the Diffusers backend.
- Only ESRGAN upscalers can work with OpenVINO.
Enable Upscaler on compile settings if you want to use OpenVINO with Upscalers.
### Limitations
- Same limitations with TensorRT / Olive applies here too.
- Compilation takes a few minutes and any change to Resolution / Batch Size / LoRa will trigger recompilation.
- Attention Slicing and HyperTile will not work.
- OpenVINO will lock you in the Diffusers backend.
- Only ESRGAN upscalers can work with OpenVINO.
Enable Upscaler on compile settings if you want to use OpenVINO with Upscalers.
### Quantization
## Quantization
Quantization enables 8 bit support without autocast.
Enable `OpenVINO Quantize Models with NNCF` option in Compute Settings to use it.
Note: Quantization has noticeable quality impact and generally not recommended.
## Model Compression
Enable `Compress Model weights with NNCF` option in Compute Settings to use it.
Select a 4 bit mode from `OpenVINO compress mode for NNCF` to use 4 bit.
For GPUs; select both CPU and GPU from the device selection if you want to use GPU with Model Compression.
@@ -68,18 +77,15 @@ For GPUs; select both CPU and GPU from the device selection if you want to use G
Note: VAE will be compressed to INT8 if you use a 4 bit mode.
## Custom Devices
Use the `OpenVINO devices to use` option in `Compute Settings` if you want to specify a device.
Selecting multiple devices will use multiple devices as a single `HETERO` device.
Using `--device-id` cli argument with the WebUI will use a **GPU** with the specified **Device ID**.
Using `--use-cpu openvino` cli argument with the WebUI will use the **CPU**.
Using `--device-id` cli argument with the WebUI will use a **GPU** with the specified **Device ID**.
Using `--use-cpu openvino` cli argument with the WebUI will use the **CPU**.
## Model Caching
OpenVINO will save compiled models to cache folder so you won't have to compile them again.
`OpenVINO disable model caching` option in **Compute Settings** will disable caching.
`Directory for OpenVINO cache` option in **System Paths** will set a new location for saving OpenVINO caches.
OpenVINO will save compiled models to cache folder so you won't have to compile them again.
`OpenVINO disable model caching` option in **Compute Settings** will disable caching.
`Directory for OpenVINO cache` option in **System Paths** will set a new location for saving OpenVINO caches.
+6 -4
@@ -1,3 +1,5 @@
# Performance Tuning
## Introduction
Hi folks, it's your (moderately) friendly neighborhood Aptronym here!
@@ -6,7 +8,7 @@ People are always asking me how to get the most **it/s** out of their GPUs, now.
That's not even counting the complicated selection of inference platforms SDNext has available, everything from plain everyday CUDA to Onnxruntime/Olive, and now ZLUDA, as well as our two built-in backends, Original and Diffusers.
I can't promise you'll be able to use all of these options, I can't promise they won't crash your instance (or be buggy for that matter), that's going to vary wildly from GPU, OS, RAM, VRAM, current chosen inference platform, and backend, and some of these options will not work together, or at all, on some platforms. You will have to test that yourselves, but we are hoping to build a matrix of sorts showing what is available and what works with what, but that's going to take some user testing and feedback.
I can't promise you'll be able to use all of these options, I can't promise they won't crash your instance (or be buggy for that matter), that's going to vary wildly from GPU, OS, RAM, VRAM, current chosen inference platform, and backend, and some of these options will not work together, or at all, on some platforms. You will have to test that yourselves, but we are hoping to build a matrix of sorts showing what is available and what works with what, but that's going to take some user testing and feedback.
If you help us by providing feedback (issues w/logs, screenshots, etc.), which we never have enough of, we will do our best to correct what we can and ensure that the experience of using SDNext is as optimized as it can be. Some limitations we won't be able to overcome purely do to things beyond our control, such as conflicts caused by the nature of the inference platform.
@@ -18,9 +20,9 @@ Let's start with the simplest thing, your chosen backend. I know there are some
So let me put that to rest once and for all:
**You need to be using Diffusers**
**You need to be using Diffusers**
It is not only now the default on installation, it is faster and better with your precious VRAM usage, as well as being the only backend where future enhancements and features will take place. Wean yourself off of Original, as you are missing out on a lot of functionality, scripts, and features. I know you may have some precious extension that only works in Original, but we have a lot built in now that you may not have noticed.
It is not only now the default on installation, it is faster and better with your precious VRAM usage, as well as being the only backend where future enhancements and features will take place. Wean yourself off of Original, as you are missing out on a lot of functionality, scripts, and features. I know you may have some precious extension that only works in Original, but we have a lot built in now that you may not have noticed.
If the extension is so important to have, then pop by on discord and let me know what it is and explain why. We've added features for less, so if it's a good thing to include, or if we can't already do it to some degree, we'll take a look at it and consider it fairly. If you can't present a good use case, your chances are lower (visual aids help too).
@@ -123,7 +125,7 @@ You may of course screw with the `swap size` and `UNet depth` as you like, I did
### Other settings
Parallel process images in batch is intended for img2img batch mode.
Parallel process images in batch is intended for img2img batch mode.
If you set batch size=n, typically it generates n images for each input, with this setting, it will generate 1 image for each input, but process n in parallel.
![CopyQ IARldt](https://github.com/vladmandic/automatic/assets/108482020/dda83a13-a831-4a92-afed-c94a94ae7e0a)
-18
@@ -1,18 +0,0 @@
# Process/Visual query
Visual query subsection of the Process tab contains tools to use Visual Question Answering interrogation of images using Vision Language Models.
Currently supported models:
* Moondream 2
* GiT Textcaps
* GIT VQA
* Base
* Large
* Blip
* Base
* Large
* ViLT Base
* Pix Textcaps
* MS Florence 2
* Base
* Large
+2
@@ -1,3 +1,5 @@
# Prompt Tips
## Params
TL;DR: Tweak **steps**, **cfg scale** and **sampler** as results will vary depending on combination of all three
-20
@@ -1,20 +0,0 @@
# Python 3.12 Experimental support
Highly experimental, do not use!
Supported versions of Python are 3.9, 3.10 and 3.11
Majority of development is done using 3.11
Anyhow, if you still want to test it:
## Run
1. Initially, start with `--ignore` to bypass python version check
2. After initial install, start with `--ignore --experimental` to allow version-mismatched packages
## Limitations
- CodeFormer, GFPgan and RealEsrgan depend on `basicsr` and `lmdb` which are no longer updated
- **ONNX/Olive**, **IPEX** and **OpenVINO** compute engines are not available for 3.12
- **TensorFlow** is not available for python 3.12
so anything that requires it will fail to function
but that's not any of the core functionalities
+2
@@ -1,3 +1,5 @@
# ROCm Support
This guide will walk you through building rocBLAS using the official ROCm documentation.
This guide is for users with AMD GPUs lacking official ROCm/[HIP SDK](https://www.amd.com/en/developer/resources/rocm-hub/hip-sdk.html) support, or those wanting to enable HIP SDK support for hip sdk 5.7 and 6.1.2 on Windows for integrated AMD GPUs(iGPUs)."
+4 -1
@@ -1,4 +1,7 @@
# ROCm on Ubuntu
## Install Guide for Ubuntu 22.04
```
sudo apt update
wget https://repo.radeon.com/amdgpu-install/5.7/ubuntu/jammy/amdgpu-install_5.7.50700-1_all.deb
@@ -9,4 +12,4 @@ sudo usermod -a -G render,video $LOGNAME
## Install Guide for Ubuntu 20.04
Simply change the wget line from "jammy" to "focal" if using Ubuntu 20.04.
Simply change the wget line from "jammy" to "focal" if using Ubuntu 20.04.
+20 -13
@@ -1,21 +1,25 @@
# ROCm HIP SDK Windows Support
This is a guide to build rocBLAS based on the ROCm Official Documentations.
You may have an AMD GPU without official support on ROCm [HIP SDK](https://www.amd.com/en/developer/resources/rocm-hub/hip-sdk.html)
OR if you are using integrated AMD GPU (iGPU), and want it to be supported by HIP SDK on Windows.
You may follow the guide below to build your rocBLAS.
# If you do not need to build ROCmLibs or already have the library, please skip this.
*If you do not need to build ROCmLibs or already have the library, please skip this.*
Make sure you have the following software available on your PC. Otherwise, you may fail to build the ROCmLibs:
1. Visual Studio 2022
2. Python
3. Strawberry Perl
4. CMake
5. Git
6. HIP SDK (Mentioned in the first step)
7. Download [rocBLAS](https://github.com/ROCm/rocBLAS) and [Tensile](https://github.com/ROCm/Tensile) (Download Tensile 4.38.0 for ROCm 5.7.0 (latest) on Windows)
1. Visual Studio 2022
2. Python
3. Strawberry Perl
4. CMake
5. Git
6. HIP SDK (Mentioned in the first step)
7. Download [rocBLAS](https://github.com/ROCm/rocBLAS) and [Tensile](https://github.com/ROCm/Tensile) (Download Tensile 4.38.0 for ROCm 5.7.0 (latest) on Windows)
Edit line 41 in file rdeps.py for rocBLAS. The old repo has an outdated vckpg, which will lead to failed build. Update the vcpkg by entering the following line in the terminal:
```
```shell
git clone -b 2024.02.14 https://github.com/microsoft/vcpkg
```
@@ -24,21 +28,24 @@ Download `Tensile 4.38.0` from the release page.
Download [Tensile-fix-fallback-arch-build.patch](https://github.com/likelovewant/ROCmLibs-for-gfx1103-AMD780M-APU-/blob/main/Tensile-fix-fallback-arch-build.patch), and place in the `Tensile` folder. In this example, the path is: `C:\ROCm\Tensile-rocm-5.7.0`.
Enter the following line in the terminal opened in `Tensile-rocm-5.7.0`:
```
```shell
git apply Tensile-fix-fallback-arch-build.patch
```
if your vckpkg version is built later than April, 2023, please replace the `CMakeLists.txt` in `Tensile/tree/develop/Tensile/Source/lib/CMakeLists.txt` with this [CMakeLists.txt](https://github.com/ROCm/Tensile/tree/develop/Tensile/Source/lib/CMakeLists.txt), and put in same folder. (For more information, please access [ROCm Official Guide](https://rocmdocs.amd.com/projects/rocBLAS/en/latest/install/Windows_Install_Guide.html#windows-install))
In `C:\ROCm\rocBLAS-rocm-5.7.0`, run:
```
```shell
python rdeps.py
```
If you encounter any mistake, try to Google and fix it or try it again. Use `install.sh -d` in Linux.
Once done, run:
```
```shell
python rmake.py -a "gfx906;gfx1012" --lazy-library-loading --no-merge-architectures -t "C:\ROCm\Tensile-rocm-5.7.0"
```
@@ -48,4 +55,4 @@ Upon successful compilation, rocblas.dll will be generated. In this example, the
To compile HIP SDK programs that use hipBLAS/rocBLAS, you need to replace the rocblas.dll file in the SDK with the one that you have just made yourself. Then, place `rocblas.dll `into `C:\Program Files\AMD\ROCm\5.7\bin` and the Tensile data files into `C:\Program Files\AMD\ROCm\5.7\bin\rocblas\library`.
Your programs should run smooth as silk on the designated graphics card now.
Your programs should run smooth as silk on the designated graphics card now.
-2
@@ -1,2 +0,0 @@
# This file is used to list sources of information used elsewhere and its intended to be a lookup/reference page only
+1 -1
@@ -1,4 +1,4 @@
## Stable Diffusion Pipeline
# Stable Diffusion Pipeline
This is probably the best end-to-end semi-technical article:
<https://stable-diffusion-art.com/how-stable-diffusion-work/>
+1 -1
@@ -1,4 +1,4 @@
# stable diffusion training methods
# StableDiffusion Training Methods
## fine-tuning
+2
@@ -1,3 +1,5 @@
# StableDiffusion-XL
## Downloading SD-XL
You can simply download these two files from Huggingface and place them into your normal checkpoint directory, though we recommend a subfolder.
+2
@@ -64,6 +64,7 @@
## To be added:
### Main Pages (most important ones):
- Installation page with all the installation methods for all platforms and hardware. (**FILE READY, AWAITING MIGRATION INTO WIKI**)
- Feature page with all features as subpages. (**BUSY**)
- Models page with all the links to the model explanations.
@@ -98,6 +99,7 @@
- CLI Arguments.
### Explanations that still needs a category or are not figured out (for the people who know what it is, does and if its needed in the wiki)
- MS Florence
- Deterministic mode
- IP adapter (**DONE**)
-322
@@ -1,322 +0,0 @@
# CUDA
Install latest version of **CUDA** that matches major version of your **PyTorch**
For example, CUDA 11.8 can be used with PyTorch compiled for CUDA 11.7, but CUDA 12.0 *cannot*
- <https://developer.nvidia.com/cuda-downloads>
Install latest version of **cuDNN** compatible with chosen CUDA version
- <https://developer.nvidia.com/rdp/cudnn-download>
Currently best options are **CUDA 11.8** with **cuDNN 8.7**
Note that **CUDA 12** is not yet supported by PyTorch
## PyTorch
*Note*: Uninstall `torch` and `triton` before attempting any new installs
> pip uninstall torch torchvision torchaudio triton -y
### Stable
**PyTorch 2.0.0** compiled with **CUDA 11.8**:
> pip install torch torchaudio torchvision triton --force --extra-index-url https://download.pytorch.org/whl/cu118
> pip show torch
> 2.0.0
### Nightly
**PyTorch 2.1-nightly** compiled with **CUDA 12.1**:
> pip install --pre torch triton torchvision torchaudio --force --extra-index-url https://download.pytorch.org/whl/nightly/cu121
> pip show torch
> 2.1.0.dev20230305+cu118
### From source
Read <https://github.com/pytorch/pytorch#from-source>
Note: **PyTorch** heavily relies on **Anaconda** for its build process
### Monkey-patching
Torch comes with its own version of `cuDNN` which is great for simplicity,
but not so great if your performance is 50% of what's expected
First make sure that your `cuDNN` is installed correctly and in `ldconfig` can find it
Then, remove `cuDNN` from `torch` package:
> rm ~/.local/lib/python3.10/site-packages/torch/lib/libcudnn*
Now check if correct `cuDNN` libraries are found
> sudo ldconfig
> ldconfig -p | grep cudnn
And if not, modify `LD_LIBRARY_PATH` to include `cuDNN` libraries and repeat `ldconfig` command
> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
## SDP cross-attention optimization
Recommended if you are using **PyTorch 2.0**
## Xformers cross-attention optimization
`xformers` is a library of optimized attention kernels for PyTorch
Highly recommended for significant performance boost when using `Pytorch` **1.x**
Not required when using `Pytorch` **2.0**
### xFormers Stable
When using release version of **PyTorch 1.13.1**, simply install `xformers` from `PyPI`:
> pip install -U xformers
### xFormers From Source
Otherwise, build process takes a bit longer...
Set your environment so `xformers` can be optimized for *your* GPU
> python -c 'import torch; print(torch.cuda.get_device_capability())'
> (8, 6)
> export TORCH_CUDA_ARCH_LIST="8.6"
Rebuild `xformers`
> sudo apt install pybind11-dev
> pip install ninja setuptools pybind11
> pip install -v -U git+https://github.com/facebookresearch/xformers.git@main#egg=xformers
This will compile `xformers` for your system which is preferred over using pre-built wheel
Check functionality using:
> python -m xformers.info
Make sure that all fields marked with `memory_efficient` are set to `available`
## Triton
### Triton Stable
There are separate `torchtriton` and `triton` packages as well as different sources for `triton`
To avoid confusion, uninstall any existing `triton` packages before installing `torch` and install `triton` in the same install command as `torch`
### Triton From Source
Default version of `triton` package is good-enough for a fully functional system
unless you want to further experiment with torch `dynamo` just-in-time compiler,
in which case you may need to build & install <https://github.com/openai/triton> package from source
## Accelerate
Recommended to run in **FP16** mode with **Dynamo** accelerators
But...**Dynamo** is only supported with **Torch 2.0**!
Otherwise, run without **Dynamo**
> pip install accelerate
> accelerate config
In which compute environment are you running? This machine
Which type of machine are you using? No distributed training
Do you want to run your training on CPU only (even if a GPU is available)? [yes/NO]: no
Do you wish to optimize your script with torch dynamo?[yes/NO]: yes
Which dynamo backend would you like to use? inductor <- only if using torch 2.0+, otherwise no
Do you want to use DeepSpeed? [yes/NO]: no
What GPU(s) (by id) should be used for training on this machine as a comma-seperated list? [all]: all
Do you wish to use FP16 or BF16 (mixed precision)? fp16
> accelerate test
## Python
PyTorch is **NOT** compatible with Python 3.11, use 3.10 instead
Just install as usual, but also possible to build from sources
### Build
You can install `python` itself from sources
Download from <https://www.python.org/downloads/source/>
Configure:
> export CFLAGS="-march=native -O3 -pipe -Wno-unused-value -Wno-empty-body -DNDEBUG"
> ./configure --prefix /usr --enable-optimizations --with-lto --enable-loadable-sqlite-extensions
> time make -j32
Check:
> ./python --version
> ./python -c 'import sysconfig; print(sysconfig.get_config_var("PY_CFLAGS"))'
Do side-by-side install:
> sudo make altinstall
> sudo update-alternatives --install /bin/python3 python3 /bin/python3.11 100
> sudo update-alternatives --list python3
Switch to new `python`:
> sudo update-alternatives --config python3
> python -m pip install --upgrade pip
> python -m pip uninstall torch torchaudio triton pytorch_triton -y
> python -m pip install --pre torch triton torchaudio torchvision --extra-index-url https://download.pytorch.org/whl/nightly/cu118 --force
> python -c 'import torch; print(torch.__path__, torch.__version__)'
## nVidia CUDA
### Windows WSL2
Requirements:
- Latest versions of Windows: not included in RTM
Note: Insider builds are no longer required as CUDA support is present in Beta builds
- Updated WSL kernel: `wsl --update`, minimum **4.19.121** recommended **5.15.74**
- Updated nVidia drivers: minimum **460** recommended **510**
Links:
- [nVidia install docs](https://docs.nvidia.com/cuda/wsl-user-guide/index.html)
- [Ubuntu install docs](https://ubuntu.com/blog/getting-started-with-cuda-on-ubuntu-on-wsl-2)
- [CUDA download](https://developer.nvidia.com/cuda-downloads)
### Install
Install both `CUDA` and `cuDNN`
- Note: Do not install drivers if running in VM, let host drivers be as-is
Driver can be higher than runtime, but not opposite
- Example: driver 510 supports Cuda 12 and is compatible with Cuda 11.6)
Install using either:
- Add nVidia repository and install using `apt`
- Download installer and install manually
### Check
Is CUDA detected and versions:
> apt list cuda*
List is long, but minimum packages are:
cuda/now 11.6.1-1
cuda-11-6/now 11.6.1-1
cuda-cccl-11-6/now 11.6.55-1
cuda-command-line-tools-11-6/now 11.6.1-1
cuda-compiler-11-6/now 11.6.1-1
cuda-cudart-11-6/now 11.6.55-1
cuda-cupti-11-6/now 11.6.112-1
cuda-libraries-11-6/now 11.6.1-1
cuda-nvcc-11-6/now 11.6.112-1
cuda-runtime-11-6/now 11.6.1-1
cuda-toolkit-11-6/now 11.6.1-1
cuda-tools-11-6/now 11.6.1-1
> apt list libcudnn*
libcudnn8/now 8.3.2.44-1+cuda11.5
> nvidia-smi
NVIDIA-SMI 510.85.02 Driver Version: 526.98 CUDA Version: 12.0
> head /usr/local/cuda/version.json
"cuda" : {
"name" : "CUDA SDK",
"version" : "11.6.1"
},
### NVCC
Test:
> git clone https://github.com/NVIDIA/cuda-samples
Edit `Makefile` as needed to specify compute level and run `make`
> Samples/1_Utilities/deviceQuery
Device 0: "NVIDIA GeForce RTX 3060"
CUDA Driver Version / Runtime Version 12.0 / 11.6
CUDA Capability Major/Minor version number: 8.6
Total amount of global memory: 12288 MBytes (12884377600 bytes)
(028) Multiprocessors, (128) CUDA Cores/MP: 3584 CUDA Cores
GPU Max Clock rate: 1777 MHz (1.78 GHz)
Memory Clock rate: 7501 Mhz
Memory Bus Width: 192-bit
...
## Stable Diffusion
Stable-Diffusion requires `CUDA` level **SM86** so version older than 11 are insufficient
## TensorFlow
Install:
> pip3 install tensorflow
Tensorflow dynamically links to CUDA libraries, so as long as major version matches, it should work (e.g. Tensorflow 2.10 uses CUDA 11.x).
But mixing different major versions between Tensorflow and CUDA does not work
Check:
> wget https://raw.githubusercontent.com/vladmandic/tfjs-utils/main/src/tfinfo.py
> python src/tfinfo.py
sysconfig: [
('cpu_compiler', '/dt9/usr/bin/gcc'),
('cuda_compute_capabilities', ['sm_35', 'sm_50', 'sm_60', 'sm_70', 'sm_75', 'compute_80']),
('cuda_version', '11.2'),
('cudnn_version', '8'),
('is_cuda_build', True),
('is_rocm_build', False),
('is_tensorrt_build', True)
]
gpu device: PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU') {
'compute_capability': (8, 6),
'device_name': 'NVIDIA GeForce RTX 3060'
}
logical device: LogicalDevice(name='/device:GPU:0', device_type='GPU')
## PyTorch
Install **PyTorch** linked to *exact* major/minor version of **CUDA**:
> pip3 uninstall torch torchvision torchaudio
> pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
Note that `cu116` at the end refers to `CUDA` **11.6** which should match `CUDA` installation on your system
Check:
> wget https://raw.githubusercontent.com/vladmandic/tfjs-utils/main/src/torchinfo.py
> python torchinfo.py
torch version: 1.12.1+cu116
cuda available: True
cuda version: 11.6
cuda arch list: ['sm_37', 'sm_50', 'sm_60', 'sm_70', 'sm_75', 'sm_80', 'sm_86']
device: NVIDIA GeForce RTX 3060
## XFormers
Download
> git clone https://github.com/facebookresearch/xformers.git
> cd xformers
> git submodule update --init --recursive
Compile
> export FORCE_CUDA="1"
> export TORCH_CUDA_ARCH_LIST=8.6
> pip install ninja pyre-extensions einops
> python setup.py build develop
> python setup.py bdist_wheel
Install
> pip install dist/*
> python -m xformers.info
+1 -1
@@ -1,4 +1,4 @@
# Common Issues
# Troubleshooting Common Issues
If you're having issues with SD.Next, please follow these steps designed to help weed out known issues first.
All users should do Steps #1 and #2 regardless of having a problem or not.
+2
@@ -1,3 +1,5 @@
# LCM: Latent Consistency Model
LCM (Latent Consistency Model) is a new feature that provides support for SD 1.5 and SD-XL models.
## Installation
+4 -2
@@ -1,13 +1,15 @@
# ZLUDA Support
ZLUDA (CUDA Wrapper) for AMD GPUs in Windows
### Warning
## Warning
ZLUDA does not fully support PyTorch in its official build. So ZLUDA support is so tricky and unstable. Support is limited at this time.
Please don't create issues regarding ZLUDA on GitHub. Feel free to reach out via the ZLUDA thread in the help channel on discord.
## Installing ZLUDA for AMD GPUs in Windows.
#### Note
### Note
_This guide assumes you have [Git and Python](https://github.com/vladmandic/automatic/wiki/Installation#install-python-and-git) installed, and are comfortable using the command prompt, navigating Windows Explorer, renaming files and folders, and working with zip files._