Spaces:
Running on Zero
Running on Zero
Rename app(currentwithcustomcheckpointand1stage).py to app.py
Browse files
app(currentwithcustomcheckpointand1stage).py → app.py
RENAMED
|
@@ -6,9 +6,6 @@ import sys
|
|
| 6 |
os.environ["TORCH_COMPILE_DISABLE"] = "1"
|
| 7 |
os.environ["TORCHDYNAMO_DISABLE"] = "1"
|
| 8 |
|
| 9 |
-
# Install xformers for memory-efficient attention
|
| 10 |
-
subprocess.run([sys.executable, "-m", "pip", "install", "xformers==0.0.32.post2", "--no-build-isolation"], check=False)
|
| 11 |
-
|
| 12 |
# Clone LTX-2 repo and install packages
|
| 13 |
LTX_REPO_URL = "https://github.com/Lightricks/LTX-2.git"
|
| 14 |
LTX_REPO_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "LTX-2")
|
|
@@ -79,16 +76,6 @@ from ltx_core.loader.sd_ops import LTXV_LORA_COMFY_RENAMING_MAP
|
|
| 79 |
|
| 80 |
from ltx_pipelines.utils.types import PipelineComponents
|
| 81 |
|
| 82 |
-
# Force-patch xformers attention into the LTX attention module.
|
| 83 |
-
from ltx_core.model.transformer import attention as _attn_mod
|
| 84 |
-
print(f"[ATTN] Before patch: memory_efficient_attention={_attn_mod.memory_efficient_attention}")
|
| 85 |
-
try:
|
| 86 |
-
from xformers.ops import memory_efficient_attention as _mea
|
| 87 |
-
_attn_mod.memory_efficient_attention = _mea
|
| 88 |
-
print(f"[ATTN] After patch: memory_efficient_attention={_attn_mod.memory_efficient_attention}")
|
| 89 |
-
except Exception as e:
|
| 90 |
-
print(f"[ATTN] xformers patch FAILED: {type(e).__name__}: {e}")
|
| 91 |
-
|
| 92 |
logging.getLogger().setLevel(logging.INFO)
|
| 93 |
|
| 94 |
MAX_SEED = np.iinfo(np.int32).max
|
|
@@ -245,8 +232,8 @@ PENDING_LORA_STATUS: str = "No LoRA state prepared yet."
|
|
| 245 |
weights_dir = Path("weights")
|
| 246 |
weights_dir.mkdir(exist_ok=True)
|
| 247 |
checkpoint_path = hf_hub_download(
|
| 248 |
-
repo_id="
|
| 249 |
-
filename="
|
| 250 |
local_dir=str(weights_dir),
|
| 251 |
local_dir_use_symlinks=False,
|
| 252 |
)
|
|
@@ -261,22 +248,27 @@ LORA_REPO = "dagloop5/LoRA"
|
|
| 261 |
print("=" * 80)
|
| 262 |
print("Downloading LoRA adapters from dagloop5/LoRA...")
|
| 263 |
print("=" * 80)
|
|
|
|
| 264 |
pose_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2_3_NSFW_furry_concat_v2.safetensors")
|
|
|
|
| 265 |
general_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2.3_reasoning_I2V_V3.safetensors")
|
| 266 |
motion_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="motion_helper.safetensors")
|
| 267 |
-
dreamlay_lora_path = hf_hub_download(repo_id=
|
| 268 |
mself_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="Furry Hyper Masturbation - LTX-2 I2V v1.safetensors") # Hyperfap
|
| 269 |
dramatic_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX-2.3 - Orgasm.safetensors") # "[He | She] is having am orgasm." (am or an?)
|
| 270 |
-
fluid_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="
|
| 271 |
liquid_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="liquid_wet_dr1pp_ltx2_v1.0_scaled.safetensors") # wet dr1pp
|
| 272 |
demopose_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="clapping-cheeks-audio-v001-alpha.safetensors")
|
| 273 |
voice_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="hentai_voice_ltx23.safetensors")
|
| 274 |
-
realism_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="FurryenhancerLTX2.
|
| 275 |
transition_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX-2_takerpov_lora_v1.2.safetensors") # takerpov1, taker pov
|
| 276 |
-
physics_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2.
|
| 277 |
-
reasoning_lora_path = hf_hub_download(repo_id="
|
|
|
|
| 278 |
|
|
|
|
| 279 |
print(f"Pose LoRA: {pose_lora_path}")
|
|
|
|
| 280 |
print(f"General LoRA: {general_lora_path}")
|
| 281 |
print(f"Motion LoRA: {motion_lora_path}")
|
| 282 |
print(f"Dreamlay LoRA: {dreamlay_lora_path}")
|
|
@@ -290,7 +282,7 @@ print(f"Realism LoRA: {realism_lora_path}")
|
|
| 290 |
print(f"Transition LoRA: {transition_lora_path}")
|
| 291 |
print(f"Physics LoRA: {physics_lora_path}")
|
| 292 |
print(f"Reasoning LoRA: {reasoning_lora_path}")
|
| 293 |
-
|
| 294 |
|
| 295 |
print(f"Checkpoint: {checkpoint_path}")
|
| 296 |
print(f"Spatial upsampler: {spatial_upsampler_path}")
|
|
@@ -307,8 +299,10 @@ pipeline = LTX23DistilledA2VPipeline(
|
|
| 307 |
)
|
| 308 |
# ----------------------------------------------------------------
|
| 309 |
|
| 310 |
-
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) -> tuple[str, str]:
|
|
|
|
| 311 |
rp = round(float(pose_strength), 2)
|
|
|
|
| 312 |
rg = round(float(general_strength), 2)
|
| 313 |
rm = round(float(motion_strength), 2)
|
| 314 |
rd = round(float(dreamlay_strength), 2)
|
|
@@ -322,13 +316,16 @@ def _make_lora_key(pose_strength: float, general_strength: float, motion_strengt
|
|
| 322 |
rt = round(float(transition_strength), 2)
|
| 323 |
ry = round(float(physics_strength), 2)
|
| 324 |
ri = round(float(reasoning_strength), 2)
|
| 325 |
-
|
|
|
|
| 326 |
key = hashlib.sha256(key_str.encode("utf-8")).hexdigest()
|
| 327 |
return key, key_str
|
| 328 |
|
| 329 |
|
| 330 |
def prepare_lora_cache(
|
|
|
|
| 331 |
pose_strength: float,
|
|
|
|
| 332 |
general_strength: float,
|
| 333 |
motion_strength: float,
|
| 334 |
dreamlay_strength: float,
|
|
@@ -342,6 +339,7 @@ def prepare_lora_cache(
|
|
| 342 |
transition_strength: float,
|
| 343 |
physics_strength: float,
|
| 344 |
reasoning_strength: float,
|
|
|
|
| 345 |
progress=gr.Progress(track_tqdm=True),
|
| 346 |
):
|
| 347 |
"""
|
|
@@ -354,7 +352,7 @@ def prepare_lora_cache(
|
|
| 354 |
global PENDING_LORA_KEY, PENDING_LORA_STATE, PENDING_LORA_STATUS
|
| 355 |
|
| 356 |
ledger = pipeline.model_ledger
|
| 357 |
-
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)
|
| 358 |
cache_path = LORA_CACHE_DIR / f"{key}.safetensors"
|
| 359 |
|
| 360 |
progress(0.05, desc="Preparing LoRA state")
|
|
@@ -370,7 +368,9 @@ def prepare_lora_cache(
|
|
| 370 |
print(f"[LoRA] Cache load failed: {type(e).__name__}: {e}")
|
| 371 |
|
| 372 |
entries = [
|
|
|
|
| 373 |
(pose_lora_path, round(float(pose_strength), 2)),
|
|
|
|
| 374 |
(general_lora_path, round(float(general_strength), 2)),
|
| 375 |
(motion_lora_path, round(float(motion_strength), 2)),
|
| 376 |
(dreamlay_lora_path, round(float(dreamlay_strength), 2)),
|
|
@@ -384,6 +384,7 @@ def prepare_lora_cache(
|
|
| 384 |
(transition_lora_path, round(float(transition_strength), 2)),
|
| 385 |
(physics_lora_path, round(float(physics_strength), 2)),
|
| 386 |
(reasoning_lora_path, round(float(reasoning_strength), 2)),
|
|
|
|
| 387 |
]
|
| 388 |
loras_for_builder = [
|
| 389 |
LoraPathStrengthAndSDOps(path, strength, LTXV_LORA_COMFY_RENAMING_MAP)
|
|
@@ -567,7 +568,9 @@ def get_gpu_duration(
|
|
| 567 |
randomize_seed: bool = True,
|
| 568 |
height: int = 1024,
|
| 569 |
width: int = 1536,
|
|
|
|
| 570 |
pose_strength: float = 0.0,
|
|
|
|
| 571 |
general_strength: float = 0.0,
|
| 572 |
motion_strength: float = 0.0,
|
| 573 |
dreamlay_strength: float = 0.0,
|
|
@@ -581,6 +584,7 @@ def get_gpu_duration(
|
|
| 581 |
transition_strength: float = 0.0,
|
| 582 |
physics_strength: float = 0.0,
|
| 583 |
reasoning_strength: float = 0.0,
|
|
|
|
| 584 |
progress=None,
|
| 585 |
):
|
| 586 |
return int(gpu_duration)
|
|
@@ -598,7 +602,9 @@ def generate_video(
|
|
| 598 |
randomize_seed: bool = True,
|
| 599 |
height: int = 1024,
|
| 600 |
width: int = 1536,
|
|
|
|
| 601 |
pose_strength: float = 0.0,
|
|
|
|
| 602 |
general_strength: float = 0.0,
|
| 603 |
motion_strength: float = 0.0,
|
| 604 |
dreamlay_strength: float = 0.0,
|
|
@@ -612,6 +618,7 @@ def generate_video(
|
|
| 612 |
transition_strength: float = 0.0,
|
| 613 |
physics_strength: float = 0.0,
|
| 614 |
reasoning_strength: float = 0.0,
|
|
|
|
| 615 |
progress=gr.Progress(track_tqdm=True),
|
| 616 |
):
|
| 617 |
try:
|
|
@@ -718,6 +725,10 @@ with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
|
| 718 |
high_res = gr.Checkbox(label="High Resolution", value=True)
|
| 719 |
with gr.Column():
|
| 720 |
gr.Markdown("### LoRA adapter strengths (set to 0 to disable; slow and WIP)")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 721 |
pose_strength = gr.Slider(
|
| 722 |
label="Anthro Enhancer strength",
|
| 723 |
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
|
@@ -771,7 +782,11 @@ with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
|
| 771 |
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 772 |
)
|
| 773 |
reasoning_strength = gr.Slider(
|
| 774 |
-
label="
|
|
|
|
|
|
|
|
|
|
|
|
|
| 775 |
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 776 |
)
|
| 777 |
prepare_lora_btn = gr.Button("Prepare / Load LoRA Cache", variant="secondary")
|
|
@@ -791,47 +806,6 @@ with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
|
| 791 |
step=1.0,
|
| 792 |
)
|
| 793 |
|
| 794 |
-
gr.Examples(
|
| 795 |
-
examples=[
|
| 796 |
-
[
|
| 797 |
-
None,
|
| 798 |
-
"pinkknit.jpg",
|
| 799 |
-
"The camera falls downward through darkness as if dropped into a tunnel. "
|
| 800 |
-
"As it slows, five friends wearing pink knitted hats and sunglasses lean "
|
| 801 |
-
"over and look down toward the camera with curious expressions. The lens "
|
| 802 |
-
"has a strong fisheye effect, creating a circular frame around them. They "
|
| 803 |
-
"crowd together closely, forming a symmetrical cluster while staring "
|
| 804 |
-
"directly into the lens.",
|
| 805 |
-
3.0,
|
| 806 |
-
80.0,
|
| 807 |
-
False,
|
| 808 |
-
42,
|
| 809 |
-
True,
|
| 810 |
-
1024,
|
| 811 |
-
1024,
|
| 812 |
-
0.0, # pose_strength (example)
|
| 813 |
-
0.0, # general_strength (example)
|
| 814 |
-
0.0, # motion_strength (example)
|
| 815 |
-
0.0,
|
| 816 |
-
0.0,
|
| 817 |
-
0.0,
|
| 818 |
-
0.0,
|
| 819 |
-
0.0,
|
| 820 |
-
0.0,
|
| 821 |
-
0.0,
|
| 822 |
-
0.0,
|
| 823 |
-
0.0,
|
| 824 |
-
0.0,
|
| 825 |
-
0.0,
|
| 826 |
-
],
|
| 827 |
-
],
|
| 828 |
-
inputs=[
|
| 829 |
-
first_image, last_image, prompt, duration, gpu_duration,
|
| 830 |
-
enhance_prompt, seed, randomize_seed, height, width,
|
| 831 |
-
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,
|
| 832 |
-
],
|
| 833 |
-
)
|
| 834 |
-
|
| 835 |
first_image.change(
|
| 836 |
fn=on_image_upload,
|
| 837 |
inputs=[first_image, last_image, high_res],
|
|
@@ -852,7 +826,7 @@ with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
|
| 852 |
|
| 853 |
prepare_lora_btn.click(
|
| 854 |
fn=prepare_lora_cache,
|
| 855 |
-
inputs=[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],
|
| 856 |
outputs=[lora_status],
|
| 857 |
)
|
| 858 |
|
|
@@ -861,7 +835,7 @@ with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
|
| 861 |
inputs=[
|
| 862 |
first_image, last_image, prompt, duration, gpu_duration, enhance_prompt,
|
| 863 |
seed, randomize_seed, height, width,
|
| 864 |
-
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,
|
| 865 |
],
|
| 866 |
outputs=[output_video, seed],
|
| 867 |
)
|
|
|
|
| 6 |
os.environ["TORCH_COMPILE_DISABLE"] = "1"
|
| 7 |
os.environ["TORCHDYNAMO_DISABLE"] = "1"
|
| 8 |
|
|
|
|
|
|
|
|
|
|
| 9 |
# Clone LTX-2 repo and install packages
|
| 10 |
LTX_REPO_URL = "https://github.com/Lightricks/LTX-2.git"
|
| 11 |
LTX_REPO_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "LTX-2")
|
|
|
|
| 76 |
|
| 77 |
from ltx_pipelines.utils.types import PipelineComponents
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
logging.getLogger().setLevel(logging.INFO)
|
| 80 |
|
| 81 |
MAX_SEED = np.iinfo(np.int32).max
|
|
|
|
| 232 |
weights_dir = Path("weights")
|
| 233 |
weights_dir.mkdir(exist_ok=True)
|
| 234 |
checkpoint_path = hf_hub_download(
|
| 235 |
+
repo_id="TenStrip/LTX2.3-10Eros",
|
| 236 |
+
filename="10Eros_v1_bf16.safetensors",
|
| 237 |
local_dir=str(weights_dir),
|
| 238 |
local_dir_use_symlinks=False,
|
| 239 |
)
|
|
|
|
| 248 |
print("=" * 80)
|
| 249 |
print("Downloading LoRA adapters from dagloop5/LoRA...")
|
| 250 |
print("=" * 80)
|
| 251 |
+
distilled_lora_path = hf_hub_download(repo_id="TenStrip/LTX2.3_Distilled_Lora_1.1_Experiments", filename="ltx-2.3-22b-distilled-lora-1.1_fro90_ceil72_condsafe.safetensors")
|
| 252 |
pose_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2_3_NSFW_furry_concat_v2.safetensors")
|
| 253 |
+
twod_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2.3_2d_NSFW_motion_enhancer.safetensors") # 2d style animation
|
| 254 |
general_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2.3_reasoning_I2V_V3.safetensors")
|
| 255 |
motion_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="motion_helper.safetensors")
|
| 256 |
+
dreamlay_lora_path = hf_hub_download(repo_id="lynaNSFW/DR34ML4Y_AIO_NSFW_LTX23", filename="DR34ML4Y_LTXXX_V2.safetensors") # m15510n4ry, bl0wj0b, d0ubl3_bj, d0gg1e, c0wg1rl
|
| 257 |
mself_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="Furry Hyper Masturbation - LTX-2 I2V v1.safetensors") # Hyperfap
|
| 258 |
dramatic_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX-2.3 - Orgasm.safetensors") # "[He | She] is having am orgasm." (am or an?)
|
| 259 |
+
fluid_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="Cr3ampi3_animation_sulphur-2_i2v_v1.0.safetensors") # cr3ampi3 animation
|
| 260 |
liquid_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="liquid_wet_dr1pp_ltx2_v1.0_scaled.safetensors") # wet dr1pp
|
| 261 |
demopose_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="clapping-cheeks-audio-v001-alpha.safetensors")
|
| 262 |
voice_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="hentai_voice_ltx23.safetensors")
|
| 263 |
+
realism_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="FurryenhancerLTX2.3V4.094fused.safetensors")
|
| 264 |
transition_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX-2_takerpov_lora_v1.2.safetensors") # takerpov1, taker pov
|
| 265 |
+
physics_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2.3_Physics_V2_000002000.safetensors")
|
| 266 |
+
reasoning_lora_path = hf_hub_download(repo_id="LiconStudio/Ltx2.3-VBVR-lora-I2V", filename="Ltx2.3-Licon-VBVR-I2V-390K-R32.safetensors")
|
| 267 |
+
twostep_lora_path = hf_hub_download(repo_id=LORA_REPO, filename="LTX2.3_Multi_step_video_reasoning_V0.1.safetensors")
|
| 268 |
|
| 269 |
+
print(f"Distilled LoRA: {distilled_lora_path}")
|
| 270 |
print(f"Pose LoRA: {pose_lora_path}")
|
| 271 |
+
print(f"twod LoRA: {twod_lora_path}")
|
| 272 |
print(f"General LoRA: {general_lora_path}")
|
| 273 |
print(f"Motion LoRA: {motion_lora_path}")
|
| 274 |
print(f"Dreamlay LoRA: {dreamlay_lora_path}")
|
|
|
|
| 282 |
print(f"Transition LoRA: {transition_lora_path}")
|
| 283 |
print(f"Physics LoRA: {physics_lora_path}")
|
| 284 |
print(f"Reasoning LoRA: {reasoning_lora_path}")
|
| 285 |
+
print(f"Twostep LoRA: {twostep_lora_path}")
|
| 286 |
|
| 287 |
print(f"Checkpoint: {checkpoint_path}")
|
| 288 |
print(f"Spatial upsampler: {spatial_upsampler_path}")
|
|
|
|
| 299 |
)
|
| 300 |
# ----------------------------------------------------------------
|
| 301 |
|
| 302 |
+
def _make_lora_key(distilled_strength: float, 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]:
|
| 303 |
+
rx = round(float(distilled_strength), 2)
|
| 304 |
rp = round(float(pose_strength), 2)
|
| 305 |
+
ra = round(float(twod_strength), 2)
|
| 306 |
rg = round(float(general_strength), 2)
|
| 307 |
rm = round(float(motion_strength), 2)
|
| 308 |
rd = round(float(dreamlay_strength), 2)
|
|
|
|
| 316 |
rt = round(float(transition_strength), 2)
|
| 317 |
ry = round(float(physics_strength), 2)
|
| 318 |
ri = round(float(reasoning_strength), 2)
|
| 319 |
+
rw = round(float(twostep_strength), 2)
|
| 320 |
+
key_str = f"{distilled_lora_path}:{rx}|{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}"
|
| 321 |
key = hashlib.sha256(key_str.encode("utf-8")).hexdigest()
|
| 322 |
return key, key_str
|
| 323 |
|
| 324 |
|
| 325 |
def prepare_lora_cache(
|
| 326 |
+
distilled_strength: float,
|
| 327 |
pose_strength: float,
|
| 328 |
+
twod_strength: float,
|
| 329 |
general_strength: float,
|
| 330 |
motion_strength: float,
|
| 331 |
dreamlay_strength: float,
|
|
|
|
| 339 |
transition_strength: float,
|
| 340 |
physics_strength: float,
|
| 341 |
reasoning_strength: float,
|
| 342 |
+
twostep_strength: float,
|
| 343 |
progress=gr.Progress(track_tqdm=True),
|
| 344 |
):
|
| 345 |
"""
|
|
|
|
| 352 |
global PENDING_LORA_KEY, PENDING_LORA_STATE, PENDING_LORA_STATUS
|
| 353 |
|
| 354 |
ledger = pipeline.model_ledger
|
| 355 |
+
key, _ = _make_lora_key(distilled_strength, 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)
|
| 356 |
cache_path = LORA_CACHE_DIR / f"{key}.safetensors"
|
| 357 |
|
| 358 |
progress(0.05, desc="Preparing LoRA state")
|
|
|
|
| 368 |
print(f"[LoRA] Cache load failed: {type(e).__name__}: {e}")
|
| 369 |
|
| 370 |
entries = [
|
| 371 |
+
(distilled_lora_path, round(float(distilled_strength), 2)),
|
| 372 |
(pose_lora_path, round(float(pose_strength), 2)),
|
| 373 |
+
(twod_lora_path, round(float(twod_strength), 2)),
|
| 374 |
(general_lora_path, round(float(general_strength), 2)),
|
| 375 |
(motion_lora_path, round(float(motion_strength), 2)),
|
| 376 |
(dreamlay_lora_path, round(float(dreamlay_strength), 2)),
|
|
|
|
| 384 |
(transition_lora_path, round(float(transition_strength), 2)),
|
| 385 |
(physics_lora_path, round(float(physics_strength), 2)),
|
| 386 |
(reasoning_lora_path, round(float(reasoning_strength), 2)),
|
| 387 |
+
(twostep_lora_path, round(float(twostep_strength), 2)),
|
| 388 |
]
|
| 389 |
loras_for_builder = [
|
| 390 |
LoraPathStrengthAndSDOps(path, strength, LTXV_LORA_COMFY_RENAMING_MAP)
|
|
|
|
| 568 |
randomize_seed: bool = True,
|
| 569 |
height: int = 1024,
|
| 570 |
width: int = 1536,
|
| 571 |
+
distilled_strength: float = 0.0,
|
| 572 |
pose_strength: float = 0.0,
|
| 573 |
+
twod_strength: float = 0.0,
|
| 574 |
general_strength: float = 0.0,
|
| 575 |
motion_strength: float = 0.0,
|
| 576 |
dreamlay_strength: float = 0.0,
|
|
|
|
| 584 |
transition_strength: float = 0.0,
|
| 585 |
physics_strength: float = 0.0,
|
| 586 |
reasoning_strength: float = 0.0,
|
| 587 |
+
twostep_strength: float = 0.0,
|
| 588 |
progress=None,
|
| 589 |
):
|
| 590 |
return int(gpu_duration)
|
|
|
|
| 602 |
randomize_seed: bool = True,
|
| 603 |
height: int = 1024,
|
| 604 |
width: int = 1536,
|
| 605 |
+
distilled_strength: float = 0.0,
|
| 606 |
pose_strength: float = 0.0,
|
| 607 |
+
twod_strength: float = 0.0,
|
| 608 |
general_strength: float = 0.0,
|
| 609 |
motion_strength: float = 0.0,
|
| 610 |
dreamlay_strength: float = 0.0,
|
|
|
|
| 618 |
transition_strength: float = 0.0,
|
| 619 |
physics_strength: float = 0.0,
|
| 620 |
reasoning_strength: float = 0.0,
|
| 621 |
+
twostep_strength: float = 0.0,
|
| 622 |
progress=gr.Progress(track_tqdm=True),
|
| 623 |
):
|
| 624 |
try:
|
|
|
|
| 725 |
high_res = gr.Checkbox(label="High Resolution", value=True)
|
| 726 |
with gr.Column():
|
| 727 |
gr.Markdown("### LoRA adapter strengths (set to 0 to disable; slow and WIP)")
|
| 728 |
+
distilled_strength = gr.Slider(
|
| 729 |
+
label="Distilled LoRA strength",
|
| 730 |
+
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 731 |
+
)
|
| 732 |
pose_strength = gr.Slider(
|
| 733 |
label="Anthro Enhancer strength",
|
| 734 |
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
|
|
|
| 782 |
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 783 |
)
|
| 784 |
reasoning_strength = gr.Slider(
|
| 785 |
+
label="Official Reasoning strength",
|
| 786 |
+
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 787 |
+
)
|
| 788 |
+
twostep_strength = gr.Slider(
|
| 789 |
+
label="Multistep Reasoning strength",
|
| 790 |
minimum=0.0, maximum=2.0, value=0.0, step=0.01
|
| 791 |
)
|
| 792 |
prepare_lora_btn = gr.Button("Prepare / Load LoRA Cache", variant="secondary")
|
|
|
|
| 806 |
step=1.0,
|
| 807 |
)
|
| 808 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 809 |
first_image.change(
|
| 810 |
fn=on_image_upload,
|
| 811 |
inputs=[first_image, last_image, high_res],
|
|
|
|
| 826 |
|
| 827 |
prepare_lora_btn.click(
|
| 828 |
fn=prepare_lora_cache,
|
| 829 |
+
inputs=[distilled_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],
|
| 830 |
outputs=[lora_status],
|
| 831 |
)
|
| 832 |
|
|
|
|
| 835 |
inputs=[
|
| 836 |
first_image, last_image, prompt, duration, gpu_duration, enhance_prompt,
|
| 837 |
seed, randomize_seed, height, width,
|
| 838 |
+
distilled_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,
|
| 839 |
],
|
| 840 |
outputs=[output_video, seed],
|
| 841 |
)
|