Spaces:
Running
on
Zero
Running
on
Zero
prithivMLmods
commited on
Commit
•
919cb42
1
Parent(s):
cb06874
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
|
|
2 |
import spaces
|
3 |
import numpy as np
|
4 |
import random
|
5 |
-
from diffusers import DiffusionPipeline
|
6 |
import torch
|
7 |
from PIL import Image
|
8 |
|
@@ -11,11 +11,26 @@ model_repo_id = "stabilityai/stable-diffusion-3.5-large-turbo"
|
|
11 |
|
12 |
torch_dtype = torch.bfloat16 if torch.cuda.is_available() else torch.float32
|
13 |
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
pipe.load_lora_weights("prithivMLmods/SD3.5-Large-Turbo-HyperRealistic-LoRA", weight_name="SD3.5-4Step-Large-Turbo-HyperRealistic-LoRA.safetensors")
|
18 |
-
trigger_word = "hyper realistic"
|
19 |
pipe.fuse_lora(lora_scale=1.0)
|
20 |
|
21 |
MAX_SEED = np.iinfo(np.int32).max
|
@@ -231,4 +246,4 @@ with gr.Blocks(css=css, theme="prithivMLmods/Minecraft-Theme") as demo:
|
|
231 |
)
|
232 |
|
233 |
if __name__ == "__main__":
|
234 |
-
demo.launch()
|
|
|
2 |
import spaces
|
3 |
import numpy as np
|
4 |
import random
|
5 |
+
from diffusers import DiffusionPipeline, AutoencoderTiny
|
6 |
import torch
|
7 |
from PIL import Image
|
8 |
|
|
|
11 |
|
12 |
torch_dtype = torch.bfloat16 if torch.cuda.is_available() else torch.float32
|
13 |
|
14 |
+
# Load Tiny Autoencoder and optimize its decoder layers with torch.compile
|
15 |
+
taesd3 = (
|
16 |
+
AutoencoderTiny.from_pretrained("madebyollin/taesd3", torch_dtype=torch.float16)
|
17 |
+
.half()
|
18 |
+
.eval()
|
19 |
+
.requires_grad_(False)
|
20 |
+
.to(device)
|
21 |
+
)
|
22 |
+
taesd3.decoder.layers = torch.compile(
|
23 |
+
taesd3.decoder.layers,
|
24 |
+
fullgraph=True,
|
25 |
+
dynamic=False,
|
26 |
+
mode="max-autotune-no-cudagraphs",
|
27 |
+
)
|
28 |
+
|
29 |
+
# Load main Stable Diffusion pipeline with Tiny Autoencoder
|
30 |
+
pipe = DiffusionPipeline.from_pretrained(model_repo_id, torch_dtype=torch_dtype, vae=taesd3).to(device)
|
31 |
|
32 |
pipe.load_lora_weights("prithivMLmods/SD3.5-Large-Turbo-HyperRealistic-LoRA", weight_name="SD3.5-4Step-Large-Turbo-HyperRealistic-LoRA.safetensors")
|
33 |
+
trigger_word = "hyper realistic"
|
34 |
pipe.fuse_lora(lora_scale=1.0)
|
35 |
|
36 |
MAX_SEED = np.iinfo(np.int32).max
|
|
|
246 |
)
|
247 |
|
248 |
if __name__ == "__main__":
|
249 |
+
demo.launch()
|