Commit
·
c694422
1
Parent(s):
599d91a
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 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
|
| 6 |
from share_btn import community_icon_html, loading_icon_html, share_js
|
|
@@ -87,6 +87,7 @@ div#share-btn-container > div {flex-direction: row;background: black;align-items
|
|
| 87 |
.title_lora a{color: var(--body-text-color) !important}
|
| 88 |
'''
|
| 89 |
|
|
|
|
| 90 |
original_pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16)
|
| 91 |
|
| 92 |
@spaces.GPU
|
|
@@ -102,8 +103,8 @@ def merge_and_run(prompt, negative_prompt, shuffled_items, lora_1_scale=0.5, lor
|
|
| 102 |
print(f"State Dict time: {state_dict_time}")
|
| 103 |
#pipe = copy.deepcopy(original_pipe)
|
| 104 |
start_time = time()
|
| 105 |
-
|
| 106 |
-
pipe.
|
| 107 |
pickle_time = time() - start_time
|
| 108 |
print(f"copy time: {pickle_time}")
|
| 109 |
pipe.to("cuda")
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from time import sleep, time
|
| 3 |
+
from diffusers import DiffusionPipeline, StableDiffusionXLPipeline
|
| 4 |
from huggingface_hub import hf_hub_download, CommitScheduler
|
| 5 |
from safetensors.torch import load_file
|
| 6 |
from share_btn import community_icon_html, loading_icon_html, share_js
|
|
|
|
| 87 |
.title_lora a{color: var(--body-text-color) !important}
|
| 88 |
'''
|
| 89 |
|
| 90 |
+
|
| 91 |
original_pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16)
|
| 92 |
|
| 93 |
@spaces.GPU
|
|
|
|
| 103 |
print(f"State Dict time: {state_dict_time}")
|
| 104 |
#pipe = copy.deepcopy(original_pipe)
|
| 105 |
start_time = time()
|
| 106 |
+
unet = copy.deepcopy(original_pipe.unet)
|
| 107 |
+
pipe = StableDiffusionXLPipeline(vae=original_pipe.vae, text_encoder=original_pipe.text_encoder, text_encoder_2=original_pipe.text_encoder_2, scheduler=original_pipe.scheduler, unet=unet)
|
| 108 |
pickle_time = time() - start_time
|
| 109 |
print(f"copy time: {pickle_time}")
|
| 110 |
pipe.to("cuda")
|