Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -112,17 +112,18 @@ def apply_style(style_name: str, positive: str, negative: str = "") -> Tuple[str
|
|
112 |
def load_and_prepare_model(model_id):
|
113 |
model_dtypes = {"ford442/RealVisXL_V5.0_BF16": torch.bfloat16,}
|
114 |
dtype = model_dtypes.get(model_id, torch.bfloat16) # Default to float32 if not found
|
115 |
-
vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16", torch_dtype=torch.bfloat16,safety_checker=None)
|
116 |
pipe = StableDiffusionXLPipeline.from_pretrained(
|
117 |
model_id,
|
118 |
torch_dtype=torch.bfloat16,
|
119 |
add_watermarker=False,
|
120 |
use_safetensors=True,
|
121 |
vae=vae,
|
122 |
-
)
|
123 |
#pipe.to(device=device, dtype=torch.bfloat16)
|
124 |
-
|
125 |
-
sched = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config, beta_schedule="scaled_linear", algorithm_type="dpmsolver++")
|
|
|
126 |
#sched = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config, beta_schedule="linear", algorithm_type="dpmsolver++")
|
127 |
#sched = DDIMScheduler.from_config(pipe.scheduler.config)
|
128 |
pipe.scheduler=sched
|
|
|
112 |
def load_and_prepare_model(model_id):
|
113 |
model_dtypes = {"ford442/RealVisXL_V5.0_BF16": torch.bfloat16,}
|
114 |
dtype = model_dtypes.get(model_id, torch.bfloat16) # Default to float32 if not found
|
115 |
+
vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16", torch_dtype=torch.bfloat16,safety_checker=None).to('cuda')
|
116 |
pipe = StableDiffusionXLPipeline.from_pretrained(
|
117 |
model_id,
|
118 |
torch_dtype=torch.bfloat16,
|
119 |
add_watermarker=False,
|
120 |
use_safetensors=True,
|
121 |
vae=vae,
|
122 |
+
).to('cuda')
|
123 |
#pipe.to(device=device, dtype=torch.bfloat16)
|
124 |
+
|
125 |
+
#sched = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config, beta_schedule="scaled_linear", algorithm_type="dpmsolver++")
|
126 |
+
sched = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
127 |
#sched = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config, beta_schedule="linear", algorithm_type="dpmsolver++")
|
128 |
#sched = DDIMScheduler.from_config(pipe.scheduler.config)
|
129 |
pipe.scheduler=sched
|