Update app.py
Browse files
app.py
CHANGED
@@ -25,9 +25,13 @@ pipeline = StableDiffusion3Pipeline.from_pretrained(
|
|
25 |
# Load the LoRA trained weights once at the start
|
26 |
lora_path = "lora_trained_model.pt" # Ensure this file is uploaded in the Space
|
27 |
if os.path.exists(lora_path):
|
28 |
-
lora_state_dict = torch.load(lora_path, map_location=device
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
31 |
else:
|
32 |
print("⚠️ LoRA file not found! Running base model.")
|
33 |
|
|
|
25 |
# Load the LoRA trained weights once at the start
|
26 |
lora_path = "lora_trained_model.pt" # Ensure this file is uploaded in the Space
|
27 |
if os.path.exists(lora_path):
|
28 |
+
lora_state_dict = torch.load(lora_path, map_location=device)
|
29 |
+
|
30 |
+
try:
|
31 |
+
pipeline.load_lora_weights(lora_state_dict) # Load LoRA weights into the pipeline
|
32 |
+
print("✅ LoRA weights loaded successfully!")
|
33 |
+
except ValueError as e:
|
34 |
+
print(f"❌ Error loading LoRA: {e}")
|
35 |
else:
|
36 |
print("⚠️ LoRA file not found! Running base model.")
|
37 |
|