akaUNik commited on
Commit
ea7cb4e
·
verified ·
1 Parent(s): 282485e

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -3,6 +3,7 @@ import numpy as np
3
  import random
4
 
5
  from diffusers import DiffusionPipeline
 
6
  import torch
7
 
8
  device = "cuda" if torch.cuda.is_available() else "cpu"
@@ -39,10 +40,8 @@ def load_pipeline(model_id: str):
39
  base_model = "CompVis/stable-diffusion-v1-4"
40
  pipe = DiffusionPipeline.from_pretrained(base_model, torch_dtype=torch_dtype)
41
  # Load the LoRA weights into the U-Net.
42
- # This assumes that load_attn_procs loads the LoRA weights.
43
- # pipe.unet.load_attn_procs(model_id)
44
- pipe.load_lora_weights(model_id, weight_name="text_encoder/adapter_model.safetensors")
45
- pipe.load_lora_weights(model_id, weight_name="unet/adapter_model.safetensors")
46
  else:
47
  pipe = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch_dtype)
48
 
 
3
  import random
4
 
5
  from diffusers import DiffusionPipeline
6
+ from peft import PeftModel, PeftConfig
7
  import torch
8
 
9
  device = "cuda" if torch.cuda.is_available() else "cpu"
 
40
  base_model = "CompVis/stable-diffusion-v1-4"
41
  pipe = DiffusionPipeline.from_pretrained(base_model, torch_dtype=torch_dtype)
42
  # Load the LoRA weights into the U-Net.
43
+ pipe.unet = PeftModel.from_pretrained(pipe.unet, "unet")
44
+
 
 
45
  else:
46
  pipe = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch_dtype)
47