Spaces:
Running
on
Zero
Running
on
Zero
Update raw.py
Browse files
raw.py
CHANGED
|
@@ -7,7 +7,11 @@ from diffusers import BitsAndBytesConfig as DiffusersBitsAndBytesConfig
|
|
| 7 |
from transformers import T5EncoderModel
|
| 8 |
from transformers import BitsAndBytesConfig as TransformersBitsAndBytesConfig
|
| 9 |
from peft import PeftModel, PeftConfig
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
import gradio as gr
|
| 12 |
huggingface_token = os.getenv("HUGGINFACE_TOKEN")
|
| 13 |
|
|
@@ -46,6 +50,7 @@ pipe.load_lora_weights(adapter_id3, weight_name="lora.safetensors", adapter_name
|
|
| 46 |
pipe.set_adapters(["turbo", "real", "enhance"], adapter_weights=[0.9, 0.66, 0.6])
|
| 47 |
pipe.fuse_lora(adapter_names=["turbo", "real", "enhance"], lora_scale=1.0)
|
| 48 |
pipe.unload_lora_weights()
|
|
|
|
| 49 |
# pipe.enable_xformers_memory_efficient_attention()
|
| 50 |
# save to the Hub
|
| 51 |
# pipe.push_to_hub("fused-t-r")
|
|
@@ -68,6 +73,7 @@ def generate_image(prompt, scale, steps, control_image, controlnet_conditioning_
|
|
| 68 |
height=control_image.size[1],
|
| 69 |
width=control_image.size[0]
|
| 70 |
).images[0]
|
|
|
|
| 71 |
return image
|
| 72 |
|
| 73 |
# Create Gradio interface with rows and columns
|
|
|
|
| 7 |
from transformers import T5EncoderModel
|
| 8 |
from transformers import BitsAndBytesConfig as TransformersBitsAndBytesConfig
|
| 9 |
from peft import PeftModel, PeftConfig
|
| 10 |
+
from attention_map_diffusers import (
|
| 11 |
+
attn_maps,
|
| 12 |
+
init_pipeline,
|
| 13 |
+
save_attention_maps
|
| 14 |
+
)
|
| 15 |
import gradio as gr
|
| 16 |
huggingface_token = os.getenv("HUGGINFACE_TOKEN")
|
| 17 |
|
|
|
|
| 50 |
pipe.set_adapters(["turbo", "real", "enhance"], adapter_weights=[0.9, 0.66, 0.6])
|
| 51 |
pipe.fuse_lora(adapter_names=["turbo", "real", "enhance"], lora_scale=1.0)
|
| 52 |
pipe.unload_lora_weights()
|
| 53 |
+
pipe = init_pipeline(pipe)
|
| 54 |
# pipe.enable_xformers_memory_efficient_attention()
|
| 55 |
# save to the Hub
|
| 56 |
# pipe.push_to_hub("fused-t-r")
|
|
|
|
| 73 |
height=control_image.size[1],
|
| 74 |
width=control_image.size[0]
|
| 75 |
).images[0]
|
| 76 |
+
|
| 77 |
return image
|
| 78 |
|
| 79 |
# Create Gradio interface with rows and columns
|