Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -11,6 +11,15 @@ def get_lora_sd_pipeline(
|
|
11 |
dtype=torch.float16,
|
12 |
adapter_name="default"
|
13 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
unet_sub_dir = os.path.join(ckpt_dir, "unet")
|
15 |
text_encoder_sub_dir = os.path.join(ckpt_dir, "text_encoder")
|
16 |
|
@@ -25,6 +34,7 @@ def get_lora_sd_pipeline(
|
|
25 |
before_params = pipe.unet.parameters()
|
26 |
pipe.unet = PeftModel.from_pretrained(pipe.unet, unet_sub_dir, adapter_name=adapter_name)
|
27 |
pipe.fuse_lora(lora_scale=0.5)
|
|
|
28 |
after_params = pipe.unet.parameters()
|
29 |
print("Parameters changed:", any(torch.any(b != a) for b, a in zip(before_params, after_params)))
|
30 |
|
|
|
11 |
dtype=torch.float16,
|
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 |
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.set_adapters_weight(lora_scale=0.5)
|
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 |
|