DonImages commited on
Commit
3fb1f61
·
verified ·
1 Parent(s): b02d1ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
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, weights_only=True)
29
- pipeline.load_lora_weights(lora_path) # Load LoRA weights into the pipeline
30
- print("✅ LoRA weights loaded successfully!")
 
 
 
 
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