Rename x.py to SDXL.py
Browse files
SDXL.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# pip install invisible_watermark transformers accelerate safetensors
|
| 2 |
+
|
| 3 |
+
from diffusers import DiffusionPipeline
|
| 4 |
+
import torch
|
| 5 |
+
|
| 6 |
+
# git clone https://hf-mirror.com/stabilityai/stable-diffusion-xl-base-1.0
|
| 7 |
+
#
|
| 8 |
+
# wget -c https://hf-mirror.com/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0_0.9vae.safetensors
|
| 9 |
+
|
| 10 |
+
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, use_safetensors=True, variant="fp16")
|
| 11 |
+
pipe.to("cuda")
|
| 12 |
+
|
| 13 |
+
# 使用 torch >= 2.0 时,通过 torch.compile 可以将推理速度提高 20-30%。在运行管道之前,使用 torchcompile 简单地包装unet:
|
| 14 |
+
pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
|
| 15 |
+
|
| 16 |
+
# if using torch < 2.0
|
| 17 |
+
# pipe.enable_xformers_memory_efficient_attention()
|
| 18 |
+
|
| 19 |
+
prompt = "An astronaut riding a green horse"
|
| 20 |
+
|
| 21 |
+
images = pipe(prompt=prompt).images[0]
|
x.py
DELETED
|
@@ -1,15 +0,0 @@
|
|
| 1 |
-
NWkNwXwxXkbcKRwpRWKinbecNQwgeMXZTM
|
| 2 |
-
|
| 3 |
-
t5
|
| 4 |
-
https://hf-mirror.com/DeepFloyd/t5-v1_1-xxl
|
| 5 |
-
https://hf-mirror.com/DeepFloyd/t5-v1_1-xxl/resolve/main/pytorch_model-00001-of-00002.bin
|
| 6 |
-
https://hf-mirror.com/DeepFloyd/t5-v1_1-xxl/resolve/main/pytorch_model-00002-of-00002.bin
|
| 7 |
-
|
| 8 |
-
cascade
|
| 9 |
-
https://hf-mirror.com/stabilityai/stable-cascade
|
| 10 |
-
https://hf-mirror.com/stabilityai/stable-cascade-prior
|
| 11 |
-
|
| 12 |
-
xl
|
| 13 |
-
|
| 14 |
-
xl-lighting
|
| 15 |
-
https://hf-mirror.com/ByteDance/SDXL-Lightning
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|