# StableSR for Stable Diffusion WebUI
Licensed under S-Lab License 1.0
[![CC BY-NC-SA 4.0][cc-by-nc-sa-shield]][cc-by-nc-sa]
Englishï½[ä¸æ](README_CN.md)
- StableSR is a competitive super-resolution method originally proposed by Jianyi Wang et al.
- This repository is a migration of the StableSR project to the Automatic1111 WebUI.
Relevant Links
> Click to view high-quality official examples!
- [Project Page](https://iceclear.github.io/projects/stablesr/)
- [Official Repository](https://github.com/IceClear/StableSR)
- [Paper on arXiv](https://arxiv.org/abs/2305.07015)
> If you find this project useful, please give me & Jianyi Wang a star! â
***
## Important Update
- 2023.07.01: We occasionally found that **proper negative prompts can significantly enhance the details of StableSR.**
- We use CFG Scale=7 with the following negative prompts: 3d, cartoon, anime, sketches, (worst quality:2), (low quality:2)
- Click [comparison1](https://imgsli.com/MTg5MjM1) to see the significant power of negative prompts.
- Postive prompts are not very useful, but it also helps. You can try (masterpiece:2), (best quality:2), (realistic:2),(very clear:2)
- With the above prompts, we are trying our best to approach close-source project GigaGAN's quality (while ours are still worse than their demo). Click [comparison2](https://imgsli.com/MTg5MzAx/) to see our current capability on 128x128->1024x1024 upscaling.
- 2023.06.30: We are happy to release a new SD 2.1 768 version of StableSR! (Thanks to Jianyi Wang)
- It produces similar amount of details, but with **significantly less artifacts** and **better color**.
- It supports the resolution of 768 * 768.
- To enjoy the new model:
- Use the SD 2.1 768 base model. It can be download from [HuggingFace](https://huggingface.co/stabilityai/stable-diffusion-2-1)
- The corresponding SR Module (~400MB): [Official Resource](https://huggingface.co/Iceclear/StableSR/blob/main/webui_768v_139.ckpt), [æçç¾åº¦ç½ç-æåç 8ju9](https://pan.baidu.com/s/17on7GA2RLvVzdDnBwA0N0g?pwd=8ju9)
- Now you can use a larger tile size in the Tiled Diffusion (96 * 96, the same as default settings), the speed can be slightly faster.
- Keep other things the same.
- Janyi Wang keeps trying to train more powerful SR modules suitable for AIGC images. These models will be tuned on SD2.1 768 or SDXL later.
***
## Features
1. **High-fidelity detailed image upscaling**:
- Being very detailed while keeping the face identity of your characters.
- Suitable for most images (Realistic or Anime, Photography or AIGC, SD 1.5 or Midjourney images...) [Official Examples](https://iceclear.github.io/projects/stablesr/)
2. **Less VRAM consumption**
- I remove the VRAM-expensive modules in the official implementation.
- The remaining model is much smaller than ControlNet Tile model and requires less VRAM.
- When combined with Tiled Diffusion & VAE, you can do 4k image super-resolution with limited VRAM (e.g., < 12 GB).
> Please be aware that sdp may lead to OOM for some unknown reasons. You may use xformers instead.
3. **Wavelet Color Fix**
- The official StableSR will significantly change the color of the generated image. The problem will be even more prominent when upscaling in tiles.
- I implement a powerful post-processing technique that effectively matches the color of the upscaled image to the original. See [Wavelet Color Fix Example](https://imgsli.com/MTgwNDg2/).
***
## Usage
### 1. Installation
⪠Method 1: Official Market
- Open Automatic1111 WebUI -> Click Tab "Extensions" -> Click Tab "Available" -> Find "StableSR" -> Click "Install"
⪠Method 2: URL Install
- Open Automatic1111 WebUI -> Click Tab "Extensions" -> Click Tab "Install from URL" -> type in https://github.com/pkuliyi2015/sd-webui-stablesr.git -> Click "Install"
![installation](https://github.com/pkuliyi2015/multidiffusion-img-demo/blob/master/installation.png?raw=true)
### 2. Download the main components
We currently has two versions. They have similar amount of details, but the 768 has less artifacts.
#### ð SD2.1 768 Version
- You MUST use the Stable Diffusion V2.1 768 **EMA** checkpoint (~5.21GB) from StabilityAI
- You can download it from [HuggingFace](https://huggingface.co/stabilityai/stable-diffusion-2-1)
- Put into stable-diffusion-webui/models/Stable-Diffusion/
- Download the extracted StableSR module
- [Official Resource](https://huggingface.co/Iceclear/StableSR/blob/main/webui_768v_139.ckpt)
- Put the StableSR module (~400MB) into your stable-diffusion-webui/extensions/sd-webui-stablesr/models/
****
#### SD2.1 512 Version (Sharper, but more artifacts)
- You MUST use the Stable Diffusion V2.1 512 **EMA** checkpoint (~5.21GB) from StabilityAI
- You can download it from [HuggingFace](https://huggingface.co/stabilityai/stable-diffusion-2-1-base)
- Put into stable-diffusion-webui/models/Stable-Diffusion/
- Download the extracted StableSR module
- Official resources: [HuggingFace](https://huggingface.co/Iceclear/StableSR/resolve/main/weibu_models.zip) (~1.2 G). Note that this is a zip file containing both the StableSR module and the VQVAE.
- My resources: <[GoogleDrive](https://drive.google.com/file/d/1tWjkZQhfj07sHDR4r9Ta5Fk4iMp1t3Qw/view?usp=sharing)> <[ç¾åº¦ç½ç-æåç aguq](https://pan.baidu.com/s/1Nq_6ciGgKnTu0W14QcKKWg?pwd=aguq)>
- Put the StableSR module (~400MB) into your stable-diffusion-webui/extensions/sd-webui-stablesr/models/
> While we use SD2.1 checkpoint, you can still upscale ANY image (even from SD1.5 or NSFW). Your image won't be censored and the output quality won't be affected.
### 3. Optional components
- Install [Tiled Diffusion & VAE]((https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111)) extension
- The original StableSR easily gets OOM for large images > 512.
- For better quality and less VRAM usage, we recommend Tiled Diffusion & VAE.
- Use the Official VQGAN VAE
- Official resources: See the link in 2.
- My resources: <[GoogleDrive](https://drive.google.com/file/d/1ARtDMia3_CbwNsGxxGcZ5UP75W4PeIEI/view?usp=share_link)> <[ç¾åº¦ç½ç-æåç 83u9](https://pan.baidu.com/s/1YCYmGBethR9JZ8-eypoIiQ?pwd=83u9)>
- Put the VQVAE (~700MB) into your stable-diffusion-webui/models/VAE
### 4. Extension Usage
- At the top of the WebUI, select the v2-1_512-ema-pruned checkpoint you downloaded.
- Switch to img2img tag. Find the "Scripts" dropdown at the bottom of the page.
- Select the StableSR script.
- Click the refresh button and select the StableSR checkpoint you have downloaded.
- Choose a scale factor.
- Euler a sampler is recommended. CFG Scale=7, Steps >= 20.
- While StableSR can work without any prompts, we recently found that negative prompts can significantly improve details. Example negative prompts: 3d, cartoon, anime, sketches, (worst quality:2), (low quality:2)
- Click to see [comparison] with/without pos/neg prompts(https://imgsli.com/MTg5MjM1)
- For output image size > 512, we recommend using Tiled Diffusion & VAE, otherwise, the image quality may not be ideal, and the VRAM usage will be huge.
- Here are the official Tiled Diffusion settings:
- Method = Mixture of Diffusers
- For StableSR 768 version, you can use Latent tile size = 96, Latent tile overlap = 48
- For StableSR 512 version, you can use Latent tile size = 64, Latent tile overlap = 32
- Latent tile batch size as large as possible before Out of Memory.
- Upscaler MUST be None (will not upscale here; instead, upscale in StableSR).
- The following figure shows the recommended settings for 24GB VRAM.
- For a 6GB device, **just change Tiled Diffusion Latent tile batch size to 1, Tiled VAE Encoder Tile Size to 1024, Decoder Tile Size to 128.**
- SDP attention optimization may lead to OOM. Please use xformers in that case.
- You DON'T need to change ot
没有合适的资源?快使用搜索试试~ 我知道了~
stable diffusion插件应用stablesr
共38个文件
sample:13个
py:7个
head:4个
需积分: 0 2 下载量 61 浏览量
2024-01-26
21:55:58
上传
评论
收藏 90KB RAR 举报
温馨提示
将插件考贝至:stable-diffusion-webui/extensions/,然后重启stable diffusion。
资源推荐
资源详情
资源评论
收起资源包目录
sd-webui-stablesr.rar (38个子文件)
sd-webui-stablesr
README_CN.md 11KB
tools
extract_srmodule.py 465B
extract_vaecfw.py 514B
LICENSE2 20KB
srmodule
colorfix.py 4KB
attn.py 4KB
struct_cond.py 11KB
spade.py 7KB
LICENSE 2KB
.git
index 1KB
HEAD 23B
refs
heads
master 41B
tags
remotes
origin
HEAD 32B
objects
pack
pack-48e55968bb322950811821499d47d0e2124548de.pack 42KB
pack-48e55968bb322950811821499d47d0e2124548de.idx 4KB
info
description 73B
packed-refs 114B
info
exclude 240B
logs
HEAD 198B
refs
heads
master 198B
remotes
origin
HEAD 198B
hooks
post-update.sample 189B
prepare-commit-msg.sample 1KB
commit-msg.sample 896B
pre-receive.sample 544B
update.sample 4KB
pre-commit.sample 2KB
pre-rebase.sample 5KB
applypatch-msg.sample 478B
fsmonitor-watchman.sample 5KB
push-to-checkout.sample 3KB
pre-applypatch.sample 424B
pre-push.sample 1KB
pre-merge-commit.sample 416B
config 277B
branches
.gitignore 64B
README.md 12KB
scripts
stablesr.py 12KB
共 38 条
- 1
资源评论
BBM的开源HUB
- 粉丝: 372
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功