Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -343,6 +343,7 @@ class SDXLFlowMatchingPipeline:
|
|
| 343 |
print("[Lyra Debug] Normalizing CLIP-G reconstruction to match input stats")
|
| 344 |
lyra_clip_g = (lyra_clip_g - lyra_clip_g.mean()) / (lyra_clip_g.std() + 1e-8)
|
| 345 |
lyra_clip_g = lyra_clip_g * clip_g_embeds.std() + clip_g_embeds.mean()
|
|
|
|
| 346 |
|
| 347 |
# Blend original CLIP with Lyra reconstruction
|
| 348 |
fused_clip_l = (1 - lyra_strength) * clip_l_embeds + lyra_strength * lyra_clip_l
|
|
@@ -356,7 +357,7 @@ class SDXLFlowMatchingPipeline:
|
|
| 356 |
# Process negative prompt (simpler - just use original CLIP for negative)
|
| 357 |
if negative_prompt:
|
| 358 |
# For negative, blend less aggressively
|
| 359 |
-
neg_strength = lyra_strength
|
| 360 |
|
| 361 |
t5_neg_prompt = f"{negative_prompt} {SUMMARY_SEPARATOR} {negative_prompt}"
|
| 362 |
t5_inputs_neg = self.t5_tokenizer(
|
|
@@ -432,7 +433,7 @@ class SDXLFlowMatchingPipeline:
|
|
| 432 |
use_lyra: bool = False,
|
| 433 |
clip_skip: int = 1,
|
| 434 |
t5_summary: str = "",
|
| 435 |
-
lyra_strength: float = 0
|
| 436 |
progress_callback=None
|
| 437 |
):
|
| 438 |
"""Generate image using SDXL architecture."""
|
|
@@ -1053,7 +1054,7 @@ def load_lyra_vae_xl(
|
|
| 1053 |
print(" 📥 Downloading model.pt...")
|
| 1054 |
checkpoint_path = hf_hub_download(
|
| 1055 |
repo_id=repo_id,
|
| 1056 |
-
filename="
|
| 1057 |
repo_type="model"
|
| 1058 |
)
|
| 1059 |
|
|
@@ -1450,10 +1451,10 @@ def create_demo():
|
|
| 1450 |
lyra_strength = gr.Slider(
|
| 1451 |
label="Lyra Blend Strength",
|
| 1452 |
minimum=0.0,
|
| 1453 |
-
maximum=
|
| 1454 |
-
value=0
|
| 1455 |
step=0.05,
|
| 1456 |
-
info="0.0 = pure CLIP, 1.0 = pure Lyra reconstruction"
|
| 1457 |
)
|
| 1458 |
|
| 1459 |
with gr.Accordion("Generation Settings", open=True):
|
|
@@ -1556,21 +1557,21 @@ def create_demo():
|
|
| 1556 |
"A beautiful anime girl with flowing blue hair wearing a school uniform, surrounded by delicate pink cherry blossoms against a bright sky",
|
| 1557 |
"lowres, bad anatomy, worst quality, low quality",
|
| 1558 |
"Illustrious XL",
|
| 1559 |
-
2, 25, 7.0, 1024, 1024, 0.0, False, True, 0.
|
| 1560 |
],
|
| 1561 |
[
|
| 1562 |
"A majestic mountain landscape at golden hour, crystal clear lake, photorealistic, 8k",
|
| 1563 |
"A breathtaking mountain vista bathed in warm golden light at sunset, with a perfectly still crystal clear lake reflecting the peaks",
|
| 1564 |
"blurry, low quality",
|
| 1565 |
"SDXL Base",
|
| 1566 |
-
1, 30, 7.5, 1024, 1024, 0.0, False, True, 0.
|
| 1567 |
],
|
| 1568 |
[
|
| 1569 |
"cyberpunk city at night, neon lights, rain, highly detailed",
|
| 1570 |
"A futuristic cyberpunk metropolis at night with vibrant neon lights reflecting off rain-slicked streets",
|
| 1571 |
"low quality, blurry",
|
| 1572 |
"Flow-Lune (SD1.5)",
|
| 1573 |
-
1, 20, 7.5, 512, 512, 2.5, True, True, 0.
|
| 1574 |
],
|
| 1575 |
],
|
| 1576 |
inputs=[
|
|
|
|
| 343 |
print("[Lyra Debug] Normalizing CLIP-G reconstruction to match input stats")
|
| 344 |
lyra_clip_g = (lyra_clip_g - lyra_clip_g.mean()) / (lyra_clip_g.std() + 1e-8)
|
| 345 |
lyra_clip_g = lyra_clip_g * clip_g_embeds.std() + clip_g_embeds.mean()
|
| 346 |
+
|
| 347 |
|
| 348 |
# Blend original CLIP with Lyra reconstruction
|
| 349 |
fused_clip_l = (1 - lyra_strength) * clip_l_embeds + lyra_strength * lyra_clip_l
|
|
|
|
| 357 |
# Process negative prompt (simpler - just use original CLIP for negative)
|
| 358 |
if negative_prompt:
|
| 359 |
# For negative, blend less aggressively
|
| 360 |
+
neg_strength = lyra_strength
|
| 361 |
|
| 362 |
t5_neg_prompt = f"{negative_prompt} {SUMMARY_SEPARATOR} {negative_prompt}"
|
| 363 |
t5_inputs_neg = self.t5_tokenizer(
|
|
|
|
| 433 |
use_lyra: bool = False,
|
| 434 |
clip_skip: int = 1,
|
| 435 |
t5_summary: str = "",
|
| 436 |
+
lyra_strength: float = 1.0,
|
| 437 |
progress_callback=None
|
| 438 |
):
|
| 439 |
"""Generate image using SDXL architecture."""
|
|
|
|
| 1054 |
print(" 📥 Downloading model.pt...")
|
| 1055 |
checkpoint_path = hf_hub_download(
|
| 1056 |
repo_id=repo_id,
|
| 1057 |
+
filename="checkpoint_lyra_illustrious_37000.pt",
|
| 1058 |
repo_type="model"
|
| 1059 |
)
|
| 1060 |
|
|
|
|
| 1451 |
lyra_strength = gr.Slider(
|
| 1452 |
label="Lyra Blend Strength",
|
| 1453 |
minimum=0.0,
|
| 1454 |
+
maximum=3.0,
|
| 1455 |
+
value=1.0,
|
| 1456 |
step=0.05,
|
| 1457 |
+
info="0.0 = pure CLIP, 1.0 = pure Lyra reconstruction, 3.0 = way too much but try it anyway"
|
| 1458 |
)
|
| 1459 |
|
| 1460 |
with gr.Accordion("Generation Settings", open=True):
|
|
|
|
| 1557 |
"A beautiful anime girl with flowing blue hair wearing a school uniform, surrounded by delicate pink cherry blossoms against a bright sky",
|
| 1558 |
"lowres, bad anatomy, worst quality, low quality",
|
| 1559 |
"Illustrious XL",
|
| 1560 |
+
2, 25, 7.0, 1024, 1024, 0.0, False, True, 0.8, 42, False
|
| 1561 |
],
|
| 1562 |
[
|
| 1563 |
"A majestic mountain landscape at golden hour, crystal clear lake, photorealistic, 8k",
|
| 1564 |
"A breathtaking mountain vista bathed in warm golden light at sunset, with a perfectly still crystal clear lake reflecting the peaks",
|
| 1565 |
"blurry, low quality",
|
| 1566 |
"SDXL Base",
|
| 1567 |
+
1, 30, 7.5, 1024, 1024, 0.0, False, True, 0.8, 123, False
|
| 1568 |
],
|
| 1569 |
[
|
| 1570 |
"cyberpunk city at night, neon lights, rain, highly detailed",
|
| 1571 |
"A futuristic cyberpunk metropolis at night with vibrant neon lights reflecting off rain-slicked streets",
|
| 1572 |
"low quality, blurry",
|
| 1573 |
"Flow-Lune (SD1.5)",
|
| 1574 |
+
1, 20, 7.5, 512, 512, 2.5, True, True, 0.8, 456, False
|
| 1575 |
],
|
| 1576 |
],
|
| 1577 |
inputs=[
|