Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,14 +12,6 @@ def get_lora_sd_pipeline(
|
|
| 12 |
adapter_name="default"
|
| 13 |
):
|
| 14 |
|
| 15 |
-
current_dir = os.getcwd()
|
| 16 |
-
print(f"Текущая рабочая директория: {current_dir}")
|
| 17 |
-
|
| 18 |
-
contents = os.listdir('.')
|
| 19 |
-
print("Содержимое директории:")
|
| 20 |
-
for item in contents:
|
| 21 |
-
print(item)
|
| 22 |
-
|
| 23 |
unet_sub_dir = os.path.join(ckpt_dir, "unet")
|
| 24 |
text_encoder_sub_dir = os.path.join(ckpt_dir, "text_encoder")
|
| 25 |
|
|
@@ -34,7 +26,7 @@ def get_lora_sd_pipeline(
|
|
| 34 |
before_params = pipe.unet.parameters()
|
| 35 |
pipe.unet = PeftModel.from_pretrained(pipe.unet, unet_sub_dir, adapter_name=adapter_name)
|
| 36 |
pipe.fuse_lora(lora_scale=0.5)
|
| 37 |
-
pipe.unet.
|
| 38 |
after_params = pipe.unet.parameters()
|
| 39 |
print("Parameters changed:", any(torch.any(b != a) for b, a in zip(before_params, after_params)))
|
| 40 |
|
|
|
|
| 12 |
adapter_name="default"
|
| 13 |
):
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
unet_sub_dir = os.path.join(ckpt_dir, "unet")
|
| 16 |
text_encoder_sub_dir = os.path.join(ckpt_dir, "text_encoder")
|
| 17 |
|
|
|
|
| 26 |
before_params = pipe.unet.parameters()
|
| 27 |
pipe.unet = PeftModel.from_pretrained(pipe.unet, unet_sub_dir, adapter_name=adapter_name)
|
| 28 |
pipe.fuse_lora(lora_scale=0.5)
|
| 29 |
+
pipe.unet.set_adapter(adapter_name, lora_scale=0.5)
|
| 30 |
after_params = pipe.unet.parameters()
|
| 31 |
print("Parameters changed:", any(torch.any(b != a) for b, a in zip(before_params, after_params)))
|
| 32 |
|