ktrndy commited on
Commit
d488d40
·
verified ·
1 Parent(s): 6b00928

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -4
app.py CHANGED
@@ -39,9 +39,6 @@ def get_lora_sd_pipeline(
39
  pipe = StableDiffusionPipeline.from_pretrained(base_model_name_or_path, torch_dtype=dtype).to(device)
40
  pipe.unet = PeftModel.from_pretrained(pipe.unet, unet_sub_dir, adapter_name=adapter_name)
41
  pipe.unet.set_adapter(adapter_name)
42
- pipe.unet.set_peft_model_state_dict(
43
- {k: v*lora_scale for k, v in pipe.unet.state_dict().items()}
44
- )
45
 
46
  if os.path.exists(text_encoder_sub_dir):
47
  pipe.text_encoder = PeftModel.from_pretrained(
@@ -102,7 +99,7 @@ def infer(
102
  pipe = pipe.to(device)
103
  prompt_embeds = encode_prompt(prompt, pipe.tokenizer, pipe.text_encoder)
104
  negative_prompt_embeds = encode_prompt(negative_prompt, pipe.tokenizer, pipe.text_encoder)
105
- # pipe.fuse_lora(lora_scale=lora_scale)
106
 
107
  image = pipe(
108
  prompt_embeds=prompt_embeds,
 
39
  pipe = StableDiffusionPipeline.from_pretrained(base_model_name_or_path, torch_dtype=dtype).to(device)
40
  pipe.unet = PeftModel.from_pretrained(pipe.unet, unet_sub_dir, adapter_name=adapter_name)
41
  pipe.unet.set_adapter(adapter_name)
 
 
 
42
 
43
  if os.path.exists(text_encoder_sub_dir):
44
  pipe.text_encoder = PeftModel.from_pretrained(
 
99
  pipe = pipe.to(device)
100
  prompt_embeds = encode_prompt(prompt, pipe.tokenizer, pipe.text_encoder)
101
  negative_prompt_embeds = encode_prompt(negative_prompt, pipe.tokenizer, pipe.text_encoder)
102
+ pipe.fuse_lora(lora_scale=lora_scale)
103
 
104
  image = pipe(
105
  prompt_embeds=prompt_embeds,