Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -447,6 +447,7 @@ print("=" * 80)
|
|
| 447 |
print("Downloading LoRA adapters from dagloop5/LoRA...")
|
| 448 |
print("=" * 80)
|
| 449 |
pose_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2_3_NSFW_furry_concat_v2.safetensors")
|
|
|
|
| 450 |
general_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2.3_reasoning_I2V_V3.safetensors")
|
| 451 |
motion_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="motion_helper.safetensors")
|
| 452 |
dreamlay_lora_path = hf_hub_download(repo_id="lynaNSFW/DR34ML4Y_AIO_NSFW_LTX23", filename="DR34ML4Y_LTXXX_V2.safetensors") # m15510n4ry, bl0wj0b, d0ubl3_bj, d0gg1e, c0wg1rl
|
|
@@ -463,6 +464,7 @@ reasoning_lora_path = hf_hub_download(repo_id="LiconStudio/Ltx2.3-VBVR-lora-I2V"
|
|
| 463 |
twostep_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2.3_Multi_step_video_reasoning_V0.1.safetensors")
|
| 464 |
|
| 465 |
print(f"Pose LoRA: {pose_lora_path}")
|
|
|
|
| 466 |
print(f"General LoRA: {general_lora_path}")
|
| 467 |
print(f"Motion LoRA: {motion_lora_path}")
|
| 468 |
print(f"Dreamlay LoRA: {dreamlay_lora_path}")
|
|
@@ -490,8 +492,9 @@ pipeline = LTX23DistilledA2VPipeline(
|
|
| 490 |
quantization=QuantizationPolicy.fp8_cast(),
|
| 491 |
)
|
| 492 |
|
| 493 |
-
def _make_lora_key(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]:
|
| 494 |
rp = round(float(pose_strength), 2)
|
|
|
|
| 495 |
rg = round(float(general_strength), 2)
|
| 496 |
rm = round(float(motion_strength), 2)
|
| 497 |
rd = round(float(dreamlay_strength), 2)
|
|
@@ -506,13 +509,14 @@ def _make_lora_key(pose_strength: float, general_strength: float, motion_strengt
|
|
| 506 |
ry = round(float(physics_strength), 2)
|
| 507 |
ri = round(float(reasoning_strength), 2)
|
| 508 |
rw = round(float(twostep_strength), 2)
|
| 509 |
-
key_str = f"{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}"
|
| 510 |
key = hashlib.sha256(key_str.encode("utf-8")).hexdigest()
|
| 511 |
return key, key_str
|
| 512 |
|
| 513 |
|
| 514 |
def prepare_lora_cache(
|
| 515 |
pose_strength: float,
|
|
|
|
| 516 |
general_strength: float,
|
| 517 |
motion_strength: float,
|
| 518 |
dreamlay_strength: float,
|
|
@@ -539,7 +543,7 @@ def prepare_lora_cache(
|
|
| 539 |
global PENDING_LORA_KEY, PENDING_LORA_STATE, PENDING_LORA_STATUS
|
| 540 |
|
| 541 |
ledger = pipeline.model_ledger
|
| 542 |
-
key, _ = _make_lora_key(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)
|
| 543 |
cache_path = LORA_CACHE_DIR / f"{key}.safetensors"
|
| 544 |
|
| 545 |
progress(0.05, desc="Preparing LoRA state")
|
|
@@ -556,6 +560,7 @@ def prepare_lora_cache(
|
|
| 556 |
|
| 557 |
entries = [
|
| 558 |
(pose_lora_path, round(float(pose_strength), 2)),
|
|
|
|
| 559 |
(general_lora_path, round(float(general_strength), 2)),
|
| 560 |
(motion_lora_path, round(float(motion_strength), 2)),
|
| 561 |
(dreamlay_lora_path, round(float(dreamlay_strength), 2)),
|
|
@@ -761,6 +766,7 @@ def get_gpu_duration(
|
|
| 761 |
audio_rescale_scale: float = 1.0,
|
| 762 |
audio_v2a_scale: float = 3.0,
|
| 763 |
pose_strength: float = 0.0,
|
|
|
|
| 764 |
general_strength: float = 0.0,
|
| 765 |
motion_strength: float = 0.0,
|
| 766 |
dreamlay_strength: float = 0.0,
|
|
@@ -804,6 +810,7 @@ def generate_video(
|
|
| 804 |
audio_rescale_scale: float = 1.0,
|
| 805 |
audio_v2a_scale: float = 3.0,
|
| 806 |
pose_strength: float = 0.0,
|
|
|
|
| 807 |
general_strength: float = 0.0,
|
| 808 |
motion_strength: float = 0.0,
|
| 809 |
dreamlay_strength: float = 0.0,
|
|
@@ -1031,7 +1038,7 @@ with gr.Blocks(title="LTX-2.3 Distilled with LoRAs, Negative Prompting, and Adva
|
|
| 1031 |
|
| 1032 |
with gr.Row():
|
| 1033 |
pose_strength = gr.Slider(label="Anthro Enhancer", minimum=0.0, maximum=2.0, value=0.0, step=0.01)
|
| 1034 |
-
gr.
|
| 1035 |
|
| 1036 |
with gr.Row():
|
| 1037 |
general_strength = gr.Slider(label="Reasoning Enhancer", minimum=0.0, maximum=2.0, value=0.0, step=0.01)
|
|
@@ -1074,7 +1081,7 @@ with gr.Blocks(title="LTX-2.3 Distilled with LoRAs, Negative Prompting, and Adva
|
|
| 1074 |
|
| 1075 |
prepare_lora_btn.click(
|
| 1076 |
fn=prepare_lora_cache,
|
| 1077 |
-
inputs=[pose_strength, general_strength, motion_strength, dreamlay_strength,
|
| 1078 |
mself_strength, dramatic_strength, fluid_strength, liquid_strength,
|
| 1079 |
demopose_strength, voice_strength, realism_strength, transition_strength, physics_strength, reasoning_strength, twostep_strength],
|
| 1080 |
outputs=[lora_status],
|
|
@@ -1087,7 +1094,7 @@ with gr.Blocks(title="LTX-2.3 Distilled with LoRAs, Negative Prompting, and Adva
|
|
| 1087 |
enhance_prompt, seed, randomize_seed, height, width,
|
| 1088 |
video_cfg_scale, video_stg_scale, video_rescale_scale, video_a2v_scale,
|
| 1089 |
audio_cfg_scale, audio_stg_scale, audio_rescale_scale, audio_v2a_scale,
|
| 1090 |
-
pose_strength, general_strength, motion_strength,
|
| 1091 |
dreamlay_strength, mself_strength, dramatic_strength, fluid_strength,
|
| 1092 |
liquid_strength, demopose_strength, voice_strength, realism_strength,
|
| 1093 |
transition_strength, physics_strength, reasoning_strength, twostep_strength, num_inference_steps,
|
|
|
|
| 447 |
print("Downloading LoRA adapters from dagloop5/LoRA...")
|
| 448 |
print("=" * 80)
|
| 449 |
pose_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2_3_NSFW_furry_concat_v2.safetensors")
|
| 450 |
+
twod_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2.3_2d_NSFW_motion_enhancer.safetensors") # 2d style animation
|
| 451 |
general_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2.3_reasoning_I2V_V3.safetensors")
|
| 452 |
motion_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="motion_helper.safetensors")
|
| 453 |
dreamlay_lora_path = hf_hub_download(repo_id="lynaNSFW/DR34ML4Y_AIO_NSFW_LTX23", filename="DR34ML4Y_LTXXX_V2.safetensors") # m15510n4ry, bl0wj0b, d0ubl3_bj, d0gg1e, c0wg1rl
|
|
|
|
| 464 |
twostep_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2.3_Multi_step_video_reasoning_V0.1.safetensors")
|
| 465 |
|
| 466 |
print(f"Pose LoRA: {pose_lora_path}")
|
| 467 |
+
print(f"twod LoRA: {twod_lora_path}")
|
| 468 |
print(f"General LoRA: {general_lora_path}")
|
| 469 |
print(f"Motion LoRA: {motion_lora_path}")
|
| 470 |
print(f"Dreamlay LoRA: {dreamlay_lora_path}")
|
|
|
|
| 492 |
quantization=QuantizationPolicy.fp8_cast(),
|
| 493 |
)
|
| 494 |
|
| 495 |
+
def _make_lora_key(pose_strength: float, twod_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]:
|
| 496 |
rp = round(float(pose_strength), 2)
|
| 497 |
+
ra = round(float(twod_strength), 2)
|
| 498 |
rg = round(float(general_strength), 2)
|
| 499 |
rm = round(float(motion_strength), 2)
|
| 500 |
rd = round(float(dreamlay_strength), 2)
|
|
|
|
| 509 |
ry = round(float(physics_strength), 2)
|
| 510 |
ri = round(float(reasoning_strength), 2)
|
| 511 |
rw = round(float(twostep_strength), 2)
|
| 512 |
+
key_str = f"{pose_lora_path}:{rp}|{twod_lora_path}:{ra}|{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}"
|
| 513 |
key = hashlib.sha256(key_str.encode("utf-8")).hexdigest()
|
| 514 |
return key, key_str
|
| 515 |
|
| 516 |
|
| 517 |
def prepare_lora_cache(
|
| 518 |
pose_strength: float,
|
| 519 |
+
twod_strength: float,
|
| 520 |
general_strength: float,
|
| 521 |
motion_strength: float,
|
| 522 |
dreamlay_strength: float,
|
|
|
|
| 543 |
global PENDING_LORA_KEY, PENDING_LORA_STATE, PENDING_LORA_STATUS
|
| 544 |
|
| 545 |
ledger = pipeline.model_ledger
|
| 546 |
+
key, _ = _make_lora_key(pose_strength, twod_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)
|
| 547 |
cache_path = LORA_CACHE_DIR / f"{key}.safetensors"
|
| 548 |
|
| 549 |
progress(0.05, desc="Preparing LoRA state")
|
|
|
|
| 560 |
|
| 561 |
entries = [
|
| 562 |
(pose_lora_path, round(float(pose_strength), 2)),
|
| 563 |
+
(twod_lora_path, round(float(twod_strength), 2)),
|
| 564 |
(general_lora_path, round(float(general_strength), 2)),
|
| 565 |
(motion_lora_path, round(float(motion_strength), 2)),
|
| 566 |
(dreamlay_lora_path, round(float(dreamlay_strength), 2)),
|
|
|
|
| 766 |
audio_rescale_scale: float = 1.0,
|
| 767 |
audio_v2a_scale: float = 3.0,
|
| 768 |
pose_strength: float = 0.0,
|
| 769 |
+
twod_strength: float = 0.0,
|
| 770 |
general_strength: float = 0.0,
|
| 771 |
motion_strength: float = 0.0,
|
| 772 |
dreamlay_strength: float = 0.0,
|
|
|
|
| 810 |
audio_rescale_scale: float = 1.0,
|
| 811 |
audio_v2a_scale: float = 3.0,
|
| 812 |
pose_strength: float = 0.0,
|
| 813 |
+
twod_strength: float = 0.0,
|
| 814 |
general_strength: float = 0.0,
|
| 815 |
motion_strength: float = 0.0,
|
| 816 |
dreamlay_strength: float = 0.0,
|
|
|
|
| 1038 |
|
| 1039 |
with gr.Row():
|
| 1040 |
pose_strength = gr.Slider(label="Anthro Enhancer", minimum=0.0, maximum=2.0, value=0.0, step=0.01)
|
| 1041 |
+
twod_strength = gr.Slider(label="2D Enhancer", minimum=0.0, maximum=2.0, value=0.0, step=0.01)
|
| 1042 |
|
| 1043 |
with gr.Row():
|
| 1044 |
general_strength = gr.Slider(label="Reasoning Enhancer", minimum=0.0, maximum=2.0, value=0.0, step=0.01)
|
|
|
|
| 1081 |
|
| 1082 |
prepare_lora_btn.click(
|
| 1083 |
fn=prepare_lora_cache,
|
| 1084 |
+
inputs=[pose_strength, twod_strength, general_strength, motion_strength, dreamlay_strength,
|
| 1085 |
mself_strength, dramatic_strength, fluid_strength, liquid_strength,
|
| 1086 |
demopose_strength, voice_strength, realism_strength, transition_strength, physics_strength, reasoning_strength, twostep_strength],
|
| 1087 |
outputs=[lora_status],
|
|
|
|
| 1094 |
enhance_prompt, seed, randomize_seed, height, width,
|
| 1095 |
video_cfg_scale, video_stg_scale, video_rescale_scale, video_a2v_scale,
|
| 1096 |
audio_cfg_scale, audio_stg_scale, audio_rescale_scale, audio_v2a_scale,
|
| 1097 |
+
pose_strength, twod_strength, general_strength, motion_strength,
|
| 1098 |
dreamlay_strength, mself_strength, dramatic_strength, fluid_strength,
|
| 1099 |
liquid_strength, demopose_strength, voice_strength, realism_strength,
|
| 1100 |
transition_strength, physics_strength, reasoning_strength, twostep_strength, num_inference_steps,
|