Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -308,6 +308,7 @@ transition_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX-2_takerp
|
|
| 308 |
physics_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2.3_Physics_V2_000002000.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}")
|
|
@@ -327,6 +328,7 @@ print(f"Transition LoRA: {transition_lora_path}")
|
|
| 327 |
print(f"Physics LoRA: {physics_lora_path}")
|
| 328 |
print(f"Reasoning LoRA: {reasoning_lora_path}")
|
| 329 |
print(f"Twostep LoRA: {twostep_lora_path}")
|
|
|
|
| 330 |
# ----------------------------------------------------------------
|
| 331 |
|
| 332 |
print(f"Checkpoint: {checkpoint_path}")
|
|
@@ -344,7 +346,7 @@ pipeline = LTX23DistilledA2VPipeline(
|
|
| 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)
|
|
@@ -363,7 +365,8 @@ def _make_lora_key(singularity_strength: float, teneros_strength: float, sulphur
|
|
| 363 |
ry = round(float(physics_strength), 2)
|
| 364 |
ri = round(float(reasoning_strength), 2)
|
| 365 |
rw = round(float(twostep_strength), 2)
|
| 366 |
-
|
|
|
|
| 367 |
key = hashlib.sha256(key_str.encode("utf-8")).hexdigest()
|
| 368 |
return key, key_str
|
| 369 |
|
|
@@ -387,6 +390,7 @@ def prepare_lora_cache(
|
|
| 387 |
physics_strength: float,
|
| 388 |
reasoning_strength: float,
|
| 389 |
twostep_strength: float,
|
|
|
|
| 390 |
progress=gr.Progress(track_tqdm=True),
|
| 391 |
):
|
| 392 |
"""
|
|
@@ -399,7 +403,7 @@ def prepare_lora_cache(
|
|
| 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")
|
|
@@ -433,6 +437,7 @@ def prepare_lora_cache(
|
|
| 433 |
(physics_lora_path, round(float(physics_strength), 2)),
|
| 434 |
(reasoning_lora_path, round(float(reasoning_strength), 2)),
|
| 435 |
(twostep_lora_path, round(float(twostep_strength), 2)),
|
|
|
|
| 436 |
]
|
| 437 |
loras_for_builder = [
|
| 438 |
LoraPathStrengthAndSDOps(path, strength, LTXV_LORA_COMFY_RENAMING_MAP)
|
|
@@ -635,6 +640,7 @@ def get_gpu_duration(
|
|
| 635 |
physics_strength: float = 0.0,
|
| 636 |
reasoning_strength: float = 0.0,
|
| 637 |
twostep_strength: float = 0.0,
|
|
|
|
| 638 |
progress=None,
|
| 639 |
):
|
| 640 |
return int(gpu_duration)
|
|
@@ -671,6 +677,7 @@ def generate_video(
|
|
| 671 |
physics_strength: float = 0.0,
|
| 672 |
reasoning_strength: float = 0.0,
|
| 673 |
twostep_strength: float = 0.0,
|
|
|
|
| 674 |
progress=gr.Progress(track_tqdm=True),
|
| 675 |
):
|
| 676 |
try:
|
|
@@ -851,6 +858,10 @@ with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
|
| 851 |
label="Two Step Reasoning strength",
|
| 852 |
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 853 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 854 |
prepare_lora_btn = gr.Button("Prepare / Load LoRA Cache", variant="secondary")
|
| 855 |
lora_status = gr.Textbox(
|
| 856 |
label="LoRA Cache Status",
|
|
@@ -888,7 +899,7 @@ with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
|
| 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,7 +908,7 @@ with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
|
| 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 |
)
|
|
|
|
| 308 |
physics_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2.3_Physics_V2_000002000.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 |
+
mcfurry_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX-2_3_mc_Furry_realistic_lora_v1.safetensors")
|
| 312 |
|
| 313 |
print(f"Singularity LoRA: {singularity_lora_path}")
|
| 314 |
print(f"10Eros LoRA: {teneros_lora_path}")
|
|
|
|
| 328 |
print(f"Physics LoRA: {physics_lora_path}")
|
| 329 |
print(f"Reasoning LoRA: {reasoning_lora_path}")
|
| 330 |
print(f"Twostep LoRA: {twostep_lora_path}")
|
| 331 |
+
print(f"Mcfurry LoRA: {mcfurry_lora_path}")
|
| 332 |
# ----------------------------------------------------------------
|
| 333 |
|
| 334 |
print(f"Checkpoint: {checkpoint_path}")
|
|
|
|
| 346 |
)
|
| 347 |
# ----------------------------------------------------------------
|
| 348 |
|
| 349 |
+
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, mcfurry_strength: float) -> tuple[str, str]:
|
| 350 |
rx = round(float(singularity_strength), 2)
|
| 351 |
ra = round(float(teneros_strength), 2)
|
| 352 |
rb = round(float(sulphur_strength), 2)
|
|
|
|
| 365 |
ry = round(float(physics_strength), 2)
|
| 366 |
ri = round(float(reasoning_strength), 2)
|
| 367 |
rw = round(float(twostep_strength), 2)
|
| 368 |
+
mc = round(float(mcfurry_strength), 2)
|
| 369 |
+
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}|{mcfurry_lora_path}:{mc}"
|
| 370 |
key = hashlib.sha256(key_str.encode("utf-8")).hexdigest()
|
| 371 |
return key, key_str
|
| 372 |
|
|
|
|
| 390 |
physics_strength: float,
|
| 391 |
reasoning_strength: float,
|
| 392 |
twostep_strength: float,
|
| 393 |
+
mcfurry_strength: float,
|
| 394 |
progress=gr.Progress(track_tqdm=True),
|
| 395 |
):
|
| 396 |
"""
|
|
|
|
| 403 |
global PENDING_LORA_KEY, PENDING_LORA_STATE, PENDING_LORA_STATUS
|
| 404 |
|
| 405 |
ledger = pipeline.model_ledger
|
| 406 |
+
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, mcfurry_strength)
|
| 407 |
cache_path = LORA_CACHE_DIR / f"{key}.safetensors"
|
| 408 |
|
| 409 |
progress(0.05, desc="Preparing LoRA state")
|
|
|
|
| 437 |
(physics_lora_path, round(float(physics_strength), 2)),
|
| 438 |
(reasoning_lora_path, round(float(reasoning_strength), 2)),
|
| 439 |
(twostep_lora_path, round(float(twostep_strength), 2)),
|
| 440 |
+
(mcfurry_lora_path, round(float(mcfurry_strength), 2)),
|
| 441 |
]
|
| 442 |
loras_for_builder = [
|
| 443 |
LoraPathStrengthAndSDOps(path, strength, LTXV_LORA_COMFY_RENAMING_MAP)
|
|
|
|
| 640 |
physics_strength: float = 0.0,
|
| 641 |
reasoning_strength: float = 0.0,
|
| 642 |
twostep_strength: float = 0.0,
|
| 643 |
+
mcfurry_strength: float = 0.0,
|
| 644 |
progress=None,
|
| 645 |
):
|
| 646 |
return int(gpu_duration)
|
|
|
|
| 677 |
physics_strength: float = 0.0,
|
| 678 |
reasoning_strength: float = 0.0,
|
| 679 |
twostep_strength: float = 0.0,
|
| 680 |
+
mcfurry_strength: float = 0.0,
|
| 681 |
progress=gr.Progress(track_tqdm=True),
|
| 682 |
):
|
| 683 |
try:
|
|
|
|
| 858 |
label="Two Step Reasoning strength",
|
| 859 |
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 860 |
)
|
| 861 |
+
mcfurry_strength = gr.Slider(
|
| 862 |
+
label="t2v anthro realism strength",
|
| 863 |
+
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 864 |
+
)
|
| 865 |
prepare_lora_btn = gr.Button("Prepare / Load LoRA Cache", variant="secondary")
|
| 866 |
lora_status = gr.Textbox(
|
| 867 |
label="LoRA Cache Status",
|
|
|
|
| 899 |
|
| 900 |
prepare_lora_btn.click(
|
| 901 |
fn=prepare_lora_cache,
|
| 902 |
+
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, mcfurry_strength],
|
| 903 |
outputs=[lora_status],
|
| 904 |
)
|
| 905 |
|
|
|
|
| 908 |
inputs=[
|
| 909 |
first_image, last_image, input_audio, prompt, duration, gpu_duration, enhance_prompt,
|
| 910 |
seed, randomize_seed, height, width,
|
| 911 |
+
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, mcfurry_strength,
|
| 912 |
],
|
| 913 |
outputs=[output_video, seed],
|
| 914 |
)
|