ktrndy commited on
Commit
6d220bd
·
verified ·
1 Parent(s): e87b4c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -120,8 +120,11 @@ def infer(
120
  pipe.unet = PeftModel.from_pretrained(pipe.unet, unet_sub_dir)
121
  pipe.text_encoder = PeftModel.from_pretrained(pipe.text_encoder, text_encoder_sub_dir)
122
 
123
- pipe.unet.load_state_dict({k: lora_scale*v for k, v in pipe.unet.state_dict().items()})
124
- pipe.text_encoder.load_state_dict({k: lora_scale*v for k, v in pipe.text_encoder.state_dict().items()})
 
 
 
125
 
126
  if tiny_vae:
127
  pipe.vae = AutoencoderTiny.from_pretrained("madebyollin/taesd", torch_dtype=torch_dtype)
 
120
  pipe.unet = PeftModel.from_pretrained(pipe.unet, unet_sub_dir)
121
  pipe.text_encoder = PeftModel.from_pretrained(pipe.text_encoder, text_encoder_sub_dir)
122
 
123
+ pipe.unet.add_weighted_adapter(['default'], lora_scale, 'lora')
124
+ pipe.text_encoder.add_weighted_adapter(['default'], lora_scale, 'lora')
125
+
126
+ # pipe.unet.load_state_dict({k: lora_scale*v for k, v in pipe.unet.state_dict().items()})
127
+ # pipe.text_encoder.load_state_dict({k: lora_scale*v for k, v in pipe.text_encoder.state_dict().items()})
128
 
129
  if tiny_vae:
130
  pipe.vae = AutoencoderTiny.from_pretrained("madebyollin/taesd", torch_dtype=torch_dtype)