Spaces:
Running
on
Zero
Running
on
Zero
Fabrice-TIERCELIN
commited on
Commit
•
239bfe9
1
Parent(s):
432fb76
Adapt the GitHub project to HuggingFace
Browse files
README.md
CHANGED
@@ -1,157 +1,11 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
---
|
13 |
-
#### ⚠ Due to the large RAM (60G) and VRAM (30G x2) costs of SUPIR, we are working on the online demo releasing.
|
14 |
-
|
15 |
-
---
|
16 |
-
## 🔧 Dependencies and Installation
|
17 |
-
|
18 |
-
1. Clone repo
|
19 |
-
```bash
|
20 |
-
git clone https://github.com/Fanghua-Yu/SUPIR.git
|
21 |
-
cd SUPIR
|
22 |
-
```
|
23 |
-
|
24 |
-
2. Install dependent packages
|
25 |
-
```bash
|
26 |
-
conda create -n SUPIR python=3.8 -y
|
27 |
-
conda activate SUPIR
|
28 |
-
pip install --upgrade pip
|
29 |
-
pip install -r requirements.txt
|
30 |
-
```
|
31 |
-
|
32 |
-
3. Download Checkpoints
|
33 |
-
|
34 |
-
For users who can connect to huggingface, please setting `LLAVA_CLIP_PATH, SDXL_CLIP1_PATH, SDXL_CLIP2_CKPT_PTH` in `CKPT_PTH.py` as `None`. These CLIPs will be downloaded automatically.
|
35 |
-
|
36 |
-
#### Dependent Models
|
37 |
-
* [SDXL CLIP Encoder-1](https://huggingface.co/openai/clip-vit-large-patch14)
|
38 |
-
* [SDXL CLIP Encoder-2](https://huggingface.co/laion/CLIP-ViT-bigG-14-laion2B-39B-b160k)
|
39 |
-
* [SDXL base 1.0_0.9vae](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_base_1.0_0.9vae.safetensors)
|
40 |
-
* [LLaVA CLIP](https://huggingface.co/openai/clip-vit-large-patch14-336)
|
41 |
-
* [LLaVA v1.5 13B](https://huggingface.co/liuhaotian/llava-v1.5-13b)
|
42 |
-
* (optional) [Juggernaut-XL_v9_RunDiffusionPhoto_v2](https://huggingface.co/RunDiffusion/Juggernaut-XL-v9/blob/main/Juggernaut-XL_v9_RunDiffusionPhoto_v2.safetensors)
|
43 |
-
* Replacement of `SDXL base 1.0_0.9vae` for Photo Realistic
|
44 |
-
* (optional) [Juggernaut_RunDiffusionPhoto2_Lightning_4Steps](https://huggingface.co/RunDiffusion/Juggernaut-XL-Lightning/blob/main/Juggernaut_RunDiffusionPhoto2_Lightning_4Steps.safetensors)
|
45 |
-
* Distilling model used in `SUPIR_v0_Juggernautv9_lightning.yaml`
|
46 |
-
|
47 |
-
|
48 |
-
#### Models we provided:
|
49 |
-
* `SUPIR-v0Q`: [Baidu Netdisk](https://pan.baidu.com/s/1lnefCZhBTeDWijqbj1jIyw?pwd=pjq6), [Google Drive](https://drive.google.com/drive/folders/1yELzm5SvAi9e7kPcO_jPp2XkTs4vK6aR?usp=sharing)
|
50 |
-
|
51 |
-
Default training settings with paper. High generalization and high image quality in most cases.
|
52 |
-
|
53 |
-
* `SUPIR-v0F`: [Baidu Netdisk](https://pan.baidu.com/s/1AECN8NjiVuE3hvO8o-Ua6A?pwd=k2uz), [Google Drive](https://drive.google.com/drive/folders/1yELzm5SvAi9e7kPcO_jPp2XkTs4vK6aR?usp=sharing)
|
54 |
-
|
55 |
-
Training with light degradation settings. Stage1 encoder of `SUPIR-v0F` remains more details when facing light degradations.
|
56 |
-
|
57 |
-
4. Edit Custom Path for Checkpoints
|
58 |
-
```
|
59 |
-
* [CKPT_PTH.py] --> LLAVA_CLIP_PATH, LLAVA_MODEL_PATH, SDXL_CLIP1_PATH, SDXL_CLIP2_CACHE_DIR
|
60 |
-
* [options/SUPIR_v0.yaml] --> SDXL_CKPT, SUPIR_CKPT_Q, SUPIR_CKPT_F
|
61 |
-
```
|
62 |
-
---
|
63 |
-
|
64 |
-
## ⚡ Quick Inference
|
65 |
-
### Val Dataset
|
66 |
-
RealPhoto60: [Baidu Netdisk](https://pan.baidu.com/s/1CJKsPGtyfs8QEVCQ97voBA?pwd=aocg), [Google Drive](https://drive.google.com/drive/folders/1yELzm5SvAi9e7kPcO_jPp2XkTs4vK6aR?usp=sharing)
|
67 |
-
|
68 |
-
### Usage of SUPIR
|
69 |
-
```Shell
|
70 |
-
Usage:
|
71 |
-
-- python test.py [options]
|
72 |
-
-- python gradio_demo.py [interactive options]
|
73 |
-
|
74 |
-
--img_dir Input folder.
|
75 |
-
--save_dir Output folder.
|
76 |
-
--upscale Upsampling ratio of given inputs. Default: 1
|
77 |
-
--SUPIR_sign Model selection. Default: 'Q'; Options: ['F', 'Q']
|
78 |
-
--seed Random seed. Default: 1234
|
79 |
-
--min_size Minimum resolution of output images. Default: 1024
|
80 |
-
--edm_steps Numb of steps for EDM Sampling Scheduler. Default: 50
|
81 |
-
--s_stage1 Control Strength of Stage1. Default: -1 (negative means invalid)
|
82 |
-
--s_churn Original hy-param of EDM. Default: 5
|
83 |
-
--s_noise Original hy-param of EDM. Default: 1.003
|
84 |
-
--s_cfg Classifier-free guidance scale for prompts. Default: 7.5
|
85 |
-
--s_stage2 Control Strength of Stage2. Default: 1.0
|
86 |
-
--num_samples Number of samples for each input. Default: 1
|
87 |
-
--a_prompt Additive positive prompt for all inputs.
|
88 |
-
Default: 'Cinematic, High Contrast, highly detailed, taken using a Canon EOS R camera,
|
89 |
-
hyper detailed photo - realistic maximum detail, 32k, Color Grading, ultra HD, extreme
|
90 |
-
meticulous detailing, skin pore detailing, hyper sharpness, perfect without deformations.'
|
91 |
-
--n_prompt Fixed negative prompt for all inputs.
|
92 |
-
Default: 'painting, oil painting, illustration, drawing, art, sketch, oil painting,
|
93 |
-
cartoon, CG Style, 3D render, unreal engine, blurring, dirty, messy, worst quality,
|
94 |
-
low quality, frames, watermark, signature, jpeg artifacts, deformed, lowres, over-smooth'
|
95 |
-
--color_fix_type Color Fixing Type. Default: 'Wavelet'; Options: ['None', 'AdaIn', 'Wavelet']
|
96 |
-
--linear_CFG Linearly (with sigma) increase CFG from 'spt_linear_CFG' to s_cfg. Default: False
|
97 |
-
--linear_s_stage2 Linearly (with sigma) increase s_stage2 from 'spt_linear_s_stage2' to s_stage2. Default: False
|
98 |
-
--spt_linear_CFG Start point of linearly increasing CFG. Default: 1.0
|
99 |
-
--spt_linear_s_stage2 Start point of linearly increasing s_stage2. Default: 0.0
|
100 |
-
--ae_dtype Inference data type of AutoEncoder. Default: 'bf16'; Options: ['fp32', 'bf16']
|
101 |
-
--diff_dtype Inference data type of Diffusion. Default: 'fp16'; Options: ['fp32', 'fp16', 'bf16']
|
102 |
-
```
|
103 |
-
|
104 |
-
### Python Script
|
105 |
-
```Shell
|
106 |
-
# Seek for best quality for most cases
|
107 |
-
CUDA_VISIBLE_DEVICES=0,1 python test.py --img_dir '/opt/data/private/LV_Dataset/DiffGLV-Test-All/RealPhoto60/LQ' --save_dir ./results-Q --SUPIR_sign Q --upscale 2
|
108 |
-
# for light degradation and high fidelity
|
109 |
-
CUDA_VISIBLE_DEVICES=0,1 python test.py --img_dir '/opt/data/private/LV_Dataset/DiffGLV-Test-All/RealPhoto60/LQ' --save_dir ./results-F --SUPIR_sign F --upscale 2 --s_cfg 4.0 --linear_CFG
|
110 |
-
```
|
111 |
-
|
112 |
-
### Gradio Demo
|
113 |
-
```Shell
|
114 |
-
CUDA_VISIBLE_DEVICES=0,1 python gradio_demo.py --ip 0.0.0.0 --port 6688 --use_image_slider --log_history
|
115 |
-
|
116 |
-
# Juggernaut_RunDiffusionPhoto2_Lightning_4Steps and DPM++ M2 SDE Karras for fast sampling
|
117 |
-
CUDA_VISIBLE_DEVICES=0,1 python gradio_demo.py --ip 0.0.0.0 --port 6688 --use_image_slider --log_history --opt options/SUPIR_v0_Juggernautv9_lightning.yaml
|
118 |
-
|
119 |
-
# less VRAM & slower (12G for Diffusion, 16G for LLaVA)
|
120 |
-
CUDA_VISIBLE_DEVICES=0,1 python gradio_demo.py --ip 0.0.0.0 --port 6688 --use_image_slider --log_history --loading_half_params --use_tile_vae --load_8bit_llava
|
121 |
-
```
|
122 |
-
<p align="center">
|
123 |
-
<img src="assets/DemoGuide.png">
|
124 |
-
</p>
|
125 |
-
|
126 |
-
|
127 |
-
### Online Demo (Coming Soon)
|
128 |
-
|
129 |
-
|
130 |
-
---
|
131 |
-
|
132 |
-
## BibTeX
|
133 |
-
@misc{yu2024scaling,
|
134 |
-
title={Scaling Up to Excellence: Practicing Model Scaling for Photo-Realistic Image Restoration In the Wild},
|
135 |
-
author={Fanghua Yu and Jinjin Gu and Zheyuan Li and Jinfan Hu and Xiangtao Kong and Xintao Wang and Jingwen He and Yu Qiao and Chao Dong},
|
136 |
-
year={2024},
|
137 |
-
eprint={2401.13627},
|
138 |
-
archivePrefix={arXiv},
|
139 |
-
primaryClass={cs.CV}
|
140 |
-
}
|
141 |
-
|
142 |
-
---
|
143 |
-
|
144 |
-
## 📧 Contact
|
145 |
-
If you have any question, please email `fanghuayu96@gmail.com`.
|
146 |
-
|
147 |
-
---
|
148 |
-
## Non-Commercial Use Only Declaration
|
149 |
-
The SUPIR ("Software") is made available for use, reproduction, and distribution strictly for non-commercial purposes. For the purposes of this declaration, "non-commercial" is defined as not primarily intended for or directed towards commercial advantage or monetary compensation.
|
150 |
-
|
151 |
-
By using, reproducing, or distributing the Software, you agree to abide by this restriction and not to use the Software for any commercial purposes without obtaining prior written permission from Dr. Jinjin Gu.
|
152 |
-
|
153 |
-
This declaration does not in any way limit the rights under any open source license that may apply to the Software; it solely adds a condition that the Software shall not be used for commercial purposes.
|
154 |
-
|
155 |
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
156 |
-
|
157 |
-
For inquiries or to obtain permission for commercial use, please contact Dr. Jinjin Gu (hellojasongt@gmail.com).
|
|
|
1 |
+
---
|
2 |
+
title: SUPIR
|
3 |
+
sdk: gradio
|
4 |
+
emoji: 🐨
|
5 |
+
sdk_version: 4.26.0
|
6 |
+
app_file: gradio_demo.py
|
7 |
+
license: mit
|
8 |
+
colorFrom: blue
|
9 |
+
colorTo: pink
|
10 |
+
short_description: Upscales your image with prompt
|
11 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|