Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -40,8 +40,18 @@ def load_pipeline(model_id: str):
|
|
| 40 |
base_model = "CompVis/stable-diffusion-v1-4"
|
| 41 |
pipe = DiffusionPipeline.from_pretrained(base_model, torch_dtype=torch_dtype)
|
| 42 |
# Load the LoRA weights
|
| 43 |
-
pipe.unet = PeftModel.from_pretrained(
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
else:
|
| 46 |
pipe = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch_dtype)
|
| 47 |
|
|
|
|
| 40 |
base_model = "CompVis/stable-diffusion-v1-4"
|
| 41 |
pipe = DiffusionPipeline.from_pretrained(base_model, torch_dtype=torch_dtype)
|
| 42 |
# Load the LoRA weights
|
| 43 |
+
pipe.unet = PeftModel.from_pretrained(
|
| 44 |
+
pipe.unet,
|
| 45 |
+
model_id,
|
| 46 |
+
subfolder="unet",
|
| 47 |
+
torch_dtype=torch_dtype
|
| 48 |
+
)
|
| 49 |
+
pipe.text_encoder = PeftModel.from_pretrained(
|
| 50 |
+
pipe.text_encoder,
|
| 51 |
+
model_id,
|
| 52 |
+
subfolder="text_encoder",
|
| 53 |
+
torch_dtype=torch_dtype
|
| 54 |
+
)
|
| 55 |
else:
|
| 56 |
pipe = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch_dtype)
|
| 57 |
|