Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -72,7 +72,8 @@ def infer(
|
|
72 |
'num_inference_steps': num_inference_steps,
|
73 |
'width': width,
|
74 |
'height': height,
|
75 |
-
'generator': generator
|
|
|
76 |
}
|
77 |
|
78 |
if controlnet_checkbox:
|
@@ -120,8 +121,8 @@ 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.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()})
|
|
|
72 |
'num_inference_steps': num_inference_steps,
|
73 |
'width': width,
|
74 |
'height': height,
|
75 |
+
'generator': generator,
|
76 |
+
'cross_attention_kwargs': {"scale": lora_scale}
|
77 |
}
|
78 |
|
79 |
if controlnet_checkbox:
|
|
|
121 |
pipe.unet = PeftModel.from_pretrained(pipe.unet, unet_sub_dir)
|
122 |
pipe.text_encoder = PeftModel.from_pretrained(pipe.text_encoder, text_encoder_sub_dir)
|
123 |
|
124 |
+
# pipe.unet.add_weighted_adapter(['default'], [lora_scale], 'lora')
|
125 |
+
# pipe.text_encoder.add_weighted_adapter(['default'], [lora_scale], 'lora')
|
126 |
|
127 |
# pipe.unet.load_state_dict({k: lora_scale*v for k, v in pipe.unet.state_dict().items()})
|
128 |
# pipe.text_encoder.load_state_dict({k: lora_scale*v for k, v in pipe.text_encoder.state_dict().items()})
|