Commit
·
9bd2ea4
1
Parent(s):
e6d0ada
Update app.py
Browse files
app.py
CHANGED
|
@@ -58,17 +58,17 @@ css = '''
|
|
| 58 |
original_pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16)
|
| 59 |
|
| 60 |
def merge_and_run(prompt, negative_prompt, shuffled_items, lora_1_scale=0.5, lora_2_scale=0.5, progress=gr.Progress(track_tqdm=True)):
|
| 61 |
-
print(shuffled_items)
|
| 62 |
state_dict_1 = copy.deepcopy(shuffled_items[0]['state_dict'])
|
|
|
|
| 63 |
state_dict_2 = copy.deepcopy(shuffled_items[1]['state_dict'])
|
| 64 |
-
|
| 65 |
pipe = copy.deepcopy(original_pipe)
|
| 66 |
pipe.to("cuda")
|
| 67 |
|
| 68 |
|
| 69 |
-
pipe.load_lora_weights(
|
| 70 |
pipe.fuse_lora(lora_1_scale)
|
| 71 |
-
pipe.load_lora_weights(
|
| 72 |
pipe.fuse_lora(lora_2_scale)
|
| 73 |
|
| 74 |
if negative_prompt == "":
|
|
|
|
| 58 |
original_pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16)
|
| 59 |
|
| 60 |
def merge_and_run(prompt, negative_prompt, shuffled_items, lora_1_scale=0.5, lora_2_scale=0.5, progress=gr.Progress(track_tqdm=True)):
|
|
|
|
| 61 |
state_dict_1 = copy.deepcopy(shuffled_items[0]['state_dict'])
|
| 62 |
+
print("state_1", state_dict_1)
|
| 63 |
state_dict_2 = copy.deepcopy(shuffled_items[1]['state_dict'])
|
| 64 |
+
print("state_2", state_dict_2)
|
| 65 |
pipe = copy.deepcopy(original_pipe)
|
| 66 |
pipe.to("cuda")
|
| 67 |
|
| 68 |
|
| 69 |
+
pipe.load_lora_weights(state_dict_1)
|
| 70 |
pipe.fuse_lora(lora_1_scale)
|
| 71 |
+
pipe.load_lora_weights(state_dict_2)
|
| 72 |
pipe.fuse_lora(lora_2_scale)
|
| 73 |
|
| 74 |
if negative_prompt == "":
|