Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -96,6 +96,7 @@ def load_and_prepare_model(model_id):
|
|
| 96 |
|
| 97 |
# Get the dtype based on the model_id
|
| 98 |
dtype = model_dtypes.get(model_id, torch.bfloat16) # Default to float32 if not found
|
|
|
|
| 99 |
|
| 100 |
# Load the pipeline with the determined dtype
|
| 101 |
pipe = StableDiffusionXLPipeline.from_pretrained(
|
|
@@ -103,6 +104,7 @@ def load_and_prepare_model(model_id):
|
|
| 103 |
torch_dtype=torch.bfloat16,
|
| 104 |
use_safetensors=True,
|
| 105 |
add_watermarker=False,
|
|
|
|
| 106 |
)
|
| 107 |
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
| 108 |
pipe.to('cuda')
|
|
|
|
| 96 |
|
| 97 |
# Get the dtype based on the model_id
|
| 98 |
dtype = model_dtypes.get(model_id, torch.bfloat16) # Default to float32 if not found
|
| 99 |
+
vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16", torch_dtype=torch.bfloat16).to('cuda')
|
| 100 |
|
| 101 |
# Load the pipeline with the determined dtype
|
| 102 |
pipe = StableDiffusionXLPipeline.from_pretrained(
|
|
|
|
| 104 |
torch_dtype=torch.bfloat16,
|
| 105 |
use_safetensors=True,
|
| 106 |
add_watermarker=False,
|
| 107 |
+
vae=vae
|
| 108 |
)
|
| 109 |
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
| 110 |
pipe.to('cuda')
|