Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -290,6 +290,7 @@ LORA_REPO = "dagloop5/LoRA"
|
|
| 290 |
print("=" * 80)
|
| 291 |
print("Downloading LoRA adapters from dagloop5/LoRA...")
|
| 292 |
print("=" * 80)
|
|
|
|
| 293 |
teneros_lora_path = hf_hub_download(repo_id="maximsobolev275/LTX-10Eros-LoRA-r768", filename="LTX_10Eros_LoRA_r768.safetensors")
|
| 294 |
sulphur_lora_path =hf_hub_download(repo_id="SulphurAI/Sulphur-2-base", filename="sulphur_lora_rank_768.safetensors")
|
| 295 |
pose_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2_3_NSFW_furry_concat_v2.safetensors")
|
|
@@ -308,6 +309,7 @@ physics_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2.3_Physics_
|
|
| 308 |
reasoning_lora_path = hf_hub_download(repo_id="LiconStudio/Ltx2.3-VBVR-lora-I2V", filename="Ltx2.3-Licon-VBVR-I2V-390K-R32.safetensors")
|
| 309 |
twostep_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2.3_Multi_step_video_reasoning_V0.1.safetensors")
|
| 310 |
|
|
|
|
| 311 |
print(f"10Eros LoRA: {teneros_lora_path}")
|
| 312 |
print(f"Sulphur LoRA: {sulphur_lora_path}")
|
| 313 |
print(f"Pose LoRA: {pose_lora_path}")
|
|
@@ -342,7 +344,8 @@ pipeline = LTX23DistilledA2VPipeline(
|
|
| 342 |
)
|
| 343 |
# ----------------------------------------------------------------
|
| 344 |
|
| 345 |
-
def _make_lora_key(teneros_strength: float, sulphur_strength: float, pose_strength: float, general_strength: float, motion_strength: float, dreamlay_strength: float, mself_strength: float, dramatic_strength: float, fluid_strength: float, liquid_strength: float, demopose_strength: float, voice_strength: float, realism_strength: float, transition_strength: float, physics_strength: float, reasoning_strength: float, twostep_strength: float) -> tuple[str, str]:
|
|
|
|
| 346 |
ra = round(float(teneros_strength), 2)
|
| 347 |
rb = round(float(sulphur_strength), 2)
|
| 348 |
rp = round(float(pose_strength), 2)
|
|
@@ -360,12 +363,13 @@ def _make_lora_key(teneros_strength: float, sulphur_strength: float, pose_streng
|
|
| 360 |
ry = round(float(physics_strength), 2)
|
| 361 |
ri = round(float(reasoning_strength), 2)
|
| 362 |
rw = round(float(twostep_strength), 2)
|
| 363 |
-
key_str = f"{teneros_lora_path}:{ra}|{sulphur_lora_path}:{rb}|{pose_lora_path}:{rp}|{general_lora_path}:{rg}|{motion_lora_path}:{rm}|{dreamlay_lora_path}:{rd}|{mself_lora_path}:{rs}|{dramatic_lora_path}:{rr}|{fluid_lora_path}:{rf}|{liquid_lora_path}:{rl}|{demopose_lora_path}:{ro}|{voice_lora_path}:{rv}|{realism_lora_path}:{re}|{transition_lora_path}:{rt}|{physics_lora_path}:{ry}|{reasoning_lora_path}:{ri}|{twostep_lora_path}:{rw}"
|
| 364 |
key = hashlib.sha256(key_str.encode("utf-8")).hexdigest()
|
| 365 |
return key, key_str
|
| 366 |
|
| 367 |
|
| 368 |
def prepare_lora_cache(
|
|
|
|
| 369 |
teneros_strength: float,
|
| 370 |
sulphur_strength: float,
|
| 371 |
pose_strength: float,
|
|
@@ -395,7 +399,7 @@ def prepare_lora_cache(
|
|
| 395 |
global PENDING_LORA_KEY, PENDING_LORA_STATE, PENDING_LORA_STATUS
|
| 396 |
|
| 397 |
ledger = pipeline.model_ledger
|
| 398 |
-
key, _ = _make_lora_key(teneros_strength, sulphur_strength, pose_strength, general_strength, motion_strength, dreamlay_strength, mself_strength, dramatic_strength, fluid_strength, liquid_strength, demopose_strength, voice_strength, realism_strength, transition_strength, physics_strength, reasoning_strength, twostep_strength)
|
| 399 |
cache_path = LORA_CACHE_DIR / f"{key}.safetensors"
|
| 400 |
|
| 401 |
progress(0.05, desc="Preparing LoRA state")
|
|
@@ -411,6 +415,7 @@ def prepare_lora_cache(
|
|
| 411 |
print(f"[LoRA] Cache load failed: {type(e).__name__}: {e}")
|
| 412 |
|
| 413 |
entries = [
|
|
|
|
| 414 |
(teneros_lora_path, round(float(teneros_strength), 2)),
|
| 415 |
(sulphur_lora_path, round(float(sulphur_strength), 2)),
|
| 416 |
(pose_lora_path, round(float(pose_strength), 2)),
|
|
@@ -612,6 +617,7 @@ def get_gpu_duration(
|
|
| 612 |
randomize_seed: bool = False,
|
| 613 |
height: int = 0.0,
|
| 614 |
width: int = 0.0,
|
|
|
|
| 615 |
teneros_strength: float = 0.0,
|
| 616 |
sulphur_strength: float = 0.0,
|
| 617 |
pose_strength: float = 0.0,
|
|
@@ -647,6 +653,7 @@ def generate_video(
|
|
| 647 |
randomize_seed: bool = True,
|
| 648 |
height: int = 0.0,
|
| 649 |
width: int = 0.0,
|
|
|
|
| 650 |
teneros_strength: float = 0.0,
|
| 651 |
sulphur_strength: float = 0.0,
|
| 652 |
pose_strength: float = 0.0,
|
|
@@ -772,6 +779,10 @@ with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
|
| 772 |
high_res = gr.Checkbox(label="High Resolution", value=True)
|
| 773 |
with gr.Column():
|
| 774 |
gr.Markdown("### LoRA adapter strengths (set to 0 to disable; slow and WIP)")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 775 |
teneros_strength = gr.Slider(
|
| 776 |
label="10Eros Lora strength",
|
| 777 |
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
|
@@ -877,7 +888,7 @@ with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
|
| 877 |
|
| 878 |
prepare_lora_btn.click(
|
| 879 |
fn=prepare_lora_cache,
|
| 880 |
-
inputs=[teneros_strength, sulphur_strength, pose_strength, general_strength, motion_strength, dreamlay_strength, mself_strength, dramatic_strength, fluid_strength, liquid_strength, demopose_strength, voice_strength, realism_strength, transition_strength, physics_strength, reasoning_strength, twostep_strength],
|
| 881 |
outputs=[lora_status],
|
| 882 |
)
|
| 883 |
|
|
@@ -886,7 +897,7 @@ with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
|
| 886 |
inputs=[
|
| 887 |
first_image, last_image, input_audio, prompt, duration, gpu_duration, enhance_prompt,
|
| 888 |
seed, randomize_seed, height, width,
|
| 889 |
-
teneros_strength, sulphur_strength, pose_strength, general_strength, motion_strength, dreamlay_strength, mself_strength, dramatic_strength, fluid_strength, liquid_strength, demopose_strength, voice_strength, realism_strength, transition_strength, physics_strength, reasoning_strength, twostep_strength,
|
| 890 |
],
|
| 891 |
outputs=[output_video, seed],
|
| 892 |
)
|
|
|
|
| 290 |
print("=" * 80)
|
| 291 |
print("Downloading LoRA adapters from dagloop5/LoRA...")
|
| 292 |
print("=" * 80)
|
| 293 |
+
singularity_lora_path = hf_hub_download(repo_id="WarmBloodAban/Singularity-LTX-2.3_OmniCine_V1", filename="Singularity-LTX-2.3_OmniCine_V1nsf.safetensors")
|
| 294 |
teneros_lora_path = hf_hub_download(repo_id="maximsobolev275/LTX-10Eros-LoRA-r768", filename="LTX_10Eros_LoRA_r768.safetensors")
|
| 295 |
sulphur_lora_path =hf_hub_download(repo_id="SulphurAI/Sulphur-2-base", filename="sulphur_lora_rank_768.safetensors")
|
| 296 |
pose_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2_3_NSFW_furry_concat_v2.safetensors")
|
|
|
|
| 309 |
reasoning_lora_path = hf_hub_download(repo_id="LiconStudio/Ltx2.3-VBVR-lora-I2V", filename="Ltx2.3-Licon-VBVR-I2V-390K-R32.safetensors")
|
| 310 |
twostep_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2.3_Multi_step_video_reasoning_V0.1.safetensors")
|
| 311 |
|
| 312 |
+
print(f"Singularity LoRA: {singularity_lora_path}")
|
| 313 |
print(f"10Eros LoRA: {teneros_lora_path}")
|
| 314 |
print(f"Sulphur LoRA: {sulphur_lora_path}")
|
| 315 |
print(f"Pose LoRA: {pose_lora_path}")
|
|
|
|
| 344 |
)
|
| 345 |
# ----------------------------------------------------------------
|
| 346 |
|
| 347 |
+
def _make_lora_key(singularity_strength: float, teneros_strength: float, sulphur_strength: float, pose_strength: float, general_strength: float, motion_strength: float, dreamlay_strength: float, mself_strength: float, dramatic_strength: float, fluid_strength: float, liquid_strength: float, demopose_strength: float, voice_strength: float, realism_strength: float, transition_strength: float, physics_strength: float, reasoning_strength: float, twostep_strength: float) -> tuple[str, str]:
|
| 348 |
+
rx = round(float(singularity_strength), 2)
|
| 349 |
ra = round(float(teneros_strength), 2)
|
| 350 |
rb = round(float(sulphur_strength), 2)
|
| 351 |
rp = round(float(pose_strength), 2)
|
|
|
|
| 363 |
ry = round(float(physics_strength), 2)
|
| 364 |
ri = round(float(reasoning_strength), 2)
|
| 365 |
rw = round(float(twostep_strength), 2)
|
| 366 |
+
key_str = f"{singularity_lora_path}:{rx}|{teneros_lora_path}:{ra}|{sulphur_lora_path}:{rb}|{pose_lora_path}:{rp}|{general_lora_path}:{rg}|{motion_lora_path}:{rm}|{dreamlay_lora_path}:{rd}|{mself_lora_path}:{rs}|{dramatic_lora_path}:{rr}|{fluid_lora_path}:{rf}|{liquid_lora_path}:{rl}|{demopose_lora_path}:{ro}|{voice_lora_path}:{rv}|{realism_lora_path}:{re}|{transition_lora_path}:{rt}|{physics_lora_path}:{ry}|{reasoning_lora_path}:{ri}|{twostep_lora_path}:{rw}"
|
| 367 |
key = hashlib.sha256(key_str.encode("utf-8")).hexdigest()
|
| 368 |
return key, key_str
|
| 369 |
|
| 370 |
|
| 371 |
def prepare_lora_cache(
|
| 372 |
+
singularity_strength: float,
|
| 373 |
teneros_strength: float,
|
| 374 |
sulphur_strength: float,
|
| 375 |
pose_strength: float,
|
|
|
|
| 399 |
global PENDING_LORA_KEY, PENDING_LORA_STATE, PENDING_LORA_STATUS
|
| 400 |
|
| 401 |
ledger = pipeline.model_ledger
|
| 402 |
+
key, _ = _make_lora_key(singularity_strength, teneros_strength, sulphur_strength, pose_strength, general_strength, motion_strength, dreamlay_strength, mself_strength, dramatic_strength, fluid_strength, liquid_strength, demopose_strength, voice_strength, realism_strength, transition_strength, physics_strength, reasoning_strength, twostep_strength)
|
| 403 |
cache_path = LORA_CACHE_DIR / f"{key}.safetensors"
|
| 404 |
|
| 405 |
progress(0.05, desc="Preparing LoRA state")
|
|
|
|
| 415 |
print(f"[LoRA] Cache load failed: {type(e).__name__}: {e}")
|
| 416 |
|
| 417 |
entries = [
|
| 418 |
+
(singularity_lora_path, round(float(singularity_strength), 2)),
|
| 419 |
(teneros_lora_path, round(float(teneros_strength), 2)),
|
| 420 |
(sulphur_lora_path, round(float(sulphur_strength), 2)),
|
| 421 |
(pose_lora_path, round(float(pose_strength), 2)),
|
|
|
|
| 617 |
randomize_seed: bool = False,
|
| 618 |
height: int = 0.0,
|
| 619 |
width: int = 0.0,
|
| 620 |
+
singularity_strength: float = 0.0,
|
| 621 |
teneros_strength: float = 0.0,
|
| 622 |
sulphur_strength: float = 0.0,
|
| 623 |
pose_strength: float = 0.0,
|
|
|
|
| 653 |
randomize_seed: bool = True,
|
| 654 |
height: int = 0.0,
|
| 655 |
width: int = 0.0,
|
| 656 |
+
singularity_strength: float = 0.0,
|
| 657 |
teneros_strength: float = 0.0,
|
| 658 |
sulphur_strength: float = 0.0,
|
| 659 |
pose_strength: float = 0.0,
|
|
|
|
| 779 |
high_res = gr.Checkbox(label="High Resolution", value=True)
|
| 780 |
with gr.Column():
|
| 781 |
gr.Markdown("### LoRA adapter strengths (set to 0 to disable; slow and WIP)")
|
| 782 |
+
singularity_strength = gr.Slider(
|
| 783 |
+
label="Singularity Lora strength",
|
| 784 |
+
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 785 |
+
)
|
| 786 |
teneros_strength = gr.Slider(
|
| 787 |
label="10Eros Lora strength",
|
| 788 |
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
|
|
|
| 888 |
|
| 889 |
prepare_lora_btn.click(
|
| 890 |
fn=prepare_lora_cache,
|
| 891 |
+
inputs=[singularity_strength, teneros_strength, sulphur_strength, pose_strength, general_strength, motion_strength, dreamlay_strength, mself_strength, dramatic_strength, fluid_strength, liquid_strength, demopose_strength, voice_strength, realism_strength, transition_strength, physics_strength, reasoning_strength, twostep_strength],
|
| 892 |
outputs=[lora_status],
|
| 893 |
)
|
| 894 |
|
|
|
|
| 897 |
inputs=[
|
| 898 |
first_image, last_image, input_audio, prompt, duration, gpu_duration, enhance_prompt,
|
| 899 |
seed, randomize_seed, height, width,
|
| 900 |
+
singularity_strength, teneros_strength, sulphur_strength, pose_strength, general_strength, motion_strength, dreamlay_strength, mself_strength, dramatic_strength, fluid_strength, liquid_strength, demopose_strength, voice_strength, realism_strength, transition_strength, physics_strength, reasoning_strength, twostep_strength,
|
| 901 |
],
|
| 902 |
outputs=[output_video, seed],
|
| 903 |
)
|