Spaces:
Runtime error
Runtime error
Commit
•
7c6dd97
1
Parent(s):
03d99f7
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
-
from time import sleep
|
3 |
from diffusers import DiffusionPipeline
|
4 |
from huggingface_hub import hf_hub_download, CommitScheduler
|
5 |
from safetensors.torch import load_file
|
@@ -12,6 +12,7 @@ import json
|
|
12 |
import random
|
13 |
import copy
|
14 |
import gc
|
|
|
15 |
import spaces
|
16 |
|
17 |
lora_list = hf_hub_download(repo_id="multimodalart/LoraTheExplorer", filename="sdxl_loras.json", repo_type="space")
|
@@ -94,10 +95,15 @@ def merge_and_run(prompt, negative_prompt, shuffled_items, lora_1_scale=0.5, lor
|
|
94 |
repo_id_1 = shuffled_items[0]['repo']
|
95 |
repo_id_2 = shuffled_items[1]['repo']
|
96 |
print("Loading state dicts...")
|
97 |
-
state_dict_1 =
|
98 |
-
state_dict_2 =
|
99 |
print("Loaded state dicts.")
|
100 |
-
pipe = copy.deepcopy(original_pipe)
|
|
|
|
|
|
|
|
|
|
|
101 |
pipe.to("cuda")
|
102 |
print("Loading LoRA weights...")
|
103 |
pipe.load_lora_weights(state_dict_1)
|
|
|
1 |
import gradio as gr
|
2 |
+
from time import sleep, time
|
3 |
from diffusers import DiffusionPipeline
|
4 |
from huggingface_hub import hf_hub_download, CommitScheduler
|
5 |
from safetensors.torch import load_file
|
|
|
12 |
import random
|
13 |
import copy
|
14 |
import gc
|
15 |
+
import pickle
|
16 |
import spaces
|
17 |
|
18 |
lora_list = hf_hub_download(repo_id="multimodalart/LoraTheExplorer", filename="sdxl_loras.json", repo_type="space")
|
|
|
95 |
repo_id_1 = shuffled_items[0]['repo']
|
96 |
repo_id_2 = shuffled_items[1]['repo']
|
97 |
print("Loading state dicts...")
|
98 |
+
state_dict_1 = state_dicts[repo_id_1]["state_dict"]
|
99 |
+
state_dict_2 = state_dicts[repo_id_2]["state_dict"]
|
100 |
print("Loaded state dicts.")
|
101 |
+
#pipe = copy.deepcopy(original_pipe)
|
102 |
+
# Time for pickle
|
103 |
+
start_time = time.time()
|
104 |
+
pipe = pickle.loads(pickle.dumps(original_pipe))
|
105 |
+
pickle_time = time.time() - start_time
|
106 |
+
print(f"Pickle time: {pickle_time}")
|
107 |
pipe.to("cuda")
|
108 |
print("Loading LoRA weights...")
|
109 |
pipe.load_lora_weights(state_dict_1)
|