Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import numpy as np
|
|
3 |
import random
|
4 |
|
5 |
import spaces #[uncomment to use ZeroGPU]
|
6 |
-
from diffusers import
|
7 |
import torch
|
8 |
|
9 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
@@ -15,6 +15,12 @@ else:
|
|
15 |
torch_dtype = torch.float32
|
16 |
|
17 |
pipe = DiffusionPipeline.from_pretrained(model_repo_id, torch_dtype=torch_dtype)
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
pipe = pipe.to(device)
|
19 |
|
20 |
MAX_SEED = np.iinfo(np.int32).max
|
|
|
3 |
import random
|
4 |
|
5 |
import spaces #[uncomment to use ZeroGPU]
|
6 |
+
from diffusers import StableDiffusionXLPipeline, EulerAncestralDiscreteScheduler
|
7 |
import torch
|
8 |
|
9 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
15 |
torch_dtype = torch.float32
|
16 |
|
17 |
pipe = DiffusionPipeline.from_pretrained(model_repo_id, torch_dtype=torch_dtype)
|
18 |
+
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
19 |
+
pipe.scheduler.register_to_config(
|
20 |
+
prediction_type="v_prediction",
|
21 |
+
rescale_betas_zero_snr=True,
|
22 |
+
)
|
23 |
+
pipe.enable_xformers_memory_efficient_attention()
|
24 |
pipe = pipe.to(device)
|
25 |
|
26 |
MAX_SEED = np.iinfo(np.int32).max
|