LTX-Video Support for ComfyUI
Python comfyuidiffusion-modelsditimage-to-videoimage-to-video-generationtext-to-imagetext-to-image-generation
Automated PR - 2026-03-06
sync-bot5c3d20803d8c
diff --git a/README.md b/README.mdindex 2ddadb6..046d7e4 100644--- a/README.md+++ b/README.md@@ -2,7 +2,7 @@[](https://github.com/Lightricks/LTX-2)[](https://ltx.io/model)-[](https://huggingface.co/Lightricks/LTX-2)+[](https://huggingface.co/Lightricks/LTX-2.3)[](https://github.com/Lightricks/LTX-2/tree/main/packages/ltx-trainer)[](https://app.ltx.studio/ltx-2-playground/i2v)[](https://videos.ltx.io/LTX-2/grants/LTX_2_Technical_Report_compressed.pdf)@@ -47,26 +47,33 @@ You can see them all at:ComfyUI/custom_nodes/ComfyUI-LTXVideo/example_workflows/```-* [`Text to video full model`](./example_workflows/LTX-2_T2V_Full_wLora.json)-* [`Text to video distilled model (Fast)`](./example_workflows/LTX-2_T2V_Distilled_wLora.json)-* [`Image to video full model`](./example_workflows/LTX-2_I2V_Full_wLora.json)-* [`Image to video distilled model (Fast)`](./example_workflows/LTX-2_I2V_Distilled_wLora.json)-* [`Video to video detailer`](./example_workflows/LTX-2_V2V_Detailer.json)-* [`IC-LoRA distilled model (depth + human pose + edges)`](./example_workflows/LTX-2_ICLoRA_All_Distilled.json)-* [`IC-LoRA distilled model with downscaled reference latents`](./example_workflows/LTX-2_ICLoRA_All_Distilled_ref0.5.json)+LTX-2.3 Workflows:++* [`Text/image to video full/distilled model; single stage`](./example_workflows/2.3/LTX-2.3_T2V_I2V_Single_Stage_Distilled_Full.json)+* [`Text/image to video distilled model; two stages (with upsampling)`](./example_workflows/2.3/LTX-2.3_T2V_I2V_Two_Stage_Distilled.json)++Older Workflows (LTX-2.0):++* [`Text to video full model`](./example_workflows/2.0/LTX-2_T2V_Full_wLora.json)+* [`Text to video distilled model (Fast)`](./example_workflows/2.0/LTX-2_T2V_Distilled_wLora.json)+* [`Image to video full model`](./example_workflows/2.0/LTX-2_I2V_Full_wLora.json)+* [`Image to video distilled model (Fast)`](./example_workflows/2.0/LTX-2_I2V_Distilled_wLora.json)+* [`Video to video detailer`](./example_workflows/2.0/LTX-2_V2V_Detailer.json)+* [`IC-LoRA distilled model (depth + human pose + edges)`](./example_workflows/2.0/LTX-2_ICLoRA_All_Distilled.json)+* [`IC-LoRA distilled model with downscaled reference latents`](./example_workflows/2.0/LTX-2_ICLoRA_All_Distilled_ref0.5.json)## Union IC-LoRA Model-We introduce a new **Union IC-LoRA** model that combines depth, pose, and edge control conditions into a single unified LoRA.+We introduce a new **Union IC-LoRA** model that combines depth and edge (canny) control conditions into a single unified LoRA.### Key Features-- **Unified Control**: A single LoRA that supports multiple control conditions (depth, human pose, or edges).+- **Unified Control**: A single LoRA that supports multiple control conditions (depth or edges).- **Downsampled Latent Processing**: The union LoRA operates on a downsampled latent size, which reduces memory usage and significantly speeds up inference while maintaining quality.### How It Works-The union LoRA is trained to understand and respond to all three control signals (depth maps, pose skeletons, and edge maps) within a single model. The model learns to:+The union LoRA is trained to understand and respond to both control signals (depth maps and edge maps) within a single model. The model learns to:1. **Parse multiple conditions**: Identify which control signals are present in the input2. **Process at reduced resolution**: Work on downsampled latents to improve efficiency@@ -75,28 +82,24 @@ The union LoRA is trained to understand and respond to all three control signalsDownload the following models:-**LTX-2 Model Checkpoint** - Choose and download one of the models to `COMFYUI_ROOT_FOLDER/models/checkpoints` folder.- * [`ltx-2-19b-dev-fp8.safetensors`](https://huggingface.co/Lightricks/LTX-2/blob/main/ltx-2-19b-dev-fp8.safetensors)- * [`ltx-2-19b-distilled-fp8.safetensors`](https://huggingface.co/Lightricks/LTX-2/blob/main/ltx-2-19b-distilled-fp8.safetensors)- * [`ltx-2-19b-dev.safetensors`](https://huggingface.co/Lightricks/LTX-2/blob/main/ltx-2-19b-dev.safetensors)- * [`ltx-2-19b-distilled.safetensors`](https://huggingface.co/Lightricks/LTX-2/blob/main/ltx-2-19b-distilled.safetensors)+**LTX-2.3 Model Checkpoint** - Choose and download one of the models to `COMFYUI_ROOT_FOLDER/models/checkpoints` folder.+ * [`ltx-2.3-22b-dev.safetensors`](https://huggingface.co/Lightricks/LTX-2.3/blob/main/ltx-2.3-22b-dev.safetensors)+ * [`ltx-2.3-22b-distilled.safetensors`](https://huggingface.co/Lightricks/LTX-2.3/blob/main/ltx-2.3-22b-distilled.safetensors)**Spatial Upscaler** - Required for current two-stage pipeline implementations in this repository. Download to `COMFYUI_ROOT_FOLDER/models/latent_upscale_models` folder.- * [`ltx-2-spatial-upscaler-x2-1.0.safetensors`](https://huggingface.co/Lightricks/LTX-2/blob/main/ltx-2-spatial-upscaler-x2-1.0.safetensors)+ * [`ltx-2.3-spatial-upscaler-x2-1.0.safetensors`](https://huggingface.co/Lightricks/LTX-2.3/blob/main/ltx-2.3-spatial-upscaler-x2-1.0.safetensors)+ * [`ltx-2.3-spatial-upscaler-x1.5-1.0.safetensors`](https://huggingface.co/Lightricks/LTX-2.3/blob/main/ltx-2.3-spatial-upscaler-x1.5-1.0.safetensors)**Temporal Upscaler** - Required for current two-stage pipeline implementations in this repository. Download to `COMFYUI_ROOT_FOLDER/models/latent_upscale_models` folder.- * [`ltx-2-temporal-upscaler-x2-1.0.safetensors`](https://huggingface.co/Lightricks/LTX-2/blob/main/ltx-2-temporal-upscaler-x2-1.0.safetensors)+ * [`ltx-2.3-temporal-upscaler-x2-1.0.safetensors`](https://huggingface.co/Lightricks/LTX-2.3/blob/main/ltx-2.3-temporal-upscaler-x2-1.0.safetensors)**Distilled LoRA** - Required for current two-stage pipeline implementations in this repository (except DistilledPipeline and ICLoraPipeline). Download to `COMFYUI_ROOT_FOLDER/models/loras` folder.- * [`ltx-2-19b-distilled-lora-384.safetensors`](https://huggingface.co/Lightricks/LTX-2/blob/main/ltx-2-19b-distilled-lora-384.safetensors)+ * [`ltx-2.3-22b-distilled-lora-384.safetensors`](https://huggingface.co/Lightricks/LTX-2.3/blob/main/ltx-2.3-22b-distilled-lora-384.safetensors)**Gemma Text Encoder** Download all files from the repository to `COMFYUI_ROOT_FOLDER/models/text_encoders/gemma-3-12b-it-qat-q4_0-unquantized`.* [`Gemma 3`](https://huggingface.co/google/gemma-3-12b-it-qat-q4_0-unquantized)**LoRAs** Choose and download to `COMFYUI_ROOT_FOLDER/models/loras` folder.- * [`ltx-2-19b-ic-lora-union-ref0.5.safetensors`](https://huggingface.co/Lightricks/LTX-2-19b-IC-LoRA-Union-Control/blob/main/ltx-2-19b-ic-lora-union-control-ref0.5.safetensors) *(Union LoRA - supports depth, pose, and edges in one model)*- * [`ltx-2-19b-ic-lora-canny-control.safetensors`](https://huggingface.co/Lightricks/LTX-2-19b-IC-LoRA-Canny-Control/blob/main/ltx-2-19b-ic-lora-canny-control.safetensors)- * [`ltx-2-19b-ic-lora-depth-control.safetensors`](https://huggingface.co/Lightricks/LTX-2-19b-IC-LoRA-Depth-Control/blob/main/ltx-2-19b-ic-lora-depth-control.safetensors)* [`ltx-2-19b-ic-lora-detailer.safetensors`](https://huggingface.co/Lightricks/LTX-2-19b-IC-LoRA-Detailer/blob/main/ltx-2-19b-ic-lora-detailer.safetensors)* [`ltx-2-19b-ic-lora-pose-control.safetensors`](https://huggingface.co/Lightricks/LTX-2-19b-IC-LoRA-Pose-Control/blob/main/ltx-2-19b-ic-lora-pose-control.safetensors)* [`ltx-2-19b-lora-camera-control-dolly-in.safetensors`](https://huggingface.co/Lightricks/LTX-2-19b-LoRA-Camera-Control-Dolly-In/blob/main/ltx-2-19b-lora-camera-control-dolly-in.safetensors)diff --git a/__init__.py b/__init__.pyindex c201748..0ecb5b4 100644--- a/__init__.py+++ b/__init__.py@@ -11,9 +11,13 @@ from .easy_samplers import ()from .gemma_api_conditioning import GemmaAPITextEncodefrom .gemma_encoder import LTXVGemmaCLIPModelLoader, LTXVGemmaEnhancePrompt-from .guide import LTXVAddGuideAdvanced+from .guide import LTXVAddGuideAdvanced, LTXVAddGuideAdvancedAttentionfrom .guiders import GuiderParametersNode, MultimodalGuiderNode-from .iclora import LTXAddVideoICLoRAGuide, LTXICLoRALoaderModelOnly+from .iclora import (+ LTXAddVideoICLoRAGuide,+ LTXAddVideoICLoRAGuideAdvanced,+ LTXICLoRALoaderModelOnly,+)from .latent_norm import (LTXVAdainLatent,LTXVPerStepAdainPatcher,@@ -40,6 +44,7 @@ from .nodes_registry import (from .nodes_registry import NODES_DISPLAY_NAME_PREFIX, camel_case_to_spacesfrom .prompt_enhancer_nodes import LTXVPromptEnhancer, LTXVPromptEnhancerLoaderfrom .q8_nodes import LTXVQ8LoraModelLoader, LTXVQ8Patch+from .sparse_tracks import LTXVDrawTracks, LTXVSparseTrackEditorfrom .stg import (LTXVApplySTG,STGAdvancedPresetsNode,@@ -52,12 +57,14 @@ from .tricks import NODE_CLASS_MAPPINGS as TRICKS_NODE_CLASS_MAPPINGSfrom .tricks import NODE_DISPLAY_NAME_MAPPINGS as TRICKS_NODE_DISPLAY_NAME_MAPPINGSfrom .utiltily_nodes import ImageToCPUfrom .vae_patcher import LTXVPatcherVAE+from .vanish_nodes import LTXVDilateVideoMask, LTXVInpaintPreprocess# Static node mappings, required for ComfyUI-Manager mapping to workNODE_CLASS_MAPPINGS = {"Set VAE Decoder Noise": DecoderNoise,"LTXVLinearOverlapLatentTransition": LinearOverlapLatentTransition,"LTXVAddGuideAdvanced": LTXVAddGuideAdvanced,+ "LTXVAddGuideAdvancedAttention": LTXVAddGuideAdvancedAttention,"LTXVAddLatentGuide": LTXVAddLatentGuide,"LTXVAdainLatent": LTXVAdainLatent,"LTXVImgToVideoConditionOnly": LTXVImgToVideoConditionOnly,@@ -95,9 +102,14 @@ NODE_CLASS_MAPPINGS = {"LowVRAMAudioVAELoader": LowVRAMAudioVAELoader,"LowVRAMLatentUpscaleModelLoader": LowVRAMLatentUpscaleModelLoader,"LTXAddVideoICLoRAGuide": LTXAddVideoICLoRAGuide,+ "LTXAddVideoICLoRAGuideAdvanced": LTXAddVideoICLoRAGuideAdvanced,"LTXICLoRALoaderModelOnly": LTXICLoRALoaderModelOnly,"LTXVLoadConditioning": LTXVLoadConditioning,"LTXVSaveConditioning": LTXVSaveConditioning,+ "LTXVDrawTracks": LTXVDrawTracks,+ "LTXVSparseTrackEditor": LTXVSparseTrackEditor,+ "LTXVDilateVideoMask": LTXVDilateVideoMask,+ "LTXVInpaintPreprocess": LTXVInpaintPreprocess,}# Consistent display names between static and dynamic node mappings in nodes_registry.py,@@ -115,8 +127,11 @@ NODE_DISPLAY_NAME_MAPPINGS.update(TRICKS_NODE_DISPLAY_NAME_MAPPINGS)NODE_CLASS_MAPPINGS.update(RUNTIME_NODE_CLASS_MAPPINGS)NODE_DISPLAY_NAME_MAPPINGS.update(RUNTIME_NODE_DISPLAY_NAME_MAPPINGS)+WEB_DIRECTORY = "./web"+# Export so that ComfyUI can pick them up.__all__ = ["NODE_CLASS_MAPPINGS","NODE_DISPLAY_NAME_MAPPINGS",+ "WEB_DIRECTORY",]diff --git a/conditioning_saver.py b/conditioning_saver.pyindex dac3b0d..9a7bb8a 100644--- a/conditioning_saver.py+++ b/conditioning_saver.py@@ -65,5 +65,5 @@ class LTXVSaveConditioning(io.ComfyNode):file_size_mb = output_path.stat().st_size / (1024 * 1024)return io.NodeOutput(- ui=ui.Text(f"Saved: {output_path.name} ({file_size_mb:.2f} MB)")+ ui=ui.PreviewText(f"Saved: {output_path.name} ({file_size_mb:.2f} MB)"))diff --git a/embeddings_connector.py b/embeddings_connector.pyindex f3e45bb..8643e3b 100644--- a/embeddings_connector.py+++ b/embeddings_connector.py@@ -2,10 +2,13 @@ import mathfrom typing import Optionalimport comfy.ldm.common_dit+import comfy.opsimport torchfrom comfy.ldm.lightricks.model import (CrossAttention,FeedForward,+ LTXFrequenciesPrecision,+ LTXRopeType,generate_freq_grid_np,interleaved_freqs_cis,split_freqs_cis,@@ -52,6 +55,7 @@ class BasicTransformerBlock1D(nn.Module):d_head,context_dim=None,attn_precision=None,+ apply_gated_attention=False,dtype=None,device=None,operations=None,@@ -65,6 +69,7 @@ class BasicTransformerBlock1D(nn.Module):heads=n_heads,dim_head=d_head,context_dim=None,+ apply_gated_attention=apply_gated_attention,dtype=dtype,device=device,operations=operations,@@ -123,6 +128,7 @@ class Embeddings1DConnector(nn.Module):positional_embedding_max_pos=[1],causal_temporal_positioning=False,num_learnable_registers: Optional[int] = 128,+ apply_gated_attention=False,dtype=None,device=None,operations=None,@@ -147,6 +153,7 @@ class Embeddings1DConnector(nn.Module):num_attention_heads,attention_head_dim,context_dim=cross_attention_dim,+ apply_gated_attention=apply_gated_attention,dtype=dtype,device=device,operations=operations,@@ -330,3 +337,115 @@ class Embeddings1DConnector(nn.Module):hidden_states = comfy.ldm.common_dit.rms_norm(hidden_states)return hidden_states, attention_mask+++# ---------------------------------------------------------------------------+# Loading helpers+# ---------------------------------------------------------------------------++_PREFIX_BASE = "model.diffusion_model."+++def load_embeddings_connector(+ sd,+ connector_prefix,+ connector_config,+ dtype=torch.bfloat16,+ rope_type=LTXRopeType.INTERLEAVED,+ frequencies_precision=LTXFrequenciesPrecision.FLOAT32,+ pe_max_pos=None,+):+ sd_connector = {+ k[len(connector_prefix) :]: v+ for k, v in sd.items()+ if k.startswith(connector_prefix)+ }++ if len(sd_connector) == 0:+ return None++ operations = comfy.ops.pick_operations(dtype, dtype, disable_fast_fp8=True)+ connector = Embeddings1DConnector(+ num_attention_heads=connector_config["num_attention_heads"],+ attention_head_dim=connector_config["attention_head_dim"],+ num_layers=connector_config["num_layers"],+ apply_gated_attention=connector_config.get("apply_gated_attention", False),+ dtype=dtype,+ operations=operations,+ positional_embedding_max_pos=pe_max_pos if pe_max_pos is not None else [1],+ split_rope=rope_type == LTXRopeType.SPLIT,+ double_precision_rope=frequencies_precision == LTXFrequenciesPrecision.FLOAT64,+ )+ connector.load_state_dict(sd_connector)+ return connector+++def load_video_embeddings_connector(sd, transformer_config, dtype=torch.bfloat16):+ rope_type = LTXRopeType.from_dict(transformer_config)+ frequencies_precision = LTXFrequenciesPrecision.from_dict(transformer_config)+ pe_max_pos = transformer_config.get("connector_positional_embedding_max_pos", [1])++ video_only_connector_prefix = f"{_PREFIX_BASE}embeddings_connector."+ av_connector_prefix = f"{_PREFIX_BASE}video_embeddings_connector."+ prefix = (+ av_connector_prefix+ if f"{_PREFIX_BASE}audio_adaln_single.linear.weight" in sd+ else video_only_connector_prefix+ )++ connector_config = {+ "num_attention_heads": transformer_config.get(+ "connector_num_attention_heads", 30+ ),+ "attention_head_dim": transformer_config.get(+ "connector_attention_head_dim", 128+ ),+ "num_layers": transformer_config.get("connector_num_layers", 2),+ "apply_gated_attention": transformer_config.get(+ "connector_apply_gated_attention", False+ ),+ }++ return load_embeddings_connector(+ sd,+ prefix,+ connector_config,+ dtype,+ rope_type,+ frequencies_precision,+ pe_max_pos,+ )+++def load_audio_embeddings_connector(sd, transformer_config, dtype=torch.bfloat16):+ rope_type = LTXRopeType.from_dict(transformer_config)+ frequencies_precision = LTXFrequenciesPrecision.from_dict(transformer_config)+ pe_max_pos = transformer_config.get("connector_positional_embedding_max_pos", [1])++ connector_config = {+ "num_attention_heads": transformer_config.get(+ "audio_connector_num_attention_heads",+ transformer_config.get("connector_num_attention_heads", 30),+ ),+ "attention_head_dim": transformer_config.get(+ "audio_connector_attention_head_dim",+ transformer_config.get("connector_attention_head_dim", 128),+ ),+ "num_layers": transformer_config.get(+ "audio_connector_num_layers",+ transformer_config.get("connector_num_layers", 2),+ ),+ "apply_gated_attention": transformer_config.get(+ "connector_apply_gated_attention", False+ ),+ }++ return load_embeddings_connector(+ sd,+ f"{_PREFIX_BASE}audio_embeddings_connector.",+ connector_config,+ dtype,+ rope_type,+ frequencies_precision,+ pe_max_pos,+ )diff --git a/example_workflows/LTX-2_I2V_Distilled_wLora.json b/example_workflows/2.0/LTX-2_I2V_Distilled_wLora.jsonsimilarity index 100%rename from example_workflows/LTX-2_I2V_Distilled_wLora.jsonrename to example_workflows/2.0/LTX-2_I2V_Distilled_wLora.jsondiff --git a/example_workflows/LTX-2_I2V_Full_wLora.json b/example_workflows/2.0/LTX-2_I2V_Full_wLora.jsonsimilarity index 100%rename from example_workflows/LTX-2_I2V_Full_wLora.jsonrename to example_workflows/2.0/LTX-2_I2V_Full_wLora.jsondiff --git a/example_workflows/LTX-2_ICLoRA_All_Distilled.json b/example_workflows/2.0/LTX-2_ICLoRA_All_Distilled.jsonsimilarity index 100%rename from example_workflows/LTX-2_ICLoRA_All_Distilled.jsonrename to example_workflows/2.0/LTX-2_ICLoRA_All_Distilled.jsondiff --git a/example_workflows/LTX-2_ICLoRA_All_Distilled_ref0.5.json b/example_workflows/2.0/LTX-2_ICLoRA_All_Distilled_ref0.5.jsonsimilarity index 100%rename from example_workflows/LTX-2_ICLoRA_All_Distilled_ref0.5.jsonrename to example_workflows/2.0/LTX-2_ICLoRA_All_Distilled_ref0.5.jsondiff --git a/example_workflows/LTX-2_T2V_Distilled_wLora.json b/example_workflows/2.0/LTX-2_T2V_Distilled_wLora.jsonsimilarity index 100%rename from example_workflows/LTX-2_T2V_Distilled_wLora.jsonrename to example_workflows/2.0/LTX-2_T2V_Distilled_wLora.jsondiff --git a/example_workflows/LTX-2_T2V_Full_wLora.json b/example_workflows/2.0/LTX-2_T2V_Full_wLora.jsonsimilarity index 100%rename from example_workflows/LTX-2_T2V_Full_wLora.jsonrename to example_workflows/2.0/LTX-2_T2V_Full_wLora.jsondiff --git a/example_workflows/LTX-2_V2V_Detailer.json b/example_workflows/2.0/LTX-2_V2V_Detailer.jsonsimilarity index 100%rename from example_workflows/LTX-2_V2V_Detailer.jsonrename to example_workflows/2.0/LTX-2_V2V_Detailer.jsondiff --git a/example_workflows/2.3/LTX-2.3_T2V_I2V_Single_Stage_Distilled_Full.json b/example_workflows/2.3/LTX-2.3_T2V_I2V_Single_Stage_Distilled_Full.jsonnew file mode 100644index 0000000..7dd3291--- /dev/null+++ b/example_workflows/2.3/LTX-2.3_T2V_I2V_Single_Stage_Distilled_Full.json@@ -0,0 +1,3082 @@+{+ "id": "394ed254-7306-42a2-9ae6-aa880ce4456d",+ "revision": 0,+ "last_node_id": 4981,+ "last_link_id": 13353,+ "nodes": [+ {+ "id": 4818,+ "type": "LTXVAudioVAEDecode",+ "pos": [+ -407.814457071416,+ 3825.033274790136+ ],+ "size": [+ 242.46932983398438,+ 46+ ],+ "flags": {},+ "order": 40,+ "mode": 0,+ "inputs": [+ {+ "name": "samples",+ "type": "LATENT",+ "link": 13080+ },+ {+ "name": "audio_vae",+ "type": "VAE",+ "link": 13304+ }+ ],+ "outputs": [+ {+ "name": "Audio",+ "type": "AUDIO",+ "links": [+ 13069+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.64",+ "Node name for S&R": "LTXVAudioVAEDecode"+ },+ "widgets_values": []+ },+ {+ "id": 4822,+ "type": "VAEDecodeTiled",+ "pos": [+ -432.17285832621803,+ 3622.27392422418+ ],+ "size": [+ 270,+ 150+ ],+ "flags": {},+ "order": 39,+ "mode": 0,+ "inputs": [+ {+ "name": "samples",+ "type": "LATENT",+ "link": 13078+ },+ {+ "name": "vae",+ "type": "VAE",+ "link": 13305+ }+ ],+ "outputs": [+ {+ "name": "IMAGE",+ "type": "IMAGE",+ "links": [+ 13081+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "VAEDecodeTiled"+ },+ "widgets_values": [+ 512,+ 64,+ 512,+ 64+ ]+ },+ {+ "id": 4824,+ "type": "LTXVSeparateAVLatent",+ "pos": [+ -731.6713644652554,+ 4001.809385255438+ ],+ "size": [+ 193.2916015625,+ 46+ ],+ "flags": {},+ "order": 37,+ "mode": 0,+ "inputs": [+ {+ "name": "av_latent",+ "type": "LATENT",+ "link": 13073+ }+ ],+ "outputs": [+ {+ "name": "video_latent",+ "type": "LATENT",+ "links": [+ 13078+ ]+ },+ {+ "name": "audio_latent",+ "type": "LATENT",+ "links": [+ 13080+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.10.0",+ "Node name for S&R": "LTXVSeparateAVLatent"+ },+ "widgets_values": []+ },+ {+ "id": 4848,+ "type": "LTXVAudioVAEDecode",+ "pos": [+ -410.1063990210086,+ 3144.894193466471+ ],+ "size": [+ 242.46932983398438,+ 46+ ],+ "flags": {},+ "order": 36,+ "mode": 0,+ "inputs": [+ {+ "name": "samples",+ "type": "LATENT",+ "link": 13105+ },+ {+ "name": "audio_vae",+ "type": "VAE",+ "link": 13275+ }+ ],+ "outputs": [+ {+ "name": "Audio",+ "type": "AUDIO",+ "links": [+ 13108+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.64",+ "Node name for S&R": "LTXVAudioVAEDecode"+ },+ "widgets_values": []+ },+ {+ "id": 4851,+ "type": "VAEDecodeTiled",+ "pos": [+ -434.4648002758107,+ 2942.134842900515+ ],+ "size": [+ 270,+ 150+ ],+ "flags": {},+ "order": 35,+ "mode": 0,+ "inputs": [+ {+ "name": "samples",+ "type": "LATENT",+ "link": 13110+ },+ {+ "name": "vae",+ "type": "VAE",+ "link": 13280+ }+ ],+ "outputs": [+ {+ "name": "IMAGE",+ "type": "IMAGE",+ "links": [+ 13107+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "VAEDecodeTiled"+ },+ "widgets_values": [+ 512,+ 64,+ 512,+ 64+ ]+ },+ {+ "id": 4849,+ "type": "CreateVideo",+ "pos": [+ -115.36479388728354,+ 2941.821676196994+ ],+ "size": [+ 270,+ 102+ ],+ "flags": {},+ "order": 38,+ "mode": 0,+ "inputs": [+ {+ "name": "images",+ "type": "IMAGE",+ "link": 13107+ },+ {+ "name": "audio",+ "shape": 7,+ "type": "AUDIO",+ "link": 13108+ },+ {+ "name": "fps",+ "type": "FLOAT",+ "widget": {+ "name": "fps"+ },+ "link": 13348+ }+ ],+ "outputs": [+ {+ "name": "VIDEO",+ "type": "VIDEO",+ "links": [+ 13112+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "CreateVideo"+ },+ "widgets_values": [+ 30+ ]+ },+ {+ "id": 4819,+ "type": "CreateVideo",+ "pos": [+ -113.07285193769118,+ 3621.9607575206587+ ],+ "size": [+ 270,+ 102+ ],+ "flags": {},+ "order": 42,+ "mode": 0,+ "inputs": [+ {+ "name": "images",+ "type": "IMAGE",+ "link": 13081+ },+ {+ "name": "audio",+ "shape": 7,+ "type": "AUDIO",+ "link": 13069+ },+ {+ "name": "fps",+ "type": "FLOAT",+ "widget": {+ "name": "fps"+ },+ "link": 13347+ }+ ],+ "outputs": [+ {+ "name": "VIDEO",+ "type": "VIDEO",+ "links": [+ 13072+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "CreateVideo"+ },+ "widgets_values": [+ 30+ ]+ },+ {+ "id": 3059,+ "type": "EmptyLTXVLatentVideo",+ "pos": [+ -2428.149747965925,+ 3459.497360041607+ ],+ "size": [+ 210,+ 194+ ],+ "flags": {},+ "order": 22,+ "mode": 0,+ "inputs": [+ {+ "name": "length",+ "type": "INT",+ "widget": {+ "name": "length"+ },+ "link": 13350+ }+ ],+ "outputs": [+ {+ "name": "LATENT",+ "type": "LATENT",+ "links": [+ 11401+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.43",+ "Node name for S&R": "EmptyLTXVLatentVideo"+ },+ "widgets_values": [+ 960,+ 544,+ 121,+ 1+ ]+ },+ {+ "id": 3159,+ "type": "LTXVImgToVideoConditionOnly",+ "pos": [+ -2141.666430276342,+ 3299.1682237844175+ ],+ "size": [+ 313.2623046875,+ 142.859507731343+ ],+ "flags": {},+ "order": 29,+ "mode": 0,+ "inputs": [+ {+ "name": "vae",+ "type": "VAE",+ "link": 13279+ },+ {+ "name": "image",+ "type": "IMAGE",+ "link": 9768+ },+ {+ "name": "latent",+ "type": "LATENT",+ "link": 11401+ },+ {+ "name": "bypass",+ "shape": 7,+ "type": "BOOLEAN",+ "widget": {+ "name": "bypass"+ },+ "link": 13345+ }+ ],+ "outputs": [+ {+ "name": "latent",+ "type": "LATENT",+ "links": [+ 13034+ ]+ }+ ],+ "properties": {+ "Node name for S&R": "LTXVImgToVideoConditionOnly"+ },+ "widgets_values": [+ 0.7,+ false+ ]+ },+ {+ "id": 3980,+ "type": "LTXVEmptyLatentAudio",+ "pos": [+ -2138.0608993537985,+ 3500.832096503324+ ],+ "size": [+ 305.8394470214844,+ 106+ ],+ "flags": {+ "collapsed": false+ },+ "order": 26,+ "mode": 0,+ "inputs": [+ {+ "name": "audio_vae",+ "type": "VAE",+ "link": 13274+ },+ {+ "name": "frames_number",+ "type": "INT",+ "widget": {+ "name": "frames_number"+ },+ "link": 13351+ },+ {+ "name": "frame_rate",+ "type": "INT",+ "widget": {+ "name": "frame_rate"+ },+ "link": 13338+ }+ ],+ "outputs": [+ {+ "name": "Latent",+ "type": "LATENT",+ "links": [+ 12457+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.64",+ "Node name for S&R": "LTXVEmptyLatentAudio"+ },+ "widgets_values": [+ 97,+ 25,+ 1+ ]+ },+ {+ "id": 1241,+ "type": "LTXVConditioning",+ "pos": [+ -2827.383495127067,+ 3450.198097882919+ ],+ "size": [+ 210,+ 78+ ],+ "flags": {},+ "order": 24,+ "mode": 0,+ "inputs": [+ {+ "name": "positive",+ "type": "CONDITIONING",+ "link": 7065+ },+ {+ "name": "negative",+ "type": "CONDITIONING",+ "link": 7652+ },+ {+ "name": "frame_rate",+ "type": "FLOAT",+ "widget": {+ "name": "frame_rate"+ },+ "link": 13346+ }+ ],+ "outputs": [+ {+ "name": "positive",+ "type": "CONDITIONING",+ "slot_index": 0,+ "links": [+ 13289,+ 13295+ ]+ },+ {+ "name": "negative",+ "type": "CONDITIONING",+ "slot_index": 1,+ "links": [+ 13296,+ 13297+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.28",+ "Node name for S&R": "LTXVConditioning"+ },+ "widgets_values": [+ 24+ ]+ },+ {+ "id": 4528,+ "type": "LTXVConcatAVLatent",+ "pos": [+ -1774.7084667188306,+ 3302.122602064689+ ],+ "size": [+ 181.308203125,+ 46+ ],+ "flags": {},+ "order": 30,+ "mode": 0,+ "inputs": [+ {+ "name": "video_latent",+ "type": "LATENT",+ "link": 13034+ },+ {+ "name": "audio_latent",+ "type": "LATENT",+ "link": 12457+ }+ ],+ "outputs": [+ {+ "name": "latent",+ "type": "LATENT",+ "links": [+ 13298,+ 13302,+ 13328+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.10.0",+ "Node name for S&R": "LTXVConcatAVLatent"+ },+ "widgets_values": []+ },+ {+ "id": 4814,+ "type": "RandomNoise",+ "pos": [+ -1103.3129451873306,+ 3597.08613250672+ ],+ "size": [+ 259.3260068648565,+ 82+ ],+ "flags": {},+ "order": 0,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "NOISE",+ "type": "NOISE",+ "links": [+ 13066+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "RandomNoise"+ },+ "widgets_values": [+ 42,+ "fixed"+ ]+ },+ {+ "id": 4010,+ "type": "LTXVAudioVAELoader",+ "pos": [+ -4668.869579239853,+ 3124.5366855353145+ ],+ "size": [+ 384.6576773713696,+ 79.30435270514249+ ],+ "flags": {},+ "order": 1,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "Audio VAE",+ "type": "VAE",+ "links": [+ 13274,+ 13275,+ 13304+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.64",+ "Node name for S&R": "LTXVAudioVAELoader"+ },+ "widgets_values": [+ "ltx-2.3-22b-dev.safetensors"+ ]+ },+ {+ "id": 3336,+ "type": "LTXVPreprocess",+ "pos": [+ -2474.088851384863,+ 3319.0238990043326+ ],+ "size": [+ 270,+ 74+ ],+ "flags": {},+ "order": 25,+ "mode": 0,+ "inputs": [+ {+ "name": "image",+ "type": "IMAGE",+ "link": 13353+ }+ ],+ "outputs": [+ {+ "name": "output_image",+ "type": "IMAGE",+ "links": [+ 9768+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.60",+ "Node name for S&R": "LTXVPreprocess"+ },+ "widgets_values": [+ 18+ ]+ },+ {+ "id": 3940,+ "type": "CheckpointLoaderSimple",+ "pos": [+ -4662.570065624733,+ 3262.956671398131+ ],+ "size": [+ 383.4002295473938,+ 108.51948797992713+ ],+ "flags": {},+ "order": 2,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "MODEL",+ "type": "MODEL",+ "links": [+ 13217,+ 13324+ ]+ },+ {+ "name": "CLIP",+ "type": "CLIP",+ "links": []+ },+ {+ "name": "VAE",+ "type": "VAE",+ "links": [+ 13279,+ 13280,+ 13305+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.56",+ "Node name for S&R": "CheckpointLoaderSimple"+ },+ "widgets_values": [+ "ltx-2.3-22b-dev.safetensors"+ ]+ },+ {+ "id": 4966,+ "type": "LTXVScheduler",+ "pos": [+ -1035.5836177727645,+ 4178.439486042076+ ],+ "size": [+ 227.50896263572213,+ 154+ ],+ "flags": {},+ "order": 32,+ "mode": 0,+ "inputs": [+ {+ "name": "latent",+ "shape": 7,+ "type": "LATENT",+ "link": 13328+ }+ ],+ "outputs": [+ {+ "name": "SIGMAS",+ "type": "SIGMAS",+ "links": [+ 13327+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.64",+ "Node name for S&R": "LTXVScheduler"+ },+ "widgets_values": [+ 15,+ 2.05,+ 0.95,+ true,+ 0.1+ ]+ },+ {+ "id": 4971,+ "type": "ManualSigmas",+ "pos": [+ -1422.041172616799,+ 3387.4190297866753+ ],+ "size": [+ 499.94633283206986,+ 67.3573576655076+ ],+ "flags": {},+ "order": 3,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "SIGMAS",+ "type": "SIGMAS",+ "links": [+ 13332+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "ManualSigmas"+ },+ "widgets_values": [+ "1.0, 0.99375, 0.9875, 0.98125, 0.975, 0.909375, 0.725, 0.421875, 0.0"+ ]+ },+ {+ "id": 4829,+ "type": "SamplerCustomAdvanced",+ "pos": [+ -1038.0941706614656,+ 3072.6006156614512+ ],+ "size": [+ 212.3638671875,+ 106+ ],+ "flags": {},+ "order": 31,+ "mode": 0,+ "inputs": [+ {+ "name": "noise",+ "type": "NOISE",+ "link": 13093+ },+ {+ "name": "guider",+ "type": "GUIDER",+ "link": 13089+ },+ {+ "name": "sampler",+ "type": "SAMPLER",+ "link": 13090+ },+ {+ "name": "sigmas",+ "type": "SIGMAS",+ "link": 13332+ },+ {+ "name": "latent_image",+ "type": "LATENT",+ "link": 13302+ }+ ],+ "outputs": [+ {+ "name": "output",+ "type": "LATENT",+ "links": [+ 13113+ ]+ },+ {+ "name": "denoised_output",+ "type": "LATENT",+ "links": []+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "SamplerCustomAdvanced"+ },+ "widgets_values": []+ },+ {+ "id": 4845,+ "type": "LTXVSeparateAVLatent",+ "pos": [+ -798.652111699169,+ 3072.7781591870753+ ],+ "size": [+ 193.2916015625,+ 46+ ],+ "flags": {},+ "order": 33,+ "mode": 0,+ "inputs": [+ {+ "name": "av_latent",+ "type": "LATENT",+ "link": 13113+ }+ ],+ "outputs": [+ {+ "name": "video_latent",+ "type": "LATENT",+ "links": [+ 13110+ ]+ },+ {+ "name": "audio_latent",+ "type": "LATENT",+ "links": [+ 13105+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.10.0",+ "Node name for S&R": "LTXVSeparateAVLatent"+ },+ "widgets_values": []+ },+ {+ "id": 4973,+ "type": "PrimitiveString",+ "pos": [+ -3532.616509090827,+ 3129.281147046972+ ],+ "size": [+ 270,+ 58+ ],+ "flags": {},+ "order": 4,+ "mode": 4,+ "inputs": [],+ "outputs": [+ {+ "name": "STRING",+ "type": "STRING",+ "links": [+ 13333,+ 13334+ ]+ }+ ],+ "title": "LTX API KEY",+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "PrimitiveString"+ },+ "widgets_values": [+ ""+ ]+ },+ {+ "id": 4802,+ "type": "SamplerCustomAdvanced",+ "pos": [+ -755.7347247712428,+ 3835.72072772421+ ],+ "size": [+ 212.3638671875,+ 106+ ],+ "flags": {},+ "order": 34,+ "mode": 0,+ "inputs": [+ {+ "name": "noise",+ "type": "NOISE",+ "link": 13066+ },+ {+ "name": "guider",+ "type": "GUIDER",+ "link": 13063+ },+ {+ "name": "sampler",+ "type": "SAMPLER",+ "link": 13326+ },+ {+ "name": "sigmas",+ "type": "SIGMAS",+ "link": 13327+ },+ {+ "name": "latent_image",+ "type": "LATENT",+ "link": 13298+ }+ ],+ "outputs": [+ {+ "name": "output",+ "type": "LATENT",+ "links": [+ 13073+ ]+ },+ {+ "name": "denoised_output",+ "type": "LATENT",+ "links": []+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "SamplerCustomAdvanced"+ },+ "widgets_values": []+ },+ {+ "id": 4852,+ "type": "SaveVideo",+ "pos": [+ 198.4051508602923,+ 2938.5275593141037+ ],+ "size": [+ 523.0556530433919,+ 506.3562313794205+ ],+ "flags": {},+ "order": 41,+ "mode": 0,+ "inputs": [+ {+ "name": "video",+ "type": "VIDEO",+ "link": 13112+ }+ ],+ "outputs": [],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1"+ },+ "widgets_values": [+ "output_D",+ "auto",+ "auto"+ ]+ },+ {+ "id": 4823,+ "type": "SaveVideo",+ "pos": [+ 200.6970928098834,+ 3618.666640637768+ ],+ "size": [+ 523.0556530433919,+ 506.3562313794205+ ],+ "flags": {},+ "order": 43,+ "mode": 0,+ "inputs": [+ {+ "name": "video",+ "type": "VIDEO",+ "link": 13072+ }+ ],+ "outputs": [],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1"+ },+ "widgets_values": [+ "output_F",+ "auto",+ "auto"+ ]+ },+ {+ "id": 4974,+ "type": "CM_FloatToInt",+ "pos": [+ -2338.041111677508,+ 3710.1908431089505+ ],+ "size": [+ 270,+ 58+ ],+ "flags": {+ "collapsed": true+ },+ "order": 23,+ "mode": 0,+ "inputs": [+ {+ "name": "a",+ "type": "FLOAT",+ "widget": {+ "name": "a"+ },+ "link": 13349+ }+ ],+ "outputs": [+ {+ "name": "INT",+ "type": "INT",+ "links": [+ 13338+ ]+ }+ ],+ "properties": {+ "aux_id": "evanspearman/ComfyMath",+ "ver": "c01177221c31b8e5fbc062778fc8254aeb541638",+ "Node name for S&R": "CM_FloatToInt"+ },+ "widgets_values": [+ 0+ ]+ },+ {+ "id": 4923,+ "type": "GemmaAPITextEncode",+ "pos": [+ -3379.5479534676806,+ 3244.1121765417483+ ],+ "size": [+ 347.3886205089311,+ 160+ ],+ "flags": {},+ "order": 16,+ "mode": 4,+ "inputs": [+ {+ "name": "api_key",+ "type": "STRING",+ "widget": {+ "name": "api_key"+ },+ "link": 13333+ }+ ],+ "outputs": [+ {+ "name": "conditioning",+ "type": "CONDITIONING",+ "links": null+ }+ ],+ "title": "🅛🅣🅧 Gemma API Text Encode - POSITIVE",+ "properties": {+ "Node name for S&R": "GemmaAPITextEncode"+ },+ "widgets_values": [+ "",+ "",+ "ltx-2.3-22b-dev.safetensors",+ "ltx-2.3-22b-dev.safetensors"+ ]+ },+ {+ "id": 4831,+ "type": "KSamplerSelect",+ "pos": [+ -1426.930639855046,+ 3258.383684916522+ ],+ "size": [+ 270,+ 74+ ],+ "flags": {},+ "order": 5,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "SAMPLER",+ "type": "SAMPLER",+ "links": [+ 13090+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "KSamplerSelect"+ },+ "widgets_values": [+ "euler_ancestral_cfg_pp"+ ]+ },+ {+ "id": 4808,+ "type": "MultimodalGuider",+ "pos": [+ -1078.1841706172434,+ 3733.7915592285995+ ],+ "size": [+ 232.30210947285332,+ 148+ ],+ "flags": {},+ "order": 28,+ "mode": 0,+ "inputs": [+ {+ "name": "model",+ "type": "MODEL",+ "link": 13325+ },+ {+ "name": "positive",+ "type": "CONDITIONING",+ "link": 13295+ },+ {+ "name": "negative",+ "type": "CONDITIONING",+ "link": 13297+ },+ {+ "name": "parameters",+ "type": "GUIDER_PARAMETERS",+ "link": 13329+ }+ ],+ "outputs": [+ {+ "name": "GUIDER",+ "type": "GUIDER",+ "links": [+ 13063+ ]+ }+ ],+ "properties": {+ "Node name for S&R": "MultimodalGuider"+ },+ "widgets_values": [+ "28"+ ]+ },+ {+ "id": 4960,+ "type": "LTXAVTextEncoderLoader",+ "pos": [+ -3551.2668835856803,+ 3450.146323053774+ ],+ "size": [+ 318.444921875,+ 122+ ],+ "flags": {},+ "order": 6,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "CLIP",+ "type": "CLIP",+ "links": [+ 13341,+ 13342+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "LTXAVTextEncoderLoader"+ },+ "widgets_values": [+ "comfy_gemma_3_12B_it.safetensors",+ "ltx-2.3-22b-dev.safetensors",+ "default"+ ]+ },+ {+ "id": 2612,+ "type": "CLIPTextEncode",+ "pos": [+ -3191.473482102202,+ 3711.1068743256483+ ],+ "size": [+ 327.2307315103926,+ 110.5535460412625+ ],+ "flags": {},+ "order": 19,+ "mode": 0,+ "inputs": [+ {+ "name": "clip",+ "type": "CLIP",+ "link": 13342+ }+ ],+ "outputs": [+ {+ "name": "CONDITIONING",+ "type": "CONDITIONING",+ "slot_index": 0,+ "links": [+ 7652+ ]+ }+ ],+ "title": "CLIP Text Encode (Negative Prompt)",+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.28",+ "Node name for S&R": "CLIPTextEncode"+ },+ "widgets_values": [+ "pc game, console game, video game, cartoon, childish, ugly"+ ],+ "color": "#322",+ "bgcolor": "#533"+ },+ {+ "id": 4967,+ "type": "ClownSampler_Beta",+ "pos": [+ -1089.0175297767012,+ 3937.5806241601526+ ],+ "size": [+ 279.8596884877679,+ 179.51445969356882+ ],+ "flags": {},+ "order": 7,+ "mode": 0,+ "inputs": [+ {+ "name": "guides",+ "shape": 7,+ "type": "GUIDES",+ "link": null+ },+ {+ "name": "options",+ "shape": 7,+ "type": "OPTIONS",+ "link": null+ }+ ],+ "outputs": [+ {+ "name": "sampler",+ "type": "SAMPLER",+ "links": [+ 13326+ ]+ }+ ],+ "properties": {+ "Node name for S&R": "ClownSampler_Beta"+ },+ "widgets_values": [+ 0.25,+ "exponential/res_2s",+ 94,+ "fixed",+ true+ ]+ },+ {+ "id": 4963,+ "type": "GuiderParameters",+ "pos": [+ -1427.861317423546,+ 4137.84960725206+ ],+ "size": [+ 299.6953125,+ 226+ ],+ "flags": {},+ "order": 8,+ "mode": 0,+ "inputs": [+ {+ "name": "parameters",+ "shape": 7,+ "type": "GUIDER_PARAMETERS",+ "link": null+ }+ ],+ "outputs": [+ {+ "name": "GUIDER_PARAMETERS",+ "type": "GUIDER_PARAMETERS",+ "links": [+ 13321+ ]+ }+ ],+ "properties": {+ "Node name for S&R": "GuiderParameters"+ },+ "widgets_values": [+ "AUDIO",+ 7,+ 1,+ true,+ 0.7,+ 3,+ 0,+ true+ ]+ },+ {+ "id": 4922,+ "type": "LoraLoaderModelOnly",+ "pos": [+ -4217.883339387363,+ 3262.713832635294+ ],+ "size": [+ 454.14193097539646,+ 128.44311555561626+ ],+ "flags": {},+ "order": 14,+ "mode": 0,+ "inputs": [+ {+ "name": "model",+ "type": "MODEL",+ "link": 13217+ }+ ],+ "outputs": [+ {+ "name": "MODEL",+ "type": "MODEL",+ "links": [+ 13270+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "LoraLoaderModelOnly"+ },+ "widgets_values": [+ "ltxv/ltx2/ltx-2.3-22b-distilled-lora-384.safetensors",+ 0.5+ ]+ },+ {+ "id": 4968,+ "type": "LoraLoaderModelOnly",+ "pos": [+ -4212.5785472767375,+ 3448.9517207024496+ ],+ "size": [+ 454.14193097539646,+ 128.44311555561626+ ],+ "flags": {},+ "order": 15,+ "mode": 0,+ "inputs": [+ {+ "name": "model",+ "type": "MODEL",+ "link": 13324+ }+ ],+ "outputs": [+ {+ "name": "MODEL",+ "type": "MODEL",+ "links": [+ 13325+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "LoraLoaderModelOnly"+ },+ "widgets_values": [+ "ltxv/ltx2/ltx-2.3-22b-distilled-lora-384.safetensors",+ 0.2+ ]+ },+ {+ "id": 4964,+ "type": "GuiderParameters",+ "pos": [+ -1431.9876111397823,+ 3850.6610116820607+ ],+ "size": [+ 299.6953125,+ 226+ ],+ "flags": {},+ "order": 20,+ "mode": 0,+ "inputs": [+ {+ "name": "parameters",+ "shape": 7,+ "type": "GUIDER_PARAMETERS",+ "link": 13321+ }+ ],+ "outputs": [+ {+ "name": "GUIDER_PARAMETERS",+ "type": "GUIDER_PARAMETERS",+ "links": [+ 13329+ ]+ }+ ],+ "properties": {+ "Node name for S&R": "GuiderParameters"+ },+ "widgets_values": [+ "VIDEO",+ 3,+ 1,+ true,+ 0.9,+ 3,+ 0,+ true+ ]+ },+ {+ "id": 2483,+ "type": "CLIPTextEncode",+ "pos": [+ -3177.88687035676,+ 3450.2955325886337+ ],+ "size": [+ 307.2346496582031,+ 204.2556610107422+ ],+ "flags": {},+ "order": 18,+ "mode": 0,+ "inputs": [+ {+ "name": "clip",+ "type": "CLIP",+ "link": 13341+ }+ ],+ "outputs": [+ {+ "name": "CONDITIONING",+ "type": "CONDITIONING",+ "slot_index": 0,+ "links": [+ 7065+ ]+ }+ ],+ "title": "CLIP Text Encode (Positive Prompt)",+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.28",+ "Node name for S&R": "CLIPTextEncode"+ },+ "widgets_values": [+ "A traditional Japanese tea ceremony takes place in a tatami room as a host carefully prepares matcha. Soft traditional koto music plays in the background, adding to the serene atmosphere. The bamboo whisk taps rhythmically against the ceramic bowl while water simmers in an iron kettle. Guests kneel in formal seiza position, watching in respectful silence. The host bows and presents the tea bowl, turning it precisely before offering it to the first guest with soft-spoken words."+ ],+ "color": "#232",+ "bgcolor": "#353"+ },+ {+ "id": 4828,+ "type": "CFGGuider",+ "pos": [+ -1428.052666915635,+ 3109.828197014793+ ],+ "size": [+ 270,+ 114+ ],+ "flags": {},+ "order": 27,+ "mode": 0,+ "inputs": [+ {+ "name": "model",+ "type": "MODEL",+ "link": 13270+ },+ {+ "name": "positive",+ "type": "CONDITIONING",+ "link": 13289+ },+ {+ "name": "negative",+ "type": "CONDITIONING",+ "link": 13296+ }+ ],+ "outputs": [+ {+ "name": "GUIDER",+ "type": "GUIDER",+ "links": [+ 13089+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "CFGGuider"+ },+ "widgets_values": [+ 1+ ]+ },+ {+ "id": 4832,+ "type": "RandomNoise",+ "pos": [+ -1422.9448478752652,+ 2976.8293701517505+ ],+ "size": [+ 279.7478557810682,+ 82+ ],+ "flags": {},+ "order": 9,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "NOISE",+ "type": "NOISE",+ "links": [+ 13093+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "RandomNoise"+ },+ "widgets_values": [+ 43,+ "fixed"+ ]+ },+ {+ "id": 2004,+ "type": "LoadImage",+ "pos": [+ -4343.876032724274,+ 3703.1695114292174+ ],+ "size": [+ 274.080078125,+ 314.000244140625+ ],+ "flags": {},+ "order": 10,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "IMAGE",+ "type": "IMAGE",+ "links": [+ 11002,+ 13352+ ]+ },+ {+ "name": "MASK",+ "type": "MASK",+ "links": []+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.56",+ "Node name for S&R": "LoadImage"+ },+ "widgets_values": [+ "example.png",+ "image"+ ]+ },+ {+ "id": 4977,+ "type": "PrimitiveBoolean",+ "pos": [+ -4034.5539485858703,+ 3952.2873754168977+ ],+ "size": [+ 270,+ 58+ ],+ "flags": {},+ "order": 11,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "BOOLEAN",+ "type": "BOOLEAN",+ "links": [+ 13345+ ]+ }+ ],+ "title": "bypass_i2v",+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.16.0",+ "Node name for S&R": "PrimitiveBoolean"+ },+ "widgets_values": [+ true+ ]+ },+ {+ "id": 4979,+ "type": "PrimitiveInt",+ "pos": [+ -2738.7811664958017,+ 3930.388555565199+ ],+ "size": [+ 270,+ 82+ ],+ "flags": {},+ "order": 12,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "INT",+ "type": "INT",+ "links": [+ 13350,+ 13351+ ]+ }+ ],+ "title": "number of frames",+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.16.0",+ "Node name for S&R": "PrimitiveInt"+ },+ "widgets_values": [+ 121,+ "fixed"+ ]+ },+ {+ "id": 4978,+ "type": "PrimitiveFloat",+ "pos": [+ -3079.5387171915363,+ 4031.84547703025+ ],+ "size": [+ 270,+ 58+ ],+ "flags": {},+ "order": 13,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "FLOAT",+ "type": "FLOAT",+ "links": [+ 13346,+ 13347,+ 13348,+ 13349+ ]+ }+ ],+ "title": "fps",+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.16.0",+ "Node name for S&R": "PrimitiveFloat"+ },+ "widgets_values": [+ 24+ ]+ },+ {+ "id": 4981,+ "type": "ResizeImageMaskNode",+ "pos": [+ -4043.718003225151,+ 3706.2559116658244+ ],+ "size": [+ 270,+ 106+ ],+ "flags": {},+ "order": 21,+ "mode": 0,+ "inputs": [+ {+ "name": "input",+ "type": "IMAGE,MASK",+ "link": 13352+ }+ ],+ "outputs": [+ {+ "name": "resized",+ "type": "IMAGE",+ "links": [+ 13353+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.16.0",+ "Node name for S&R": "ResizeImageMaskNode"+ },+ "widgets_values": [+ "scale longer dimension",+ 1536,+ "lanczos"+ ]+ },+ {+ "id": 4961,+ "type": "GemmaAPITextEncode",+ "pos": [+ -3007.4294675681895,+ 3241.2321795273106+ ],+ "size": [+ 337.49481491927054,+ 160+ ],+ "flags": {},+ "order": 17,+ "mode": 4,+ "inputs": [+ {+ "name": "api_key",+ "type": "STRING",+ "widget": {+ "name": "api_key"+ },+ "link": 13334+ }+ ],+ "outputs": [+ {+ "name": "conditioning",+ "type": "CONDITIONING",+ "links": null+ }+ ],+ "title": "🅛🅣🅧 Gemma API Text Encode - NEGATIVE",+ "properties": {+ "Node name for S&R": "GemmaAPITextEncode"+ },+ "widgets_values": [+ "",+ "pc game, console game, video game, cartoon, childish, ugly",+ false,+ "ltx-2.3-22b-dev.safetensors"+ ]+ }+ ],+ "links": [+ [+ 7065,+ 2483,+ 0,+ 1241,+ 0,+ "CONDITIONING"+ ],+ [+ 7652,+ 2612,+ 0,+ 1241,+ 1,+ "CONDITIONING"+ ],+ [+ 9768,+ 3336,+ 0,+ 3159,+ 1,+ "IMAGE"+ ],+ [+ 11002,+ 2004,+ 0,+ 2653,+ 0,+ "IMAGE"+ ],+ [+ 11401,+ 3059,+ 0,+ 3159,+ 2,+ "LATENT"+ ],+ [+ 12457,+ 3980,+ 0,+ 4528,+ 1,+ "LATENT"+ ],+ [+ 13034,+ 3159,+ 0,+ 4528,+ 0,+ "LATENT"+ ],+ [+ 13063,+ 4808,+ 0,+ 4802,+ 1,+ "GUIDER"+ ],+ [+ 13066,+ 4814,+ 0,+ 4802,+ 0,+ "NOISE"+ ],+ [+ 13069,+ 4818,+ 0,+ 4819,+ 1,+ "AUDIO"+ ],+ [+ 13072,+ 4819,+ 0,+ 4823,+ 0,+ "VIDEO"+ ],+ [+ 13073,+ 4802,+ 0,+ 4824,+ 0,+ "LATENT"+ ],+ [+ 13078,+ 4824,+ 0,+ 4822,+ 0,+ "LATENT"+ ],+ [+ 13080,+ 4824,+ 1,+ 4818,+ 0,+ "LATENT"+ ],+ [+ 13081,+ 4822,+ 0,+ 4819,+ 0,+ "IMAGE"+ ],+ [+ 13089,+ 4828,+ 0,+ 4829,+ 1,+ "GUIDER"+ ],+ [+ 13090,+ 4831,+ 0,+ 4829,+ 2,+ "SAMPLER"+ ],+ [+ 13093,+ 4832,+ 0,+ 4829,+ 0,+ "NOISE"+ ],+ [+ 13105,+ 4845,+ 1,+ 4848,+ 0,+ "LATENT"+ ],+ [+ 13107,+ 4851,+ 0,+ 4849,+ 0,+ "IMAGE"+ ],+ [+ 13108,+ 4848,+ 0,+ 4849,+ 1,+ "AUDIO"+ ],+ [+ 13110,+ 4845,+ 0,+ 4851,+ 0,+ "LATENT"+ ],+ [+ 13112,+ 4849,+ 0,+ 4852,+ 0,+ "VIDEO"+ ],+ [+ 13113,+ 4829,+ 0,+ 4845,+ 0,+ "LATENT"+ ],+ [+ 13217,+ 3940,+ 0,+ 4922,+ 0,+ "MODEL"+ ],+ [+ 13270,+ 4922,+ 0,+ 4828,+ 0,+ "MODEL"+ ],+ [+ 13274,+ 4010,+ 0,+ 3980,+ 0,+ "VAE"+ ],+ [+ 13275,+ 4010,+ 0,+ 4848,+ 1,+ "VAE"+ ],+ [+ 13279,+ 3940,+ 2,+ 3159,+ 0,+ "VAE"+ ],+ [+ 13280,+ 3940,+ 2,+ 4851,+ 1,+ "VAE"+ ],+ [+ 13289,+ 1241,+ 0,+ 4828,+ 1,+ "CONDITIONING"+ ],+ [+ 13295,+ 1241,+ 0,+ 4808,+ 1,+ "CONDITIONING"+ ],+ [+ 13296,+ 1241,+ 1,+ 4828,+ 2,+ "CONDITIONING"+ ],+ [+ 13297,+ 1241,+ 1,+ 4808,+ 2,+ "CONDITIONING"+ ],+ [+ 13298,+ 4528,+ 0,+ 4802,+ 4,+ "LATENT"+ ],+ [+ 13302,+ 4528,+ 0,+ 4829,+ 4,+ "LATENT"+ ],+ [+ 13304,+ 4010,+ 0,+ 4818,+ 1,+ "VAE"+ ],+ [+ 13305,+ 3940,+ 2,+ 4822,+ 1,+ "VAE"+ ],+ [+ 13321,+ 4963,+ 0,+ 4964,+ 0,+ "GUIDER_PARAMETERS"+ ],+ [+ 13324,+ 3940,+ 0,+ 4968,+ 0,+ "MODEL"+ ],+ [+ 13325,+ 4968,+ 0,+ 4808,+ 0,+ "MODEL"+ ],+ [+ 13326,+ 4967,+ 0,+ 4802,+ 2,+ "SAMPLER"+ ],+ [+ 13327,+ 4966,+ 0,+ 4802,+ 3,+ "SIGMAS"+ ],+ [+ 13328,+ 4528,+ 0,+ 4966,+ 0,+ "LATENT"+ ],+ [+ 13329,+ 4964,+ 0,+ 4808,+ 3,+ "GUIDER_PARAMETERS"+ ],+ [+ 13332,+ 4971,+ 0,+ 4829,+ 3,+ "SIGMAS"+ ],+ [+ 13333,+ 4973,+ 0,+ 4923,+ 0,+ "STRING"+ ],+ [+ 13334,+ 4973,+ 0,+ 4961,+ 0,+ "STRING"+ ],+ [+ 13338,+ 4974,+ 0,+ 3980,+ 2,+ "INT"+ ],+ [+ 13341,+ 4960,+ 0,+ 2483,+ 0,+ "CLIP"+ ],+ [+ 13342,+ 4960,+ 0,+ 2612,+ 0,+ "CLIP"+ ],+ [+ 13345,+ 4977,+ 0,+ 3159,+ 3,+ "BOOLEAN"+ ],+ [+ 13346,+ 4978,+ 0,+ 1241,+ 2,+ "FLOAT"+ ],+ [+ 13347,+ 4978,+ 0,+ 4819,+ 2,+ "FLOAT"+ ],+ [+ 13348,+ 4978,+ 0,+ 4849,+ 2,+ "FLOAT"+ ],+ [+ 13349,+ 4978,+ 0,+ 4974,+ 0,+ "FLOAT"+ ],+ [+ 13350,+ 4979,+ 0,+ 3059,+ 0,+ "INT"+ ],+ [+ 13351,+ 4979,+ 0,+ 3980,+ 1,+ "INT"+ ],+ [+ 13352,+ 2004,+ 0,+ 4981,+ 0,+ "IMAGE"+ ],+ [+ 13353,+ 4981,+ 0,+ 3336,+ 0,+ "IMAGE"+ ]+ ],+ "groups": [+ {+ "id": 54,+ "title": "Set prompts -> use API Text Encode for more memory efficient run",+ "bounding": [+ -3561.2668835856803,+ 3055.681147046972,+ 953.8833884586134,+ 775.9792733199389+ ],+ "color": "#3f789e",+ "font_size": 24,+ "flags": {},+ "nodes": [+ 1241,+ 4973,+ 4923,+ 4960,+ 2612,+ 2483,+ 4961+ ]+ },+ {+ "id": 106,+ "title": "Preprocess",+ "bounding": [+ -2495.2000699364985,+ 3225.5682237844176,+ 911.7998063426669,+ 521.6258583440732+ ],+ "color": "#3f789e",+ "font_size": 24,+ "flags": {},+ "nodes": [+ 3059,+ 3159,+ 3980,+ 4528,+ 3336,+ 4974+ ]+ },+ {+ "id": 110,+ "title": "Load Models",+ "bounding": [+ -4678.869579239853,+ 3050.9366855353146,+ 930.432962938512,+ 536.4581507227514+ ],+ "color": "#3f789e",+ "font_size": 24,+ "flags": {},+ "nodes": [+ 4010,+ 3940,+ 4922,+ 4968+ ]+ },+ {+ "id": 119,+ "title": "Load Image (set bypass=True if t2v)",+ "bounding": [+ -4353.876032724274,+ 3629.5695114292175,+ 599.3220841384041,+ 397.600244140625+ ],+ "color": "#3f789e",+ "font_size": 24,+ "flags": {},+ "nodes": [+ 2004,+ 4977,+ 4981+ ]+ },+ {+ "id": 147,+ "title": "Generate Distilled",+ "bounding": [+ -1438.052666915635,+ 2903.2293701517506,+ 842.7884060863663,+ 557.028112317964+ ],+ "color": "#b58b2a",+ "font_size": 24,+ "flags": {},+ "profilingGroup": false,+ "nodes": [+ 4971,+ 4829,+ 4845,+ 4831,+ 4828,+ 4832+ ]+ },+ {+ "id": 148,+ "title": "Generate Full",+ "bounding": [+ -1441.9876111397823,+ 3523.48613250672,+ 913.6241038873461,+ 850.3634747453426+ ],+ "color": "#3f789e",+ "font_size": 24,+ "flags": {},+ "profilingGroup": false,+ "nodes": [+ 4824,+ 4814,+ 4966,+ 4802,+ 4808,+ 4967,+ 4963,+ 4964+ ]+ },+ {+ "id": 150,+ "title": "Decode Distilled",+ "bounding": [+ -444.4648002758107,+ 2864.9275593141037,+ 1175.9256041794947,+ 589.9562313794205+ ],+ "color": "#b58b2a",+ "font_size": 24,+ "flags": {},+ "nodes": [+ 4848,+ 4851,+ 4849,+ 4852+ ]+ },+ {+ "id": 151,+ "title": "Decode Full",+ "bounding": [+ -442.17285832621803,+ 3545.066640637768,+ 1175.9256041794933,+ 589.956231379421+ ],+ "color": "#3f789e",+ "font_size": 24,+ "flags": {},+ "nodes": [+ 4818,+ 4822,+ 4819,+ 4823+ ]+ }+ ],+ "config": {},+ "extra": {+ "ds": {+ "scale": 0.7094965082353154,+ "offset": [+ 5360.328560176019,+ -2808.797614629239+ ]+ },+ "frontendVersion": "1.39.14",+ "VHS_latentpreview": false,+ "VHS_latentpreviewrate": 0,+ "VHS_MetadataImage": true,+ "VHS_KeepIntermediate": true,+ "workspace_info": {+ "id": "elBQFQknIoLYTEwIloQuw"+ },+ "node_versions": {+ "comfy-core": "0.3.30",+ "comfyui-kjnodes": "1.0.8"+ },+ "workflowRendererVersion": "LG",+ "reroutes": [+ {+ "id": 2,+ "pos": [+ -3655.6008317648625,+ 2850.265440938716+ ],+ "linkIds": [+ 13270+ ]+ },+ {+ "id": 3,+ "parentId": 2,+ "pos": [+ -1539.6013737779547,+ 2840.3312011990006+ ],+ "linkIds": [+ 13270+ ]+ },+ {+ "id": 4,+ "pos": [+ -3692.4173766989206,+ 2982.7957560039677+ ],+ "linkIds": [+ 13353+ ]+ },+ {+ "id": 5,+ "parentId": 4,+ "pos": [+ -2536.7201399197547,+ 2979.8444406971353+ ],+ "linkIds": [+ 13353+ ]+ },+ {+ "id": 6,+ "pos": [+ -3685.2282753104837,+ 2917.2387188165912+ ],+ "linkIds": [+ 13345+ ]+ },+ {+ "id": 7,+ "parentId": 6,+ "pos": [+ -2218.9088862249664,+ 2915.2182029526903+ ],+ "linkIds": [+ 13345+ ]+ },+ {+ "id": 8,+ "pos": [+ -4217.850878546107,+ 2688.3122524953264+ ],+ "linkIds": [+ 13274,+ 13275,+ 13304+ ]+ },+ {+ "id": 9,+ "parentId": 8,+ "pos": [+ -2246.9513572943683,+ 2693.147665470945+ ],+ "linkIds": [+ 13274,+ 13275,+ 13304+ ]+ },+ {+ "id": 10,+ "parentId": 9,+ "pos": [+ -537.070076497642,+ 2697.9288967010066+ ],+ "linkIds": [+ 13275,+ 13304+ ]+ },+ {+ "id": 11,+ "pos": [+ -3693.0033570573232,+ 3868.996001476813+ ],+ "linkIds": [+ 13325+ ]+ },+ {+ "id": 12,+ "parentId": 11,+ "pos": [+ -1522.9538426208132,+ 3861.4891276375843+ ],+ "linkIds": [+ 13325+ ]+ },+ {+ "id": 13,+ "parentId": 12,+ "pos": [+ -1513.3318499063203,+ 3760.588265051648+ ],+ "linkIds": [+ 13325+ ]+ },+ {+ "id": 15,+ "pos": [+ -4164.671732892902,+ 2650.8672457184525+ ],+ "linkIds": [+ 13279,+ 13280,+ 13305+ ]+ },+ {+ "id": 16,+ "parentId": 15,+ "pos": [+ -2208.2990768639206,+ 2657.0915251332212+ ],+ "linkIds": [+ 13279,+ 13280,+ 13305+ ]+ },+ {+ "id": 17,+ "parentId": 16,+ "pos": [+ -505.9149721233982,+ 2665.035568944363+ ],+ "linkIds": [+ 13280,+ 13305+ ]+ },+ {+ "id": 19,+ "pos": [+ -2192.685359833972,+ 3935.236494081786+ ],+ "linkIds": [+ 13351+ ]+ },+ {+ "id": 23,+ "pos": [+ -2437.6875865635175,+ 4048.2586989962456+ ],+ "linkIds": [+ 13347,+ 13348,+ 13349+ ]+ },+ {+ "id": 24,+ "pos": [+ -2576.3509667640615,+ 2797.8404787108125+ ],+ "linkIds": [+ 13289,+ 13295+ ]+ },+ {+ "id": 25,+ "parentId": 24,+ "pos": [+ -1497.3453090891626,+ 2794.877919759171+ ],+ "linkIds": [+ 13289,+ 13295+ ]+ },+ {+ "id": 26,+ "parentId": 25,+ "pos": [+ -1488.054142146024,+ 3771.4454594637414+ ],+ "linkIds": [+ 13295+ ]+ },+ {+ "id": 27,+ "pos": [+ -2559.147751129286,+ 2750.4743516185663+ ],+ "linkIds": [+ 13296,+ 13297+ ]+ },+ {+ "id": 28,+ "parentId": 27,+ "pos": [+ -1529.561515170329,+ 2749.5820398734795+ ],+ "linkIds": [+ 13296,+ 13297+ ]+ },+ {+ "id": 29,+ "parentId": 28,+ "pos": [+ -1535.5171679262967,+ 3793.3133356048907+ ],+ "linkIds": [+ 13297+ ]+ },+ {+ "id": 30,+ "pos": [+ -1551.0284826827924,+ 3495.9224152175493+ ],+ "linkIds": [+ 13298,+ 13328+ ]+ },+ {+ "id": 31,+ "parentId": 30,+ "pos": [+ -1105.0496527410276,+ 3500.25887153234+ ],+ "linkIds": [+ 13298,+ 13328+ ]+ },+ {+ "id": 32,+ "parentId": 31,+ "pos": [+ -821.6279382425903,+ 3502.5647179372104+ ],+ "linkIds": [+ 13298+ ]+ },+ {+ "id": 33,+ "pos": [+ -1451.214596704768,+ 2868.2331746414084+ ],+ "linkIds": [+ 13302+ ]+ },+ {+ "id": 34,+ "parentId": 33,+ "pos": [+ -1123.8782365053291,+ 2866.21558642831+ ],+ "linkIds": [+ 13302+ ]+ },+ {+ "id": 37,+ "parentId": 10,+ "pos": [+ -504.12371295246453,+ 3861.1866004358426+ ],+ "linkIds": [+ 13304+ ]+ },+ {+ "id": 38,+ "parentId": 17,+ "pos": [+ -474.4211088975866,+ 3658.2864504877357+ ],+ "linkIds": [+ 13305+ ]+ },+ {+ "id": 40,+ "parentId": 41,+ "pos": [+ -503.573553074101,+ 4415.953923409282+ ],+ "linkIds": [+ 13347,+ 13348+ ]+ },+ {+ "id": 41,+ "parentId": 23,+ "pos": [+ -2387.714827855422,+ 4405.769475426719+ ],+ "linkIds": [+ 13347,+ 13348+ ]+ },+ {+ "id": 42,+ "parentId": 40,+ "pos": [+ -485.2501917281843,+ 3525.7431260308654+ ],+ "linkIds": [+ 13347,+ 13348+ ]+ },+ {+ "id": 43,+ "parentId": 42,+ "pos": [+ -138.4947805911452,+ 3520.056072787075+ ],+ "linkIds": [+ 13347,+ 13348+ ]+ },+ {+ "id": 44,+ "pos": [+ -1945.5689778272103,+ 4326.742172526305+ ],+ "linkIds": [+ 13345+ ]+ }+ ],+ "linkExtensions": [+ {+ "id": 13270,+ "parentId": 3+ },+ {+ "id": 13274,+ "parentId": 9+ },+ {+ "id": 13275,+ "parentId": 10+ },+ {+ "id": 13279,+ "parentId": 16+ },+ {+ "id": 13280,+ "parentId": 17+ },+ {+ "id": 13289,+ "parentId": 25+ },+ {+ "id": 13295,+ "parentId": 26+ },+ {+ "id": 13296,+ "parentId": 28+ },+ {+ "id": 13297,+ "parentId": 29+ },+ {+ "id": 13298,+ "parentId": 32+ },+ {+ "id": 13302,+ "parentId": 34+ },+ {+ "id": 13304,+ "parentId": 37+ },+ {+ "id": 13305,+ "parentId": 38+ },+ {+ "id": 13325,+ "parentId": 13+ },+ {+ "id": 13328,+ "parentId": 31+ },+ {+ "id": 13345,+ "parentId": 7+ },+ {+ "id": 13347,+ "parentId": 43+ },+ {+ "id": 13348,+ "parentId": 43+ },+ {+ "id": 13349,+ "parentId": 23+ },+ {+ "id": 13351,+ "parentId": 19+ },+ {+ "id": 13353,+ "parentId": 5+ }+ ]+ },+ "version": 0.4+}diff --git a/example_workflows/2.3/LTX-2.3_T2V_I2V_Two_Stage_Distilled.json b/example_workflows/2.3/LTX-2.3_T2V_I2V_Two_Stage_Distilled.jsonnew file mode 100644index 0000000..04d3821--- /dev/null+++ b/example_workflows/2.3/LTX-2.3_T2V_I2V_Two_Stage_Distilled.json@@ -0,0 +1,2891 @@+{+ "id": "394ed254-7306-42a2-9ae6-aa880ce4456d",+ "revision": 0,+ "last_node_id": 4990,+ "last_link_id": 13396,+ "nodes": [+ {+ "id": 4848,+ "type": "LTXVAudioVAEDecode",+ "pos": [+ 716.3549191404252,+ 3354.9364184694505+ ],+ "size": [+ 242.46932983398438,+ 46+ ],+ "flags": {},+ "order": 38,+ "mode": 0,+ "inputs": [+ {+ "name": "samples",+ "type": "LATENT",+ "link": 13383+ },+ {+ "name": "audio_vae",+ "type": "VAE",+ "link": 13275+ }+ ],+ "outputs": [+ {+ "name": "Audio",+ "type": "AUDIO",+ "links": [+ 13108+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.64",+ "Node name for S&R": "LTXVAudioVAEDecode"+ },+ "widgets_values": []+ },+ {+ "id": 4849,+ "type": "CreateVideo",+ "pos": [+ 1011.0965242741515,+ 3151.8639011999735+ ],+ "size": [+ 270,+ 102+ ],+ "flags": {},+ "order": 39,+ "mode": 0,+ "inputs": [+ {+ "name": "images",+ "type": "IMAGE",+ "link": 13107+ },+ {+ "name": "audio",+ "shape": 7,+ "type": "AUDIO",+ "link": 13108+ },+ {+ "name": "fps",+ "type": "FLOAT",+ "widget": {+ "name": "fps"+ },+ "link": 13392+ }+ ],+ "outputs": [+ {+ "name": "VIDEO",+ "type": "VIDEO",+ "links": [+ 13112+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "CreateVideo"+ },+ "widgets_values": [+ 30+ ]+ },+ {+ "id": 3059,+ "type": "EmptyLTXVLatentVideo",+ "pos": [+ -2524.497249142452,+ 3454.3726008010667+ ],+ "size": [+ 210,+ 194+ ],+ "flags": {},+ "order": 22,+ "mode": 0,+ "inputs": [+ {+ "name": "length",+ "type": "INT",+ "widget": {+ "name": "length"+ },+ "link": 13389+ }+ ],+ "outputs": [+ {+ "name": "LATENT",+ "type": "LATENT",+ "links": [+ 11401+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.43",+ "Node name for S&R": "EmptyLTXVLatentVideo"+ },+ "widgets_values": [+ 960,+ 544,+ 121,+ 1+ ]+ },+ {+ "id": 3980,+ "type": "LTXVEmptyLatentAudio",+ "pos": [+ -2234.4084005303253,+ 3495.7073372627838+ ],+ "size": [+ 305.8394470214844,+ 106+ ],+ "flags": {+ "collapsed": false+ },+ "order": 25,+ "mode": 0,+ "inputs": [+ {+ "name": "audio_vae",+ "type": "VAE",+ "link": 13274+ },+ {+ "name": "frames_number",+ "type": "INT",+ "widget": {+ "name": "frames_number"+ },+ "link": 13390+ },+ {+ "name": "frame_rate",+ "type": "INT",+ "widget": {+ "name": "frame_rate"+ },+ "link": 13372+ }+ ],+ "outputs": [+ {+ "name": "Latent",+ "type": "LATENT",+ "links": [+ 12457+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.64",+ "Node name for S&R": "LTXVEmptyLatentAudio"+ },+ "widgets_values": [+ 97,+ 25,+ 1+ ]+ },+ {+ "id": 4528,+ "type": "LTXVConcatAVLatent",+ "pos": [+ -1871.055967895355,+ 3296.997842824149+ ],+ "size": [+ 181.308203125,+ 46+ ],+ "flags": {},+ "order": 29,+ "mode": 0,+ "inputs": [+ {+ "name": "video_latent",+ "type": "LATENT",+ "link": 13034+ },+ {+ "name": "audio_latent",+ "type": "LATENT",+ "link": 12457+ }+ ],+ "outputs": [+ {+ "name": "latent",+ "type": "LATENT",+ "links": [+ 13302+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.10.0",+ "Node name for S&R": "LTXVConcatAVLatent"+ },+ "widgets_values": []+ },+ {+ "id": 3159,+ "type": "LTXVImgToVideoConditionOnly",+ "pos": [+ -2238.0139314528687,+ 3294.0434645438772+ ],+ "size": [+ 313.2623046875,+ 142.859507731343+ ],+ "flags": {},+ "order": 28,+ "mode": 0,+ "inputs": [+ {+ "name": "vae",+ "type": "VAE",+ "link": 13279+ },+ {+ "name": "image",+ "type": "IMAGE",+ "link": 9768+ },+ {+ "name": "latent",+ "type": "LATENT",+ "link": 11401+ },+ {+ "name": "bypass",+ "shape": 7,+ "type": "BOOLEAN",+ "widget": {+ "name": "bypass"+ },+ "link": 13387+ }+ ],+ "outputs": [+ {+ "name": "latent",+ "type": "LATENT",+ "links": [+ 13034+ ]+ }+ ],+ "properties": {+ "Node name for S&R": "LTXVImgToVideoConditionOnly"+ },+ "widgets_values": [+ 0.7,+ false+ ]+ },+ {+ "id": 1241,+ "type": "LTXVConditioning",+ "pos": [+ -2895.15462938767,+ 3450.9802873962317+ ],+ "size": [+ 210,+ 78+ ],+ "flags": {},+ "order": 23,+ "mode": 0,+ "inputs": [+ {+ "name": "positive",+ "type": "CONDITIONING",+ "link": 7065+ },+ {+ "name": "negative",+ "type": "CONDITIONING",+ "link": 7652+ },+ {+ "name": "frame_rate",+ "type": "FLOAT",+ "widget": {+ "name": "frame_rate"+ },+ "link": 13391+ }+ ],+ "outputs": [+ {+ "name": "positive",+ "type": "CONDITIONING",+ "slot_index": 0,+ "links": [+ 13289,+ 13350+ ]+ },+ {+ "name": "negative",+ "type": "CONDITIONING",+ "slot_index": 1,+ "links": [+ 13296,+ 13351+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.28",+ "Node name for S&R": "LTXVConditioning"+ },+ "widgets_values": [+ 24+ ]+ },+ {+ "id": 4851,+ "type": "VAEDecodeTiled",+ "pos": [+ 691.996517885623,+ 3152.177067903495+ ],+ "size": [+ 270,+ 150+ ],+ "flags": {},+ "order": 37,+ "mode": 0,+ "inputs": [+ {+ "name": "samples",+ "type": "LATENT",+ "link": 13382+ },+ {+ "name": "vae",+ "type": "VAE",+ "link": 13348+ }+ ],+ "outputs": [+ {+ "name": "IMAGE",+ "type": "IMAGE",+ "links": [+ 13107+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "VAEDecodeTiled"+ },+ "widgets_values": [+ 512,+ 64,+ 512,+ 4+ ]+ },+ {+ "id": 4976,+ "type": "KSamplerSelect",+ "pos": [+ -186.03461297104238,+ 3454.3350423889824+ ],+ "size": [+ 276.26061914289176,+ 61.22112545115306+ ],+ "flags": {},+ "order": 0,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "SAMPLER",+ "type": "SAMPLER",+ "links": [+ 13330+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.71",+ "Node name for S&R": "KSamplerSelect"+ },+ "widgets_values": [+ "euler_cfg_pp"+ ]+ },+ {+ "id": 4971,+ "type": "SamplerCustomAdvanced",+ "pos": [+ 161.23571789327283,+ 3373.230078624507+ ],+ "size": [+ 212.3638671875,+ 106+ ],+ "flags": {},+ "order": 35,+ "mode": 0,+ "inputs": [+ {+ "name": "noise",+ "type": "NOISE",+ "link": 13328+ },+ {+ "name": "guider",+ "type": "GUIDER",+ "link": 13329+ },+ {+ "name": "sampler",+ "type": "SAMPLER",+ "link": 13330+ },+ {+ "name": "sigmas",+ "type": "SIGMAS",+ "link": 13375+ },+ {+ "name": "latent_image",+ "type": "LATENT",+ "link": 13332+ }+ ],+ "outputs": [+ {+ "name": "output",+ "type": "LATENT",+ "links": [+ 13362+ ]+ },+ {+ "name": "denoised_output",+ "type": "LATENT",+ "links": []+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.71",+ "Node name for S&R": "SamplerCustomAdvanced"+ },+ "widgets_values": []+ },+ {+ "id": 4964,+ "type": "CFGGuider",+ "pos": [+ -122.37176956213086,+ 3313.9180949942765+ ],+ "size": [+ 210,+ 98+ ],+ "flags": {},+ "order": 27,+ "mode": 0,+ "inputs": [+ {+ "name": "model",+ "type": "MODEL",+ "link": 13352+ },+ {+ "name": "positive",+ "type": "CONDITIONING",+ "link": 13350+ },+ {+ "name": "negative",+ "type": "CONDITIONING",+ "link": 13351+ }+ ],+ "outputs": [+ {+ "name": "GUIDER",+ "type": "GUIDER",+ "links": [+ 13329+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.71",+ "Node name for S&R": "CFGGuider"+ },+ "widgets_values": [+ 1+ ]+ },+ {+ "id": 4010,+ "type": "LTXVAudioVAELoader",+ "pos": [+ -4655.010641467211,+ 3122.9236915172387+ ],+ "size": [+ 384.6576773713696,+ 79.30435270514249+ ],+ "flags": {},+ "order": 1,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "Audio VAE",+ "type": "VAE",+ "links": [+ 13274,+ 13275+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.64",+ "Node name for S&R": "LTXVAudioVAELoader"+ },+ "widgets_values": [+ "ltx-2.3-22b-dev.safetensors"+ ]+ },+ {+ "id": 3940,+ "type": "CheckpointLoaderSimple",+ "pos": [+ -4648.711127852091,+ 3261.3436773800554+ ],+ "size": [+ 383.4002295473938,+ 108.51948797992713+ ],+ "flags": {},+ "order": 2,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "MODEL",+ "type": "MODEL",+ "links": [+ 13217+ ]+ },+ {+ "name": "CLIP",+ "type": "CLIP",+ "links": []+ },+ {+ "name": "VAE",+ "type": "VAE",+ "links": [+ 13279,+ 13346,+ 13347,+ 13348+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.56",+ "Node name for S&R": "CheckpointLoaderSimple"+ },+ "widgets_values": [+ "ltx-2.3-22b-dev.safetensors"+ ]+ },+ {+ "id": 4922,+ "type": "LoraLoaderModelOnly",+ "pos": [+ -4204.024401614721,+ 3261.100838617218+ ],+ "size": [+ 454.14193097539646,+ 128.44311555561626+ ],+ "flags": {},+ "order": 15,+ "mode": 0,+ "inputs": [+ {+ "name": "model",+ "type": "MODEL",+ "link": 13217+ }+ ],+ "outputs": [+ {+ "name": "MODEL",+ "type": "MODEL",+ "links": [+ 13270,+ 13352+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "LoraLoaderModelOnly"+ },+ "widgets_values": [+ "ltxv/ltx2/ltx-2.3-22b-distilled-lora-384.safetensors",+ 0.5+ ]+ },+ {+ "id": 4980,+ "type": "GemmaAPITextEncode",+ "pos": [+ -3444.8106564692425,+ 3246.3342331171134+ ],+ "size": [+ 347.3886205089311,+ 160+ ],+ "flags": {},+ "order": 16,+ "mode": 4,+ "inputs": [+ {+ "name": "api_key",+ "type": "STRING",+ "widget": {+ "name": "api_key"+ },+ "link": 13366+ }+ ],+ "outputs": [+ {+ "name": "conditioning",+ "type": "CONDITIONING",+ "links": null+ }+ ],+ "title": "🅛🅣🅧 Gemma API Text Encode - POSITIVE",+ "properties": {+ "Node name for S&R": "GemmaAPITextEncode"+ },+ "widgets_values": [+ "",+ "",+ "ltx-2.3-22b-dev.safetensors",+ "ltx-2.3-22b-dev.safetensors"+ ]+ },+ {+ "id": 4979,+ "type": "PrimitiveString",+ "pos": [+ -3597.879212092389,+ 3131.503203622337+ ],+ "size": [+ 270,+ 58+ ],+ "flags": {},+ "order": 3,+ "mode": 4,+ "inputs": [],+ "outputs": [+ {+ "name": "STRING",+ "type": "STRING",+ "links": [+ 13366,+ 13367+ ]+ }+ ],+ "title": "LTX API KEY",+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "PrimitiveString"+ },+ "widgets_values": [+ ""+ ]+ },+ {+ "id": 4982,+ "type": "LTXAVTextEncoderLoader",+ "pos": [+ -3616.529586587242,+ 3452.368379629139+ ],+ "size": [+ 318.444921875,+ 122+ ],+ "flags": {},+ "order": 4,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "CLIP",+ "type": "CLIP",+ "links": [+ 13368,+ 13369+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "LTXAVTextEncoderLoader"+ },+ "widgets_values": [+ "comfy_gemma_3_12B_it.safetensors",+ "ltx-2.3-22b-dev.safetensors",+ "default"+ ]+ },+ {+ "id": 3336,+ "type": "LTXVPreprocess",+ "pos": [+ -2570.43635256139,+ 3313.8991397637924+ ],+ "size": [+ 270,+ 74+ ],+ "flags": {},+ "order": 24,+ "mode": 0,+ "inputs": [+ {+ "name": "image",+ "type": "IMAGE",+ "link": 13395+ }+ ],+ "outputs": [+ {+ "name": "output_image",+ "type": "IMAGE",+ "links": [+ 9768+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.60",+ "Node name for S&R": "LTXVPreprocess"+ },+ "widgets_values": [+ 18+ ]+ },+ {+ "id": 4983,+ "type": "CM_FloatToInt",+ "pos": [+ -2431.349724020329,+ 3703.1711125515767+ ],+ "size": [+ 270,+ 58+ ],+ "flags": {+ "collapsed": true+ },+ "order": 21,+ "mode": 0,+ "inputs": [+ {+ "name": "a",+ "type": "FLOAT",+ "widget": {+ "name": "a"+ },+ "link": 13393+ }+ ],+ "outputs": [+ {+ "name": "INT",+ "type": "INT",+ "links": [+ 13372+ ]+ }+ ],+ "properties": {+ "aux_id": "evanspearman/ComfyMath",+ "ver": "c01177221c31b8e5fbc062778fc8254aeb541638",+ "Node name for S&R": "CM_FloatToInt"+ },+ "widgets_values": [+ 0+ ]+ },+ {+ "id": 2612,+ "type": "CLIPTextEncode",+ "pos": [+ -3259.244616362805,+ 3711.889063838961+ ],+ "size": [+ 327.8443419983205,+ 117.23972533000051+ ],+ "flags": {},+ "order": 19,+ "mode": 0,+ "inputs": [+ {+ "name": "clip",+ "type": "CLIP",+ "link": 13369+ }+ ],+ "outputs": [+ {+ "name": "CONDITIONING",+ "type": "CONDITIONING",+ "slot_index": 0,+ "links": [+ 7652+ ]+ }+ ],+ "title": "CLIP Text Encode (Negative Prompt)",+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.28",+ "Node name for S&R": "CLIPTextEncode"+ },+ "widgets_values": [+ "pc game, console game, video game, cartoon, childish, ugly"+ ],+ "color": "#322",+ "bgcolor": "#533"+ },+ {+ "id": 4832,+ "type": "RandomNoise",+ "pos": [+ -1595.3099114719337,+ 3194.760512128168+ ],+ "size": [+ 279.7478557810682,+ 82+ ],+ "flags": {},+ "order": 5,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "NOISE",+ "type": "NOISE",+ "links": [+ 13093+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "RandomNoise"+ },+ "widgets_values": [+ 43,+ "fixed"+ ]+ },+ {+ "id": 4828,+ "type": "CFGGuider",+ "pos": [+ -1600.4177305123035,+ 3327.7593389912104+ ],+ "size": [+ 270,+ 114+ ],+ "flags": {},+ "order": 26,+ "mode": 0,+ "inputs": [+ {+ "name": "model",+ "type": "MODEL",+ "link": 13270+ },+ {+ "name": "positive",+ "type": "CONDITIONING",+ "link": 13289+ },+ {+ "name": "negative",+ "type": "CONDITIONING",+ "link": 13296+ }+ ],+ "outputs": [+ {+ "name": "GUIDER",+ "type": "GUIDER",+ "links": [+ 13089+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "CFGGuider"+ },+ "widgets_values": [+ 1+ ]+ },+ {+ "id": 4831,+ "type": "KSamplerSelect",+ "pos": [+ -1599.2859684873301,+ 3486.453792299004+ ],+ "size": [+ 270,+ 74+ ],+ "flags": {},+ "order": 6,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "SAMPLER",+ "type": "SAMPLER",+ "links": [+ 13090+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "KSamplerSelect"+ },+ "widgets_values": [+ "euler_ancestral_cfg_pp"+ ]+ },+ {+ "id": 4829,+ "type": "SamplerCustomAdvanced",+ "pos": [+ -1221.970314179945,+ 3295.7653725358114+ ],+ "size": [+ 212.3638671875,+ 106+ ],+ "flags": {},+ "order": 30,+ "mode": 0,+ "inputs": [+ {+ "name": "noise",+ "type": "NOISE",+ "link": 13093+ },+ {+ "name": "guider",+ "type": "GUIDER",+ "link": 13089+ },+ {+ "name": "sampler",+ "type": "SAMPLER",+ "link": 13090+ },+ {+ "name": "sigmas",+ "type": "SIGMAS",+ "link": 13374+ },+ {+ "name": "latent_image",+ "type": "LATENT",+ "link": 13302+ }+ ],+ "outputs": [+ {+ "name": "output",+ "type": "LATENT",+ "links": [+ 13363+ ]+ },+ {+ "name": "denoised_output",+ "type": "LATENT",+ "links": []+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "SamplerCustomAdvanced"+ },+ "widgets_values": []+ },+ {+ "id": 4967,+ "type": "RandomNoise",+ "pos": [+ -186.6553293124547,+ 3174.9180223966914+ ],+ "size": [+ 270,+ 82+ ],+ "flags": {+ "collapsed": false+ },+ "order": 7,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "NOISE",+ "type": "NOISE",+ "links": [+ 13328+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.71",+ "Node name for S&R": "RandomNoise"+ },+ "widgets_values": [+ 42,+ "fixed"+ ]+ },+ {+ "id": 4984,+ "type": "ManualSigmas",+ "pos": [+ -1593.5601695497103,+ 3614.617936723543+ ],+ "size": [+ 499.94633283206986,+ 67.3573576655076+ ],+ "flags": {},+ "order": 8,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "SIGMAS",+ "type": "SIGMAS",+ "links": [+ 13374+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "ManualSigmas"+ },+ "widgets_values": [+ "1.0, 0.99375, 0.9875, 0.98125, 0.975, 0.909375, 0.725, 0.421875, 0.0"+ ]+ },+ {+ "id": 4985,+ "type": "ManualSigmas",+ "pos": [+ -181.669145105583,+ 3565.928312528714+ ],+ "size": [+ 274.0120536645418,+ 58+ ],+ "flags": {},+ "order": 9,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "SIGMAS",+ "type": "SIGMAS",+ "links": [+ 13375+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "ManualSigmas"+ },+ "widgets_values": [+ "0.85, 0.7250, 0.4219, 0.0"+ ]+ },+ {+ "id": 4969,+ "type": "LTXVConcatAVLatent",+ "pos": [+ -85.18442802960456,+ 3683.3482142997213+ ],+ "size": [+ 181.308203125,+ 46+ ],+ "flags": {},+ "order": 34,+ "mode": 0,+ "inputs": [+ {+ "name": "video_latent",+ "type": "LATENT",+ "link": 13323+ },+ {+ "name": "audio_latent",+ "type": "LATENT",+ "link": 13349+ }+ ],+ "outputs": [+ {+ "name": "latent",+ "type": "LATENT",+ "links": [+ 13332+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.5.1",+ "Node name for S&R": "LTXVConcatAVLatent"+ },+ "widgets_values": []+ },+ {+ "id": 4970,+ "type": "LTXVImgToVideoConditionOnly",+ "pos": [+ -428.24384495257186,+ 3683.0005983274414+ ],+ "size": [+ 313.2623046875,+ 122+ ],+ "flags": {},+ "order": 33,+ "mode": 0,+ "inputs": [+ {+ "name": "vae",+ "type": "VAE",+ "link": 13346+ },+ {+ "name": "image",+ "type": "IMAGE",+ "link": 13396+ },+ {+ "name": "latent",+ "type": "LATENT",+ "link": 13326+ },+ {+ "name": "bypass",+ "shape": 7,+ "type": "BOOLEAN",+ "widget": {+ "name": "bypass"+ },+ "link": 13388+ }+ ],+ "outputs": [+ {+ "name": "latent",+ "type": "LATENT",+ "links": [+ 13323+ ]+ }+ ],+ "properties": {+ "Node name for S&R": "LTXVImgToVideoConditionOnly"+ },+ "widgets_values": [+ 1,+ false+ ]+ },+ {+ "id": 4975,+ "type": "LTXVLatentUpsampler",+ "pos": [+ -642.8427052813528,+ 3721.7661702112346+ ],+ "size": [+ 187.8501953125,+ 66+ ],+ "flags": {},+ "order": 32,+ "mode": 0,+ "inputs": [+ {+ "name": "samples",+ "type": "LATENT",+ "link": 13337+ },+ {+ "name": "upscale_model",+ "type": "LATENT_UPSCALE_MODEL",+ "link": 13336+ },+ {+ "name": "vae",+ "type": "VAE",+ "link": 13347+ }+ ],+ "outputs": [+ {+ "name": "LATENT",+ "type": "LATENT",+ "links": [+ 13326+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "LTXVLatentUpsampler"+ },+ "widgets_values": []+ },+ {+ "id": 4974,+ "type": "LatentUpscaleModelLoader",+ "pos": [+ -4176.8075678023615,+ 3135.9807550730275+ ],+ "size": [+ 416.00371451903027,+ 69.37478000918873+ ],+ "flags": {},+ "order": 10,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "LATENT_UPSCALE_MODEL",+ "type": "LATENT_UPSCALE_MODEL",+ "links": [+ 13336+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1",+ "Node name for S&R": "LatentUpscaleModelLoader"+ },+ "widgets_values": [+ "ltx-2.3-spatial-upscaler-x2-1.0.safetensors"+ ]+ },+ {+ "id": 4845,+ "type": "LTXVSeparateAVLatent",+ "pos": [+ -976.1182418849571,+ 3297.1053739563445+ ],+ "size": [+ 193.2916015625,+ 46+ ],+ "flags": {},+ "order": 31,+ "mode": 0,+ "inputs": [+ {+ "name": "av_latent",+ "type": "LATENT",+ "link": 13363+ }+ ],+ "outputs": [+ {+ "name": "video_latent",+ "type": "LATENT",+ "links": [+ 13337+ ]+ },+ {+ "name": "audio_latent",+ "type": "LATENT",+ "links": [+ 13349+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.10.0",+ "Node name for S&R": "LTXVSeparateAVLatent"+ },+ "widgets_values": []+ },+ {+ "id": 4973,+ "type": "LTXVSeparateAVLatent",+ "pos": [+ 410.38250931781465,+ 3371.875094157033+ ],+ "size": [+ 193.2916015625,+ 46+ ],+ "flags": {},+ "order": 36,+ "mode": 0,+ "inputs": [+ {+ "name": "av_latent",+ "type": "LATENT",+ "link": 13362+ }+ ],+ "outputs": [+ {+ "name": "video_latent",+ "type": "LATENT",+ "links": [+ 13382+ ]+ },+ {+ "name": "audio_latent",+ "type": "LATENT",+ "links": [+ 13383+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.5.1",+ "Node name for S&R": "LTXVSeparateAVLatent"+ },+ "widgets_values": []+ },+ {+ "id": 2004,+ "type": "LoadImage",+ "pos": [+ -4339.520366567158,+ 3508.6843590474864+ ],+ "size": [+ 274.080078125,+ 314.000244140625+ ],+ "flags": {},+ "order": 11,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "IMAGE",+ "type": "IMAGE",+ "links": [+ 11002,+ 13394+ ]+ },+ {+ "name": "MASK",+ "type": "MASK",+ "links": []+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.56",+ "Node name for S&R": "LoadImage"+ },+ "widgets_values": [+ "example.png",+ "image"+ ]+ },+ {+ "id": 4989,+ "type": "PrimitiveFloat",+ "pos": [+ -3152.1276183269097,+ 3984.2067549396024+ ],+ "size": [+ 270,+ 58+ ],+ "flags": {},+ "order": 12,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "FLOAT",+ "type": "FLOAT",+ "links": [+ 13391,+ 13392,+ 13393+ ]+ }+ ],+ "title": "fps",+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.16.0",+ "Node name for S&R": "PrimitiveFloat"+ },+ "widgets_values": [+ 24+ ]+ },+ {+ "id": 4988,+ "type": "PrimitiveInt",+ "pos": [+ -2818.760822457342,+ 3891.612150182899+ ],+ "size": [+ 270,+ 82+ ],+ "flags": {},+ "order": 13,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "INT",+ "type": "INT",+ "links": [+ 13389,+ 13390+ ]+ }+ ],+ "title": "number of frames",+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.16.0",+ "Node name for S&R": "PrimitiveInt"+ },+ "widgets_values": [+ 121,+ "fixed"+ ]+ },+ {+ "id": 4852,+ "type": "SaveVideo",+ "pos": [+ 1020.807842880594,+ 3313.4654128903926+ ],+ "size": [+ 523.0556530433919,+ 506.3562313794205+ ],+ "flags": {},+ "order": 40,+ "mode": 0,+ "inputs": [+ {+ "name": "video",+ "type": "VIDEO",+ "link": 13112+ }+ ],+ "outputs": [],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.14.1"+ },+ "widgets_values": [+ "output",+ "auto",+ "auto"+ ]+ },+ {+ "id": 4987,+ "type": "PrimitiveBoolean",+ "pos": [+ -4031.3167505882293,+ 3762.482778928455+ ],+ "size": [+ 270,+ 58+ ],+ "flags": {},+ "order": 14,+ "mode": 0,+ "inputs": [],+ "outputs": [+ {+ "name": "BOOLEAN",+ "type": "BOOLEAN",+ "links": [+ 13387,+ 13388+ ]+ }+ ],+ "title": "bypass_i2v",+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.16.0",+ "Node name for S&R": "PrimitiveBoolean"+ },+ "widgets_values": [+ true+ ]+ },+ {+ "id": 2483,+ "type": "CLIPTextEncode",+ "pos": [+ -3245.658004617363,+ 3451.0777221019466+ ],+ "size": [+ 307.2346496582031,+ 204.2556610107422+ ],+ "flags": {},+ "order": 18,+ "mode": 0,+ "inputs": [+ {+ "name": "clip",+ "type": "CLIP",+ "link": 13368+ }+ ],+ "outputs": [+ {+ "name": "CONDITIONING",+ "type": "CONDITIONING",+ "slot_index": 0,+ "links": [+ 7065+ ]+ }+ ],+ "title": "CLIP Text Encode (Positive Prompt)",+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.3.28",+ "Node name for S&R": "CLIPTextEncode"+ },+ "widgets_values": [+ "A traditional Japanese tea ceremony takes place in a tatami room as a host carefully prepares matcha. Soft traditional koto music plays in the background, adding to the serene atmosphere. The bamboo whisk taps rhythmically against the ceramic bowl while water simmers in an iron kettle. Guests kneel in formal seiza position, watching in respectful silence. The host bows and presents the tea bowl, turning it precisely before offering it to the first guest with soft-spoken words."+ ],+ "color": "#232",+ "bgcolor": "#353"+ },+ {+ "id": 4981,+ "type": "GemmaAPITextEncode",+ "pos": [+ -3072.6921705697514,+ 3243.4542361026756+ ],+ "size": [+ 337.49481491927054,+ 160+ ],+ "flags": {},+ "order": 17,+ "mode": 4,+ "inputs": [+ {+ "name": "api_key",+ "type": "STRING",+ "widget": {+ "name": "api_key"+ },+ "link": 13367+ }+ ],+ "outputs": [+ {+ "name": "conditioning",+ "type": "CONDITIONING",+ "links": null+ }+ ],+ "title": "🅛🅣🅧 Gemma API Text Encode - NEGATIVE",+ "properties": {+ "Node name for S&R": "GemmaAPITextEncode"+ },+ "widgets_values": [+ "",+ "pc game, console game, video game, cartoon, childish, ugly",+ false,+ "ltx-2.3-22b-dev.safetensors"+ ]+ },+ {+ "id": 4990,+ "type": "ResizeImageMaskNode",+ "pos": [+ -4034.1483284692663,+ 3511.4994332371434+ ],+ "size": [+ 270,+ 106+ ],+ "flags": {},+ "order": 20,+ "mode": 0,+ "inputs": [+ {+ "name": "input",+ "type": "IMAGE,MASK",+ "link": 13394+ }+ ],+ "outputs": [+ {+ "name": "resized",+ "type": "IMAGE",+ "links": [+ 13395,+ 13396+ ]+ }+ ],+ "properties": {+ "cnr_id": "comfy-core",+ "ver": "0.16.0",+ "Node name for S&R": "ResizeImageMaskNode"+ },+ "widgets_values": [+ "scale longer dimension",+ 1536,+ "lanczos"+ ]+ }+ ],+ "links": [+ [+ 7065,+ 2483,+ 0,+ 1241,+ 0,+ "CONDITIONING"+ ],+ [+ 7652,+ 2612,+ 0,+ 1241,+ 1,+ "CONDITIONING"+ ],+ [+ 9768,+ 3336,+ 0,+ 3159,+ 1,+ "IMAGE"+ ],+ [+ 11002,+ 2004,+ 0,+ 2653,+ 0,+ "IMAGE"+ ],+ [+ 11401,+ 3059,+ 0,+ 3159,+ 2,+ "LATENT"+ ],+ [+ 12457,+ 3980,+ 0,+ 4528,+ 1,+ "LATENT"+ ],+ [+ 13034,+ 3159,+ 0,+ 4528,+ 0,+ "LATENT"+ ],+ [+ 13089,+ 4828,+ 0,+ 4829,+ 1,+ "GUIDER"+ ],+ [+ 13090,+ 4831,+ 0,+ 4829,+ 2,+ "SAMPLER"+ ],+ [+ 13093,+ 4832,+ 0,+ 4829,+ 0,+ "NOISE"+ ],+ [+ 13107,+ 4851,+ 0,+ 4849,+ 0,+ "IMAGE"+ ],+ [+ 13108,+ 4848,+ 0,+ 4849,+ 1,+ "AUDIO"+ ],+ [+ 13112,+ 4849,+ 0,+ 4852,+ 0,+ "VIDEO"+ ],+ [+ 13217,+ 3940,+ 0,+ 4922,+ 0,+ "MODEL"+ ],+ [+ 13270,+ 4922,+ 0,+ 4828,+ 0,+ "MODEL"+ ],+ [+ 13274,+ 4010,+ 0,+ 3980,+ 0,+ "VAE"+ ],+ [+ 13275,+ 4010,+ 0,+ 4848,+ 1,+ "VAE"+ ],+ [+ 13279,+ 3940,+ 2,+ 3159,+ 0,+ "VAE"+ ],+ [+ 13289,+ 1241,+ 0,+ 4828,+ 1,+ "CONDITIONING"+ ],+ [+ 13296,+ 1241,+ 1,+ 4828,+ 2,+ "CONDITIONING"+ ],+ [+ 13302,+ 4528,+ 0,+ 4829,+ 4,+ "LATENT"+ ],+ [+ 13323,+ 4970,+ 0,+ 4969,+ 0,+ "LATENT"+ ],+ [+ 13326,+ 4975,+ 0,+ 4970,+ 2,+ "LATENT"+ ],+ [+ 13328,+ 4967,+ 0,+ 4971,+ 0,+ "NOISE"+ ],+ [+ 13329,+ 4964,+ 0,+ 4971,+ 1,+ "GUIDER"+ ],+ [+ 13330,+ 4976,+ 0,+ 4971,+ 2,+ "SAMPLER"+ ],+ [+ 13332,+ 4969,+ 0,+ 4971,+ 4,+ "LATENT"+ ],+ [+ 13336,+ 4974,+ 0,+ 4975,+ 1,+ "LATENT_UPSCALE_MODEL"+ ],+ [+ 13337,+ 4845,+ 0,+ 4975,+ 0,+ "LATENT"+ ],+ [+ 13346,+ 3940,+ 2,+ 4970,+ 0,+ "VAE"+ ],+ [+ 13347,+ 3940,+ 2,+ 4975,+ 2,+ "VAE"+ ],+ [+ 13348,+ 3940,+ 2,+ 4851,+ 1,+ "VAE"+ ],+ [+ 13349,+ 4845,+ 1,+ 4969,+ 1,+ "LATENT"+ ],+ [+ 13350,+ 1241,+ 0,+ 4964,+ 1,+ "CONDITIONING"+ ],+ [+ 13351,+ 1241,+ 1,+ 4964,+ 2,+ "CONDITIONING"+ ],+ [+ 13352,+ 4922,+ 0,+ 4964,+ 0,+ "MODEL"+ ],+ [+ 13362,+ 4971,+ 0,+ 4973,+ 0,+ "LATENT"+ ],+ [+ 13363,+ 4829,+ 0,+ 4845,+ 0,+ "LATENT"+ ],+ [+ 13366,+ 4979,+ 0,+ 4980,+ 0,+ "STRING"+ ],+ [+ 13367,+ 4979,+ 0,+ 4981,+ 0,+ "STRING"+ ],+ [+ 13368,+ 4982,+ 0,+ 2483,+ 0,+ "CLIP"+ ],+ [+ 13369,+ 4982,+ 0,+ 2612,+ 0,+ "CLIP"+ ],+ [+ 13372,+ 4983,+ 0,+ 3980,+ 2,+ "INT"+ ],+ [+ 13374,+ 4984,+ 0,+ 4829,+ 3,+ "SIGMAS"+ ],+ [+ 13375,+ 4985,+ 0,+ 4971,+ 3,+ "SIGMAS"+ ],+ [+ 13382,+ 4973,+ 0,+ 4851,+ 0,+ "LATENT"+ ],+ [+ 13383,+ 4973,+ 1,+ 4848,+ 0,+ "LATENT"+ ],+ [+ 13387,+ 4987,+ 0,+ 3159,+ 3,+ "BOOLEAN"+ ],+ [+ 13388,+ 4987,+ 0,+ 4970,+ 3,+ "BOOLEAN"+ ],+ [+ 13389,+ 4988,+ 0,+ 3059,+ 0,+ "INT"+ ],+ [+ 13390,+ 4988,+ 0,+ 3980,+ 1,+ "INT"+ ],+ [+ 13391,+ 4989,+ 0,+ 1241,+ 2,+ "FLOAT"+ ],+ [+ 13392,+ 4989,+ 0,+ 4849,+ 2,+ "FLOAT"+ ],+ [+ 13393,+ 4989,+ 0,+ 4983,+ 0,+ "FLOAT"+ ],+ [+ 13394,+ 2004,+ 0,+ 4990,+ 0,+ "IMAGE"+ ],+ [+ 13395,+ 4990,+ 0,+ 3336,+ 0,+ "IMAGE"+ ],+ [+ 13396,+ 4990,+ 0,+ 4970,+ 1,+ "IMAGE"+ ]+ ],+ "groups": [+ {+ "id": 54,+ "title": "Set prompts -> use API Text Encode for more memory efficient run",+ "bounding": [+ -3626.529586587242,+ 3057.903203622337,+ 951.3749571995722,+ 781.2255855466248+ ],+ "color": "#3f789e",+ "font_size": 24,+ "flags": {},+ "nodes": [+ 1241,+ 4980,+ 4979,+ 4982,+ 2612,+ 2483,+ 4981+ ]+ },+ {+ "id": 106,+ "title": "Preprocess",+ "bounding": [+ -2580.43635256139,+ 3220.4434645438773,+ 900.688587791034,+ 492.7276480076995+ ],+ "color": "#3f789e",+ "font_size": 24,+ "flags": {},+ "nodes": [+ 3059,+ 3980,+ 4528,+ 3159,+ 3336,+ 4983+ ]+ },+ {+ "id": 110,+ "title": "Load Models",+ "bounding": [+ -4665.010641467211,+ 3049.323691517239,+ 925.1281708278889,+ 350.22026265559555+ ],+ "color": "#3f789e",+ "font_size": 24,+ "flags": {},+ "nodes": [+ 4010,+ 3940,+ 4922,+ 4974+ ]+ },+ {+ "id": 119,+ "title": "Load Image (set bypass=True if t2v)",+ "bounding": [+ -4358.914906079388,+ 3418.802768023745,+ 619.7715680124834,+ 532.4508954406257+ ],+ "color": "#3f789e",+ "font_size": 24,+ "flags": {},+ "nodes": [+ 2004,+ 4987,+ 4990+ ]+ },+ {+ "id": 147,+ "title": "Generate Low Resolution",+ "bounding": [+ -1610.4177305123035,+ 3121.160512128168,+ 842.7884060863674,+ 683.0021825460141+ ],+ "color": "#b58b2a",+ "font_size": 24,+ "flags": {},+ "profilingGroup": false,+ "nodes": [+ 4832,+ 4828,+ 4831,+ 4829,+ 4984,+ 4845+ ]+ },+ {+ "id": 150,+ "title": "Decode",+ "bounding": [+ 681.996517885623,+ 3078.2639011999736,+ 871.8669780383623,+ 751.5577430698396+ ],+ "color": "#b58b2a",+ "font_size": 24,+ "flags": {},+ "nodes": [+ 4848,+ 4849,+ 4851,+ 4852+ ]+ },+ {+ "id": 151,+ "title": "Generate High Resolution",+ "bounding": [+ -652.8427052813528,+ 3101.3180223966915,+ 1266.5168161616675,+ 713.68257593075+ ],+ "color": "#b58b2a",+ "font_size": 24,+ "flags": {},+ "nodes": [+ 4976,+ 4971,+ 4964,+ 4967,+ 4985,+ 4969,+ 4970,+ 4975,+ 4973+ ]+ }+ ],+ "config": {},+ "extra": {+ "ds": {+ "scale": 0.6708350354041495,+ "offset": [+ 5096.828085602879,+ -2650.3117890915855+ ]+ },+ "frontendVersion": "1.39.14",+ "VHS_latentpreview": false,+ "VHS_latentpreviewrate": 0,+ "VHS_MetadataImage": true,+ "VHS_KeepIntermediate": true,+ "workspace_info": {+ "id": "elBQFQknIoLYTEwIloQuw"+ },+ "node_versions": {+ "comfy-core": "0.3.30",+ "comfyui-kjnodes": "1.0.8"+ },+ "workflowRendererVersion": "LG",+ "reroutes": [+ {+ "id": 2,+ "pos": [+ -3661.9023458579836,+ 2804.0161378226267+ ],+ "linkIds": [+ 13270,+ 13352+ ]+ },+ {+ "id": 3,+ "parentId": 2,+ "pos": [+ -1571.1536457475722,+ 2790.6809140564897+ ],+ "linkIds": [+ 13270,+ 13352+ ]+ },+ {+ "id": 4,+ "pos": [+ -3696.841757815916,+ 3022.6167271901927+ ],+ "linkIds": [+ 13395,+ 13396+ ]+ },+ {+ "id": 5,+ "parentId": 4,+ "pos": [+ -2649.184760039795,+ 3013.7862648649293+ ],+ "linkIds": [+ 13395,+ 13396+ ]+ },+ {+ "id": 6,+ "pos": [+ -3686.7969361831374,+ 2966.0300722982424+ ],+ "linkIds": [+ 13387,+ 13388+ ]+ },+ {+ "id": 7,+ "parentId": 6,+ "pos": [+ -2236.9699160538207,+ 2967.935494574642+ ],+ "linkIds": [+ 13387,+ 13388+ ]+ },+ {+ "id": 8,+ "pos": [+ -4233.4603428874425,+ 2754.572737894683+ ],+ "linkIds": [+ 13274,+ 13275+ ]+ },+ {+ "id": 9,+ "parentId": 8,+ "pos": [+ -2318.63434041248,+ 2743.85533371343+ ],+ "linkIds": [+ 13274,+ 13275+ ]+ },+ {+ "id": 10,+ "parentId": 9,+ "pos": [+ 631.2808665670776,+ 2742.7392112510656+ ],+ "linkIds": [+ 13275+ ]+ },+ {+ "id": 15,+ "pos": [+ -4196.216822192213,+ 2706.352312194367+ ],+ "linkIds": [+ 13279,+ 13346,+ 13347,+ 13348+ ]+ },+ {+ "id": 16,+ "parentId": 15,+ "pos": [+ -2287.0350909071085,+ 2691.674879816308+ ],+ "linkIds": [+ 13279,+ 13346,+ 13347,+ 13348+ ]+ },+ {+ "id": 17,+ "parentId": 16,+ "pos": [+ -708.0890990587966,+ 2691.3978670364254+ ],+ "linkIds": [+ 13346,+ 13347,+ 13348+ ]+ },+ {+ "id": 19,+ "pos": [+ -2286.342269168168,+ 3899.083478168674+ ],+ "linkIds": [+ 13390+ ]+ },+ {+ "id": 23,+ "pos": [+ -2470.7143821696213,+ 3999.039532349397+ ],+ "linkIds": [+ 13392,+ 13393+ ]+ },+ {+ "id": 24,+ "pos": [+ -2611.3174387669633,+ 2878.58952543805+ ],+ "linkIds": [+ 13289,+ 13350+ ]+ },+ {+ "id": 25,+ "parentId": 24,+ "pos": [+ -1658.053079224495,+ 2874.8599200672265+ ],+ "linkIds": [+ 13289,+ 13350+ ]+ },+ {+ "id": 27,+ "pos": [+ -2583.2110039440263,+ 2836.8096786723+ ],+ "linkIds": [+ 13296,+ 13351+ ]+ },+ {+ "id": 28,+ "parentId": 27,+ "pos": [+ -1680.0869192537912,+ 2833.374540056024+ ],+ "linkIds": [+ 13296,+ 13351+ ]+ },+ {+ "id": 33,+ "pos": [+ -1643.4291815735385,+ 3088.6246806014137+ ],+ "linkIds": [+ 13302+ ]+ },+ {+ "id": 34,+ "parentId": 33,+ "pos": [+ -1303.9256586080094,+ 3086.9515649623418+ ],+ "linkIds": [+ 13302+ ]+ },+ {+ "id": 43,+ "parentId": 23,+ "pos": [+ 939.747072404933,+ 3997.4729325925136+ ],+ "linkIds": [+ 13392+ ]+ },+ {+ "id": 44,+ "pos": [+ -3722.540602622728,+ 2931.494843948071+ ],+ "linkIds": [+ 13336+ ]+ },+ {+ "id": 45,+ "parentId": 44,+ "pos": [+ -745.7780812270597,+ 2912.907664163951+ ],+ "linkIds": [+ 13336+ ]+ },+ {+ "id": 46,+ "parentId": 7,+ "pos": [+ -542.5606711207868,+ 2970.787657133208+ ],+ "linkIds": [+ 13388+ ]+ },+ {+ "id": 47,+ "parentId": 5,+ "pos": [+ -484.1907985828398,+ 3011.120652978356+ ],+ "linkIds": [+ 13396+ ]+ },+ {+ "id": 48,+ "parentId": 17,+ "pos": [+ -660.7309666011929,+ 3625.7227627218076+ ],+ "linkIds": [+ 13346+ ]+ },+ {+ "id": 49,+ "parentId": 17,+ "pos": [+ -728.5670403490717,+ 3749.1278673213274+ ],+ "linkIds": [+ 13347+ ]+ },+ {+ "id": 50,+ "parentId": 17,+ "pos": [+ 663.1970428704286,+ 2698.393757442232+ ],+ "linkIds": [+ 13348+ ]+ },+ {+ "id": 51,+ "pos": [+ -668.8172100153665,+ 3848.9465113676124+ ],+ "linkIds": [+ 13349+ ]+ },+ {+ "id": 52,+ "parentId": 51,+ "pos": [+ -93.18652388446046,+ 3846.31601628848+ ],+ "linkIds": [+ 13349+ ]+ },+ {+ "id": 53,+ "parentId": 28,+ "pos": [+ -286.3295474265229,+ 2829.4928806745065+ ],+ "linkIds": [+ 13351+ ]+ },+ {+ "id": 54,+ "parentId": 25,+ "pos": [+ -257.4635136635567,+ 2871.6385009087176+ ],+ "linkIds": [+ 13350+ ]+ },+ {+ "id": 55,+ "parentId": 3,+ "pos": [+ -225.26037663731938,+ 2789.021037737891+ ],+ "linkIds": [+ 13352+ ]+ },+ {+ "id": 56,+ "parentId": 45,+ "pos": [+ -700.4191447610027,+ 3715.8687966908715+ ],+ "linkIds": [+ 13336+ ]+ },+ {+ "id": 57,+ "pos": [+ -2541.4153960340986,+ 4183.066195783035+ ],+ "linkIds": [+ 13347,+ 13348,+ 13349+ ]+ }+ ],+ "linkExtensions": [+ {+ "id": 13270,+ "parentId": 3+ },+ {+ "id": 13274,+ "parentId": 9+ },+ {+ "id": 13275,+ "parentId": 10+ },+ {+ "id": 13279,+ "parentId": 16+ },+ {+ "id": 13289,+ "parentId": 25+ },+ {+ "id": 13296,+ "parentId": 28+ },+ {+ "id": 13302,+ "parentId": 34+ },+ {+ "id": 13336,+ "parentId": 56+ },+ {+ "id": 13346,+ "parentId": 48+ },+ {+ "id": 13347,+ "parentId": 49+ },+ {+ "id": 13348,+ "parentId": 50+ },+ {+ "id": 13349,+ "parentId": 52+ },+ {+ "id": 13350,+ "parentId": 54+ },+ {+ "id": 13351,+ "parentId": 53+ },+ {+ "id": 13352,+ "parentId": 55+ },+ {+ "id": 13387,+ "parentId": 7+ },+ {+ "id": 13388,+ "parentId": 46+ },+ {+ "id": 13390,+ "parentId": 19+ },+ {+ "id": 13392,+ "parentId": 43+ },+ {+ "id": 13393,+ "parentId": 23+ },+ {+ "id": 13395,+ "parentId": 5+ },+ {+ "id": 13396,+ "parentId": 47+ }+ ]+ },+ "version": 0.4+}diff --git a/gemma_api_conditioning.py b/gemma_api_conditioning.pyindex 0131706..54bdf46 100644--- a/gemma_api_conditioning.py+++ b/gemma_api_conditioning.py@@ -78,6 +78,13 @@ class GemmaAPITextEncode:"tooltip": "Text prompt to encode",},),+ "enhance_prompt": (+ "BOOLEAN",+ {+ "default": True,+ "tooltip": "When enabled, the prompt is enhanced using Gemma 3 before encoding",+ },+ ),"ckpt_name": (folder_paths.get_filename_list("checkpoints"),{"tooltip": "The name of the checkpoint (model) to load."},@@ -90,7 +97,9 @@ class GemmaAPITextEncode:FUNCTION = "encode"CATEGORY = "api node/text/Lightricks"- def encode(self, api_key: str, prompt: str, ckpt_name: str):+ def encode(+ self, api_key: str, prompt: str, ckpt_name: str, enhance_prompt: bool = False+ ):if not api_key:raise ValueError("API key is required")@@ -101,7 +110,11 @@ class GemmaAPITextEncode:raise ValueError("Model path is required")model_id = extract_model_id(ckpt_name)- payload = {"prompt": prompt, "model_id": model_id}+ payload = {+ "prompt": prompt,+ "model_id": model_id,+ "enhance_prompt": enhance_prompt,+ }logger.info(f"Calling API to encode prompt: {prompt[:50]}... with model_id: {model_id[:50]}...")diff --git a/gemma_encoder.py b/gemma_encoder.pyindex 7c1b679..a60e7d6 100644--- a/gemma_encoder.py+++ b/gemma_encoder.py@@ -1,19 +1,13 @@-import jsonimport loggingfrom glob import globfrom pathlib import Pathfrom typing import List, Optional, Tupleimport comfy.model_management-import comfy.opsimport comfy.sdimport comfy.supported_models_baseimport folder_paths-import safetensorsimport torch-from comfy.ldm.lightricks.model import LTXFrequenciesPrecision, LTXRopeType-from comfy.utils import load_torch_file-from einops import rearrangefrom PIL import Imagefrom transformers import (AutoImageProcessor,@@ -25,13 +19,11 @@ from transformers import (from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONSfrom transformers.models.auto.modeling_auto import MODEL_MAPPING_NAMES-from .embeddings_connector import Embeddings1DConnectorfrom .nodes_registry import comfy_node+from .text_embeddings_connectors import load_text_embeddings_pipelinelogger = logging.getLogger(__name__)-PREFIX_BASE = "model.diffusion_model."-def _load_system_prompt(filename: str) -> str:"""Load system prompt from file at module level."""@@ -56,99 +48,6 @@ def tensor_to_pil(tensor: torch.Tensor) -> Image.Image:return Image.fromarray(numpy_image)-def load_video_embeddings_connector(ltxv_path, dtype=torch.bfloat16):- sd, metadata = load_torch_file(str(ltxv_path), return_metadata=True)- config = json.loads(metadata.get("config", "{}"))- transformer_config = config.get("transformer", {})- rope_type = LTXRopeType.from_dict(transformer_config)- frequencies_precision = LTXFrequenciesPrecision.from_dict(transformer_config)- pe_max_pos = transformer_config.get("connector_positional_embedding_max_pos", [1])- sd_keys = list(sd.keys())-- video_only_connector_prefix = f"{PREFIX_BASE}embeddings_connector."- av_connector_prefix = f"{PREFIX_BASE}video_embeddings_connector."- prefix = (- av_connector_prefix- if f"{PREFIX_BASE}audio_adaln_single.linear.weight" in sd_keys- else video_only_connector_prefix- )- return load_embeddings_connector(- sd, prefix, dtype, rope_type, frequencies_precision, pe_max_pos- )---def load_audio_embeddings_connector(ltxv_path, dtype=torch.bfloat16):- sd, metadata = load_torch_file(str(ltxv_path), return_metadata=True)- config = json.loads(metadata.get("config", "{}"))- transformer_config = config.get("transformer", {})- rope_type = LTXRopeType.from_dict(transformer_config)- frequencies_precision = LTXFrequenciesPrecision.from_dict(transformer_config)- pe_max_pos = transformer_config.get("connector_positional_embedding_max_pos", [1])- return load_embeddings_connector(- sd,- f"{PREFIX_BASE}audio_embeddings_connector.",- dtype,- rope_type,- frequencies_precision,- pe_max_pos,- )---def load_embeddings_connector(- sd,- connector_prefix,- dtype=torch.bfloat16,- rope_type=LTXRopeType.INTERLEAVED,- frequencies_precision=LTXFrequenciesPrecision.FLOAT32,- pe_max_pos=None,-):- sd_connector = {- k[len(connector_prefix) :]: v- for k, v in sd.items()- if k.startswith(connector_prefix)- }-- if len(sd_connector) == 0:- return None-- operations = comfy.ops.pick_operations(dtype, dtype, disable_fast_fp8=True)- connector = Embeddings1DConnector(- dtype=dtype,- operations=operations,- positional_embedding_max_pos=pe_max_pos if pe_max_pos is not None else [1],- split_rope=rope_type == LTXRopeType.SPLIT,- double_precision_rope=frequencies_precision == LTXFrequenciesPrecision.FLOAT64,- )- connector.load_state_dict(sd_connector)- return connector---def load_proj_matrix_from_ltxv(ltxv_path: Path, prefix=""):- with safetensors.safe_open(ltxv_path, framework="pt", device="cpu") as f:- keys = filter(lambda key: key.startswith(prefix), f.keys())- sd = {k.removeprefix(prefix): f.get_tensor(k) for k in keys if k in f.keys()}- if not sd:- return None- model = GemmaFeaturesExtractorProjLinear()- model.load_state_dict(sd)- return model---def load_proj_matrix_from_checkpoint(checkpoint_path: Path):- """- Load model weights from a checkpoint file.- :param checkpoint_path: Path to the checkpoint file.- """- model = GemmaFeaturesExtractorProjLinear()- loaded_state_dict = load_torch_file(str(checkpoint_path), return_metadata=False)- if "aggregate_embed.weight" not in loaded_state_dict:- raise ValueError(- f"Checkpoint {checkpoint_path} does not contain 'aggregate_embed.weight'."- )- model.load_state_dict(loaded_state_dict)- return model--class LTXVGemmaTokenizer:def __init__(self, tokenizer_path: str, max_length: int = 1024):self.tokenizer = AutoTokenizer.from_pretrained(@@ -184,22 +83,12 @@ class LTXVGemmaTokenizer:return out-class GemmaFeaturesExtractorProjLinear(torch.nn.Module):- def __init__(self):- super().__init__()- self.aggregate_embed = torch.nn.Linear(3840 * 49, 3840, bias=False)-- def forward(self, x):- return self.aggregate_embed(x)--class LTXVGemmaTextEncoderModel(torch.nn.Module):def __init__(self,model: Gemma3ForConditionalGeneration,- feature_extractor_linear: GemmaFeaturesExtractorProjLinear,- embeddings_connector: Embeddings1DConnector,- audio_embeddings_connector: Embeddings1DConnector | None = None,+ feature_extractor, # FeatureExtractorV1/V2+ embeddings_processor, # VideoEmbeddingsProcessor or AVEmbeddingsProcessorprocessor: Gemma3Processor | None = None,dtype=torch.bfloat16,device="cpu",@@ -207,13 +96,8 @@ class LTXVGemmaTextEncoderModel(torch.nn.Module):super().__init__()self.model = modelself.processor = processor- self.feature_extractor_linear = feature_extractor_linear.to(dtype=dtype)- self.embeddings_connector = embeddings_connector.to(dtype=dtype)- self.audio_embeddings_connector = (- audio_embeddings_connector.to(dtype=dtype)- if audio_embeddings_connector is not None- else None- )+ self.feature_extractor = feature_extractor.to(dtype=dtype)+ self.embeddings_processor = embeddings_processor.to(dtype=dtype)self.dtypes = set([dtype])# Cache an estimate of memory required to load/keep the model on device# weights size + small overhead@@ -227,89 +111,20 @@ class LTXVGemmaTextEncoderModel(torch.nn.Module):def reset_clip_options(self):pass- @staticmethod- def norm_and_concat_padded_batch(- encoded_text: torch.Tensor,- sequence_lengths: torch.Tensor,- padding_side: str = "right",- ) -> torch.Tensor:- """- Normalize a 4D tensor [B, T, D, L] per sample and per layer, using sequence_lengths to mask.- Returns [B, T, D * L] tensor with original padding preserved.-- Args:- encoded_text: 4D tensor [B, T, D, L]- sequence_lengths: 1D tensor [B] with actual sequence lengths- padding_side: "left" or "right" to indicate which side has padding- """- B, T, D, L = encoded_text.shape- device = encoded_text.device-- # Build mask: [B, T, 1, 1]- token_indices = torch.arange(T, device=device)[None, :] # [1, T]-- if padding_side == "right":- # For right padding, valid tokens are from 0 to sequence_length-1- mask = token_indices < sequence_lengths[:, None] # [B, T]- elif padding_side == "left":- # For left padding, valid tokens are from (T - sequence_length) to T-1- start_indices = T - sequence_lengths[:, None] # [B, 1]- mask = token_indices >= start_indices # [B, T]- else:- raise ValueError(- f"padding_side must be 'left' or 'right', got {padding_side}"- )-- mask = rearrange(mask, "b t -> b t 1 1")-- # Compute masked mean: [B, 1, 1, L]- masked = encoded_text.masked_fill(~mask, 0.0)- # denom = mask.sum(dim=(1, 2), keepdim=True) # [B, 1, 1, 1]- denom = (sequence_lengths * D).view(B, 1, 1, 1)- mean = masked.sum(dim=(1, 2), keepdim=True) / (denom + 1e-6)-- # Compute masked min/max: [B, 1, 1, L]- x_min = encoded_text.masked_fill(~mask, float("inf")).amin(- dim=(1, 2), keepdim=True- )- x_max = encoded_text.masked_fill(~mask, float("-inf")).amax(- dim=(1, 2), keepdim=True- )- range_ = x_max - x_min-- # Normalize only the valid tokens- normed = 8 * (encoded_text - mean) / (range_ + 1e-6)-- # concat to be [Batch, T, D * L] - this preserves the original structure- normed = normed.reshape(B, T, -1) # [B, T, D * L]-- # Apply mask to preserve original padding (set padded positions to 0)- mask_flattened = rearrange(mask, "b t 1 1 -> b t 1").expand(-1, -1, D * L)- normed = normed.masked_fill(~mask_flattened, 0.0)-- return normed-def forward(self, input_ids, attention_mask, padding_side="right"):+ # Block 1: Run Gemma modeloutputs = self.model(input_ids=input_ids,attention_mask=attention_mask,output_hidden_states=True,)- encoded_text_features = torch.stack(outputs.hidden_states, dim=-1)- encoded_text_features_dtype = encoded_text_features.dtype+ all_layer_hiddens = torch.stack(outputs.hidden_states, dim=-1) # [B, T, D, L]- sequence_lengths = attention_mask.sum(dim=-1)- normed_concated_encoded_text_features = (- LTXVGemmaTextEncoderModel.norm_and_concat_padded_batch(- encoded_text_features, sequence_lengths, padding_side=padding_side- )+ # Block 2: Feature extraction+ features = self.feature_extractor(+ all_layer_hiddens, attention_mask, padding_side)-- projected = self.feature_extractor_linear(- normed_concated_encoded_text_features.to(encoded_text_features_dtype)- )-- return projected+ return features # dict with "video" and optionally "audio"def encode_token_weights(self, token_weight_pairs):token_pairs = token_weight_pairs["gemma"]@@ -322,31 +137,20 @@ class LTXVGemmaTextEncoderModel(torch.nn.Module):self.to(self.model.device)- encoded_input = self(input_ids, attention_mask, padding_side="left")- # convert attention mask to format embeddings connector expects.- connector_attention_mask = (attention_mask - 1).to(encoded_input.dtype).reshape(- (attention_mask.shape[0], 1, -1, attention_mask.shape[-1])- ) * torch.finfo(encoded_input.dtype).max- encoded, encoded_connector_attention_mask = self.embeddings_connector(- encoded_input,- connector_attention_mask,- )-- # restore the mask values to int64- attention_mask = (encoded_connector_attention_mask < 0.000001).to(torch.int64)+ features = self(input_ids, attention_mask, padding_side="left")- attention_mask = attention_mask.reshape([encoded.shape[0], encoded.shape[1], 1])- encoded = encoded * attention_mask+ # Convert binary mask -> additive mask for processor+ encoded_input_dtype = next(iter(features.values())).dtype+ connector_attention_mask = (attention_mask - 1).to(encoded_input_dtype).reshape(+ (attention_mask.shape[0], 1, -1, attention_mask.shape[-1])+ ) * torch.finfo(encoded_input_dtype).max- if self.audio_embeddings_connector is not None:- encoded_for_audio, _ = self.audio_embeddings_connector(- encoded_input, connector_attention_mask- )- encoded = torch.concat(- [encoded, encoded_for_audio], dim=len(encoded.shape) - 1- )+ # Block 3: Embeddings processor+ encoded, mask = self.embeddings_processor.create_embeddings(+ features, connector_attention_mask+ )- return encoded, None, {"attention_mask": attention_mask.squeeze(-1)}+ return encoded, None, {"attention_mask": mask}def load_sd(self, sd):return self.model.load_state_dict(sd, strict=False)@@ -368,28 +172,23 @@ def ltxv_gemma_clip(encoder_path, ltxv_path, processor=None, dtype=None):class _LTXVGemmaTextEncoderModel(LTXVGemmaTextEncoderModel):def __init__(self, device="cpu", dtype=dtype, model_options={}):dtype = torch.bfloat16 # TODO: make this configurable+gemma_model = Gemma3ForConditionalGeneration.from_pretrained(encoder_path,local_files_only=True,torch_dtype=dtype,)- feature_extractor_linear = load_proj_matrix_from_ltxv(+ feature_extractor, embeddings_processor = load_text_embeddings_pipeline(ltxv_path,- "text_embedding_projection.",+ dtype=dtype,+ fallback_proj_path=encoder_path / "proj_linear.safetensors",)- if feature_extractor_linear is None:- feature_extractor_linear = load_proj_matrix_from_checkpoint(- encoder_path / "proj_linear.safetensors"- )- embeddings_connector = load_video_embeddings_connector(ltxv_path)- audio_embeddings_connector = load_audio_embeddings_connector(ltxv_path)super().__init__(model=gemma_model,- feature_extractor_linear=feature_extractor_linear,- embeddings_connector=embeddings_connector,- audio_embeddings_connector=audio_embeddings_connector,+ feature_extractor=feature_extractor,+ embeddings_processor=embeddings_processor,processor=processor,dtype=dtype,device=device,diff --git a/guide.py b/guide.pyindex 404c447..b3b5ad9 100644--- a/guide.py+++ b/guide.py@@ -252,3 +252,205 @@ class LTXVImgToVideoAdvanced:batch_size=batch_size,strength=strength,)+++@comfy_node(name="LTXVAddGuideAdvancedAttention")+class LTXVAddGuideAdvancedAttention:+ """Extended keyframe guide node with per-guide attention strength control.++ Same preprocessing as LTXVAddGuideAdvanced (CRF, blur, interpolation, crop),+ plus attention_strength and attention_mask inputs to control how strongly+ this guide's conditioning influences generation via self-attention.+ """++ @classmethod+ def INPUT_TYPES(s):+ return {+ "required": {+ "positive": ("CONDITIONING",),+ "negative": ("CONDITIONING",),+ "vae": ("VAE",),+ "latent": ("LATENT",),+ "image": ("IMAGE",),+ "frame_idx": (+ "INT",+ {+ "default": 0,+ "min": -9999,+ "max": 9999,+ "tooltip": (+ "Frame index to start the conditioning at. "+ "Negative values are counted from the end of the video."+ ),+ },+ ),+ "strength": (+ "FLOAT",+ {+ "default": 1.0,+ "min": 0.0,+ "max": 1.0,+ "tooltip": "Strength of the conditioning. Higher values make it more exact.",+ },+ ),+ "crf": (+ "INT",+ {+ "default": 29,+ "min": 0,+ "max": 51,+ "step": 1,+ "tooltip": "CRF value. Higher = more motion, lower = higher quality.",+ },+ ),+ "blur_radius": (+ "INT",+ {+ "default": 0,+ "min": 0,+ "max": 7,+ "step": 1,+ "tooltip": "Blur kernel radius. Higher = more motion.",+ },+ ),+ "interpolation": (+ [+ "lanczos",+ "bislerp",+ "nearest",+ "bilinear",+ "bicubic",+ "area",+ "nearest-exact",+ ],+ {"default": "lanczos"},+ ),+ "crop": (["center", "disabled"], {"default": "disabled"}),+ "attention_strength": (+ "FLOAT",+ {+ "default": 1.0,+ "min": 0.0,+ "max": 1.0,+ "step": 0.01,+ "tooltip": (+ "Controls how strongly this guide influences generation via "+ "self-attention. 1.0 = full conditioning, 0.0 = ignore."+ ),+ },+ ),+ },+ "optional": {+ "attention_mask": (+ "MASK",+ {+ "tooltip": (+ "Optional pixel-space spatial mask. Shape (F, H, W) or (H, W). "+ "Values in [0, 1]. Controls per-region conditioning influence. "+ "Multiplied by attention_strength."+ ),+ },+ ),+ },+ }++ RETURN_TYPES = ("CONDITIONING", "CONDITIONING", "LATENT")+ RETURN_NAMES = ("positive", "negative", "latent")++ CATEGORY = "conditioning/video_models"+ FUNCTION = "generate"++ DESCRIPTION = (+ "Adds a conditioning frame/video at a specific frame index with per-guide "+ "attention strength control. Same preprocessing as LTXVAddGuideAdvanced, "+ "plus attention_strength and optional spatial attention_mask."+ )++ def generate(+ self,+ positive,+ negative,+ vae,+ latent,+ image,+ frame_idx,+ strength,+ crf,+ blur_radius,+ interpolation,+ crop,+ attention_strength=1.0,+ attention_mask=None,+ ):+ from .iclora_attention import append_guide_attention_entry, normalize_mask++ # Preprocessing: resize, CRF, blur (same as LTXVAddGuideAdvanced)+ scale_factors = vae.downscale_index_formula+ _, width_scale_factor, height_scale_factor = scale_factors+ latent_image = latent["samples"]+ noise_mask = nodes_lt.get_noise_mask(latent)+ _, _, latent_length, latent_height, latent_width = latent_image.shape++ width = latent_width * width_scale_factor+ height = latent_height * height_scale_factor+ image = (+ comfy.utils.common_upscale(+ image.movedim(-1, 1), width, height, interpolation, crop=crop+ )+ .movedim(1, -1)+ .clamp(0, 1)+ )+ image = nodes_lt.LTXVPreprocess().execute(image, crf)[0]+ image = blur_internal(image, blur_radius)++ # Encode+ _, t = nodes_lt.LTXVAddGuide.encode(+ vae, latent_width, latent_height, image, scale_factors+ )++ # Compute latent index+ frame_idx, latent_idx = nodes_lt.LTXVAddGuide.get_latent_index(+ positive, latent_length, len(image), frame_idx, scale_factors+ )+ assert (+ latent_idx + t.shape[2] <= latent_length+ ), "Conditioning frames exceed the length of the latent sequence."++ # Append keyframe+ positive, negative, latent_image, noise_mask = (+ nodes_lt.LTXVAddGuide.append_keyframe(+ positive,+ negative,+ frame_idx,+ latent_image,+ noise_mask,+ t,+ strength,+ scale_factors,+ )+ )++ # Track with custom attention strength/mask+ pre_filter_count = t.shape[2] * t.shape[3] * t.shape[4]+ guide_latent_shape = list(t.shape[2:])+ norm_mask = normalize_mask(attention_mask)+ positive = append_guide_attention_entry(+ positive,+ pre_filter_count,+ guide_latent_shape,+ attention_strength=attention_strength,+ attention_mask=norm_mask,+ )+ negative = append_guide_attention_entry(+ negative,+ pre_filter_count,+ guide_latent_shape,+ attention_strength=attention_strength,+ attention_mask=norm_mask,+ )++ return (+ positive,+ negative,+ {"samples": latent_image, "noise_mask": noise_mask},+ )diff --git a/guiders/parameters.py b/guiders/parameters.pyindex 749d13d..89b94ec 100644--- a/guiders/parameters.py+++ b/guiders/parameters.py@@ -19,6 +19,8 @@ class GuiderParameters:modality_scale: float = 1.0,skip_step: int = 0,cross_attn: bool = True,+ cfg_zero_star: bool = False,+ zero_init_sigma: float = 1.0,):self.cfg_scale = cfg_scaleself.stg_scale = stg_scale@@ -27,6 +29,8 @@ class GuiderParameters:self.modality_scale = modality_scaleself.skip_step = skip_stepself.cross_attn = cross_attn+ self.cfg_zero_star = cfg_zero_star+ self.zero_init_sigma = zero_init_sigmadef __str__(self):return f"cfg_scale: {self.cfg_scale}, stg_scale: {self.stg_scale}, rescale_scale: {self.rescale_scale}, modality_scale: {self.modality_scale}"diff --git a/iclora.py b/iclora.pyindex 483b9b8..079630b 100644--- a/iclora.py+++ b/iclora.py@@ -4,6 +4,7 @@ import comfyimport comfy.sdimport comfy_extras.nodes_lt as nodes_ltimport folder_paths+import torchfrom comfy_api.latest import iofrom .latents import LTXVDilateLatent@@ -161,6 +162,15 @@ class LTXAddVideoICLoRAGuide(io.ComfyNode):noise_mask = nodes_lt.get_noise_mask(latent)_, _, latent_length, latent_height, latent_width = latent_image.shape++ time_scale_factor = scale_factors[0]+ num_frames_to_keep = (+ (image.shape[0] - 1) // time_scale_factor+ ) * time_scale_factor + 1+ causal_fix = frame_idx == 0 or num_frames_to_keep == 1+ if not causal_fix:+ image = torch.cat([image[:1], image], dim=0)+image, guide_latent = cls.encode(vae,latent_width,@@ -173,6 +183,14 @@ class LTXAddVideoICLoRAGuide(io.ComfyNode):tile_size,tile_overlap,)++ if not causal_fix:+ guide_latent = guide_latent[:, :, 1:, :, :]+ image = image[1:]++ # Record original (pre-dilation) guide latent shape for spatial mask downsampling+ guide_orig_shape = list(guide_latent.shape[2:]) # [F, H_small, W_small]+guide_mask = None# Dilate the latent if latent_downscale_factor > 1@@ -193,6 +211,11 @@ class LTXAddVideoICLoRAGuide(io.ComfyNode):guide_mask = dilated["noise_mask"]guide_latent = dilated["samples"]+ # Pre-filter token count = product of (potentially dilated) spatial dims+ iclora_tokens_added = (+ guide_latent.shape[2] * guide_latent.shape[3] * guide_latent.shape[4]+ )+frame_idx, latent_idx = nodes_lt.LTXVAddGuide.get_latent_index(positive, latent_length, len(image), frame_idx, scale_factors)@@ -212,8 +235,229 @@ class LTXAddVideoICLoRAGuide(io.ComfyNode):scale_factors,guide_mask=guide_mask,latent_downscale_factor=latent_downscale_factor,+ causal_fix=causal_fix,))++ # Track this guide in guide_attention_entries for per-reference attention control.+ from .iclora_attention import append_guide_attention_entry++ positive = append_guide_attention_entry(+ positive, iclora_tokens_added, guide_orig_shape+ )+ negative = append_guide_attention_entry(+ negative, iclora_tokens_added, guide_orig_shape+ )++ return io.NodeOutput(+ positive, negative, {"samples": latent_image, "noise_mask": noise_mask}+ )+++@comfy_node(name="LTXAddVideoICLoRAGuideAdvanced")+class LTXAddVideoICLoRAGuideAdvanced(LTXAddVideoICLoRAGuide):+ """Extended IC-LoRA guide node with per-guide attention strength control.++ Same as LTXAddVideoICLoRAGuide, but adds attention_strength and+ attention_mask inputs to control how strongly this guide's conditioning+ influences generation via self-attention.+ """++ @classmethod+ def define_schema(cls):+ return io.Schema(+ node_id="LTXAddVideoICLoRAGuideAdvanced",+ display_name=NODES_DISPLAY_NAME_PREFIX+ + " Add Video IC-LoRA Guide Advanced",+ category="Lightricks/IC-LoRA",+ description=(+ "Adds IC-LoRA guide conditioning with per-guide attention strength control. "+ "Same as LTXAddVideoICLoRAGuide, but allows controlling how strongly this "+ "guide influences generation via self-attention, optionally with a spatial mask."+ ),+ inputs=[+ io.Conditioning.Input("positive"),+ io.Conditioning.Input("negative"),+ io.Vae.Input("vae"),+ io.Latent.Input(+ "latent",+ tooltip="Video-only latent to condition. Must be a 5D video latent.",+ ),+ io.Image.Input("image"),+ io.Int.Input(+ "frame_idx",+ default=0,+ min=-9999,+ max=9999,+ tooltip=(+ "Frame index to start the conditioning at. The value is rounded to the "+ "nearest frame and wrapped modulo the number of video frames. Negative "+ "values are counted from the end of the video before wrapping."+ ),+ ),+ io.Float.Input("strength", default=1.0, min=0.0, max=1.0, step=0.01),+ io.Float.Input(+ "latent_downscale_factor",+ default=1.0,+ min=1.0,+ max=10.0,+ step=1.0,+ tooltip="For IC-LoRA on small grid. 1 = original size, 2 = half, etc.",+ ),+ io.Combo.Input(+ "crop",+ options=["disabled", "center"],+ default="disabled",+ ),+ io.Boolean.Input("use_tiled_encode", default=False),+ io.Int.Input("tile_size", default=256, min=64, max=512, step=32),+ io.Int.Input("tile_overlap", default=64, min=16, max=256, step=16),+ io.Float.Input(+ "attention_strength",+ default=1.0,+ min=0.0,+ max=1.0,+ step=0.01,+ tooltip=(+ "Controls how strongly this guide influences generation via "+ "self-attention. 1.0 = full conditioning (default), 0.0 = ignore. "+ "When an attention_mask is also provided, this multiplies the mask values."+ ),+ ),+ io.Mask.Input(+ "attention_mask",+ optional=True,+ tooltip=(+ "Optional pixel-space spatial mask. Shape (F, H, W) or (H, W). "+ "Values in [0, 1]. Controls per-region conditioning influence. "+ "Multiplied by attention_strength."+ ),+ ),+ ],+ outputs=[+ io.Conditioning.Output("positive"),+ io.Conditioning.Output("negative"),+ io.Latent.Output("latent"),+ ],+ )++ @classmethod+ def execute(+ cls,+ positive,+ negative,+ vae,+ latent,+ image,+ frame_idx,+ strength,+ latent_downscale_factor,+ crop,+ use_tiled_encode,+ tile_size,+ tile_overlap,+ attention_strength=1.0,+ attention_mask=None,+ ) -> io.NodeOutput:+ from .iclora_attention import normalize_mask+ from .latents import LTXVDilateLatent++ scale_factors = vae.downscale_index_formula+ latent_image = latent["samples"]+ noise_mask = nodes_lt.get_noise_mask(latent)++ _, _, latent_length, latent_height, latent_width = latent_image.shape++ time_scale_factor = scale_factors[0]+ num_frames_to_keep = (+ (image.shape[0] - 1) // time_scale_factor+ ) * time_scale_factor + 1+ causal_fix = frame_idx == 0 or num_frames_to_keep == 1+ if not causal_fix:+ image = torch.cat([image[:1], image], dim=0)++ image, guide_latent = cls.encode(+ vae,+ latent_width,+ latent_height,+ image,+ scale_factors,+ latent_downscale_factor,+ crop,+ use_tiled_encode,+ tile_size,+ tile_overlap,+ )++ if not causal_fix:+ guide_latent = guide_latent[:, :, 1:, :, :]+ image = image[1:]++ guide_orig_shape = list(guide_latent.shape[2:])+ guide_mask = None++ if latent_downscale_factor > 1:+ if (+ latent_width % latent_downscale_factor != 0+ or latent_height % latent_downscale_factor != 0+ ):+ raise ValueError(+ f"Latent spatial size {latent_width}x{latent_height} must be "+ f"divisible by latent_downscale_factor {latent_downscale_factor}"+ )+ dilated = LTXVDilateLatent().dilate_latent(+ {"samples": guide_latent},+ horizontal_scale=int(latent_downscale_factor),+ vertical_scale=int(latent_downscale_factor),+ )[0]+ guide_mask = dilated["noise_mask"]+ guide_latent = dilated["samples"]++ iclora_tokens_added = (+ guide_latent.shape[2] * guide_latent.shape[3] * guide_latent.shape[4]+ )++ frame_idx, latent_idx = nodes_lt.LTXVAddGuide.get_latent_index(+ positive, latent_length, len(image), frame_idx, scale_factors+ )+ assert (+ latent_idx + guide_latent.shape[2] <= latent_length+ ), "Conditioning frames exceed the length of the latent sequence."++ positive, negative, latent_image, noise_mask = (+ nodes_lt.LTXVAddGuide.append_keyframe(+ positive,+ negative,+ frame_idx,+ latent_image,+ noise_mask,+ guide_latent,+ strength,+ scale_factors,+ guide_mask=guide_mask,+ latent_downscale_factor=latent_downscale_factor,+ causal_fix=causal_fix,+ )+ )++ from .iclora_attention import append_guide_attention_entry++ norm_mask = normalize_mask(attention_mask)+ positive = append_guide_attention_entry(+ positive,+ iclora_tokens_added,+ guide_orig_shape,+ attention_strength=attention_strength,+ attention_mask=norm_mask,+ )+ negative = append_guide_attention_entry(+ negative,+ iclora_tokens_added,+ guide_orig_shape,+ attention_strength=attention_strength,+ attention_mask=norm_mask,+ )+return io.NodeOutput(positive, negative, {"samples": latent_image, "noise_mask": noise_mask})diff --git a/iclora_attention.py b/iclora_attention.pynew file mode 100644index 0000000..2a1e218--- /dev/null+++ b/iclora_attention.py@@ -0,0 +1,67 @@+"""Helpers for per-guide attention strength tracking in conditioning metadata."""+++def _get_guide_attention_entries(conditioning):+ """Read the current guide_attention_entries list from conditioning."""+ for t in conditioning:+ entries = t[1].get("guide_attention_entries", None)+ if entries is not None:+ return entries+ return []+++def _set_guide_attention_entries(conditioning, entries):+ """Write guide_attention_entries into conditioning (immutable update)."""+ import node_helpers++ return node_helpers.conditioning_set_values(+ conditioning, {"guide_attention_entries": entries}+ )+++def append_guide_attention_entry(+ conditioning,+ pre_filter_count,+ latent_shape,+ attention_strength=1.0,+ attention_mask=None,+):+ """Append a new guide attention entry to conditioning metadata.++ Called by guide-adding nodes after appending tokens.++ Args:+ conditioning: ComfyUI conditioning list.+ pre_filter_count: Token count for this guide (before grid_mask filtering).+ latent_shape: [F, H, W] of the pre-dilation guide latent.+ attention_strength: Scalar in [0, 1]. 1.0 = full attention (default).+ attention_mask: Optional pixel-space mask tensor, shape (1, 1, F, H, W).++ Returns:+ Updated conditioning.+ """+ existing_entries = _get_guide_attention_entries(conditioning)+ entries = [*existing_entries]+ entries.append(+ {+ "pre_filter_count": pre_filter_count,+ "strength": attention_strength,+ "pixel_mask": attention_mask,+ "latent_shape": latent_shape,+ }+ )+ return _set_guide_attention_entries(conditioning, entries)+++def normalize_mask(mask):+ """Normalize a ComfyUI MASK to (1, 1, F, H, W) for downstream processing.++ ComfyUI MASK type is typically (B, H, W) or (H, W).+ """+ if mask is None:+ return None+ if mask.dim() == 2: # (H, W) → single frame+ return mask.unsqueeze(0).unsqueeze(0).unsqueeze(0)+ elif mask.dim() == 3: # (F, H, W) → video mask+ return mask.unsqueeze(0).unsqueeze(0)+ return maskdiff --git a/latents.py b/latents.pyindex 1280182..84cdfd2 100644--- a/latents.py+++ b/latents.py@@ -438,6 +438,9 @@ class LTXVAddLatentGuide:latent = latent["samples"]guide = guiding_latent["samples"]+ # Record original (pre-dilation) guide latent shape for spatial mask downsampling+ guide_orig_shape = list(guide.shape[2:]) # [F, H_small, W_small]+assert (latent.shape[4] % guide.shape[4] == 0and latent.shape[3] % guide.shape[3] == 0@@ -452,6 +455,10 @@ class LTXVAddLatentGuide:guide = guiding_latent["samples"]guide_mask = guiding_latent.get("noise_mask", None)+ # Pre-filter token count = product of dilated spatial dims+ # (before grid_mask filtering removes padding positions)+ iclora_tokens_added = guide.shape[2] * guide.shape[3] * guide.shape[4]+scale_factors = vae.downscale_index_formulaif latent_idx <= 0:@@ -471,6 +478,16 @@ class LTXVAddLatentGuide:guide_mask=guide_mask,)+ # Track this guide in guide_attention_entries for per-reference attention control.+ from .iclora_attention import append_guide_attention_entry++ positive = append_guide_attention_entry(+ positive, iclora_tokens_added, guide_orig_shape+ )+ negative = append_guide_attention_entry(+ negative, iclora_tokens_added, guide_orig_shape+ )+return (positive,negative,diff --git a/q8_nodes.py b/q8_nodes.pyindex 69af031..d392bb2 100644--- a/q8_nodes.py+++ b/q8_nodes.py@@ -1,3 +1,6 @@+import importlib.metadata+import logging+import comfyimport comfy.model_detectionimport comfy.model_management@@ -9,6 +12,7 @@ import torchtry:from q8_kernels.functional.ops import hadamard_transformfrom q8_kernels.integration.patch_transformer import (+ patch_comfyui_native_avtransformer,patch_comfyui_native_transformer,)@@ -31,6 +35,13 @@ def check_q8_available():)+def check_deprecated():+ q8_version = tuple(+ int(x) for x in importlib.metadata.version("q8_kernels").split(".")[:3]+ )+ return q8_version >= (0, 1, 5)++@comfy_node(name="LTXQ8Patch")class LTXVQ8Patch:@classmethod@@ -84,30 +95,46 @@ class LTXVQ8Patch:m = model.clone()transformer_key = "diffusion_model"transformer = m.get_model_object(transformer_key)- quantize_self_attn, quantize_cross_attn, quantize_ffn = LTXVQ8Patch.PRESETS.get(- quantization_preset, (quantize_self_attn, quantize_cross_attn, quantize_ffn)- )- if getattr(transformer, "quantization_config", None) is not None:- if (quantize_self_attn, quantize_cross_attn, quantize_ffn) != getattr(- transformer, "quantization_config"- ):- quantize_self_attn, quantize_cross_attn, quantize_ffn = getattr(- transformer, "quantization_config"++ is_av = transformer.__class__.__name__ == "LTXAVModel"+ if is_av:+ patcher = patch_comfyui_native_avtransformer+ else:+ patcher = patch_comfyui_native_transformer++ if check_deprecated():+ logging.info("This node is deprecated soon. Use new one.")+ quant_audio_path = False+ quant_type = "blockwise-fp8"+ patcher(transformer, use_fp8_attention, True, quant_type, quant_audio_path)+ else:+ quantize_self_attn, quantize_cross_attn, quantize_ffn = (+ LTXVQ8Patch.PRESETS.get(+ quantization_preset,+ (quantize_self_attn, quantize_cross_attn, quantize_ffn),)- patch_comfyui_native_transformer(- transformer,- use_fp8_attention,- True,- quantize_self_attn,- quantize_cross_attn,- quantize_ffn,- )+ )+ if getattr(transformer, "quantization_config", None) is not None:+ if (quantize_self_attn, quantize_cross_attn, quantize_ffn) != getattr(+ transformer, "quantization_config"+ ):+ quantize_self_attn, quantize_cross_attn, quantize_ffn = getattr(+ transformer, "quantization_config"+ )+ patcher(+ transformer,+ use_fp8_attention,+ True,+ quantize_self_attn,+ quantize_cross_attn,+ quantize_ffn,+ )+ setattr(+ transformer,+ "quantization_config",+ (quantize_self_attn, quantize_cross_attn, quantize_ffn),+ )setattr(transformer, "is_q8_patched", True)- setattr(- transformer,- "quantization_config",- (quantize_self_attn, quantize_cross_attn, quantize_ffn),- )setattr(transformer, "use_fp8_attention", use_fp8_attention)return (m,)diff --git a/sparse_tracks.py b/sparse_tracks.pynew file mode 100644index 0000000..9988ed3--- /dev/null+++ b/sparse_tracks.py@@ -0,0 +1,381 @@+import base64+import json+from io import BytesIO++import numpy as np+import torch+from comfy_api.latest import io+from PIL import Image++from .nodes_registry import comfy_node+++def _catmull_rom(p0: dict, p1: dict, p2: dict, p3: dict, t: float) -> dict[str, float]:+ t2 = t * t+ t3 = t2 * t+ return {+ "x": 0.5+ * (+ 2 * p1["x"]+ + (-p0["x"] + p2["x"]) * t+ + (2 * p0["x"] - 5 * p1["x"] + 4 * p2["x"] - p3["x"]) * t2+ + (-p0["x"] + 3 * p1["x"] - 3 * p2["x"] + p3["x"]) * t3+ ),+ "y": 0.5+ * (+ 2 * p1["y"]+ + (-p0["y"] + p2["y"]) * t+ + (2 * p0["y"] - 5 * p1["y"] + 4 * p2["y"] - p3["y"]) * t2+ + (-p0["y"] + 3 * p1["y"] - 3 * p2["y"] + p3["y"]) * t3+ ),+ }+++def _interpolate_spline(+ control_points: list[dict], num_samples: int+) -> list[dict[str, int]]:+ """Catmull-Rom spline interpolation matching the JS frontend logic."""+ if len(control_points) == 0:+ return []+ if len(control_points) == 1:+ p = control_points[0]+ return [{"x": round(p["x"]), "y": round(p["y"])} for _ in range(num_samples)]+ if len(control_points) == 2:+ a, b = control_points+ return [+ {+ "x": round(a["x"] + (b["x"] - a["x"]) * i / (num_samples - 1)),+ "y": round(a["y"] + (b["y"] - a["y"]) * i / (num_samples - 1)),+ }+ for i in range(num_samples)+ ]+ pts = [control_points[0], *control_points, control_points[-1]]+ n_seg = len(pts) - 3+ result = []+ for i in range(num_samples):+ g_t = (i / (num_samples - 1)) * n_seg+ seg = min(int(g_t), n_seg - 1)+ l_t = g_t - seg+ p = _catmull_rom(pts[seg], pts[seg + 1], pts[seg + 2], pts[seg + 3], l_t)+ result.append({"x": round(p["x"]), "y": round(p["y"])})+ return result+++@comfy_node(name="LTXVSparseTrackEditor", description="LTX Sparse Track Editor")+class LTXVSparseTrackEditor(io.ComfyNode):+ """Interactive spline editor for drawing sparse motion tracks.++ Provides a canvas widget where users can draw and edit spline control+ points on top of a reference image. Outputs interpolated track+ coordinates compatible with LTXVDrawTracks.+ """++ @classmethod+ def define_schema(cls):+ return io.Schema(+ node_id="LTXVSparseTrackEditor",+ category="Lightricks/motion_tracking",+ description=(+ "Interactive spline editor for drawing sparse motion tracks "+ "on a reference image."+ ),+ inputs=[+ io.Image.Input(+ "image",+ tooltip="Reference image displayed as the editor canvas background.",+ ),+ io.String.Input(+ "points_store",+ default="[]",+ tooltip="JSON array of spline control points managed by the editor widget.",+ ),+ io.String.Input(+ "coordinates",+ default="[]",+ tooltip="JSON array of interpolated track coordinates produced by the editor.",+ ),+ io.Int.Input(+ "points_to_sample",+ default=121,+ min=2,+ max=10000,+ tooltip="Number of points sampled along each spline curve.",+ ),+ ],+ outputs=[+ io.String.Output("tracks"),+ ],+ is_output_node=True,+ )++ @classmethod+ def execute(+ cls,+ image,+ points_store: str,+ coordinates: str,+ points_to_sample: int,+ ) -> io.NodeOutput:+ # Re-interpolate from control points so that changes to+ # points_to_sample are always respected, regardless of JS sync.+ try:+ splines = json.loads(points_store) if points_store else []+ except (json.JSONDecodeError, TypeError):+ splines = []++ if splines and isinstance(splines, list) and isinstance(splines[0], list):+ interpolated = [_interpolate_spline(sp, points_to_sample) for sp in splines]+ tracks = json.dumps(interpolated)+ elif coordinates and coordinates != "[]":+ tracks = coordinates+ else:+ tracks = "[]"++ img_array = (image[0].cpu().numpy() * 255).astype(np.uint8)+ img = Image.fromarray(img_array)+ buf = BytesIO()+ img.save(buf, format="JPEG", quality=75)+ img_b64 = base64.b64encode(buf.getvalue()).decode("utf-8")+ return io.NodeOutput(tracks, ui={"bg_image": [img_b64]})+++def _parse_tracks(raw: str) -> list[list[dict]]:+ """Parse tracks from a JSON string, handling nested/wrapped formats."""+ parsed = json.loads(raw) if isinstance(raw, str) else raw++ if isinstance(parsed, list):+ unwrapped = []+ for item in parsed:+ unwrapped.append(json.loads(item) if isinstance(item, str) else item)+ parsed = unwrapped++ tracks: list[list[dict]] = []+ stack = [parsed]+ while stack:+ obj = stack.pop()+ if isinstance(obj, list) and len(obj) > 0:+ if isinstance(obj[0], dict) and "x" in obj[0] and "y" in obj[0]:+ tracks.append(obj)+ else:+ stack.extend(obj)+ return tracks+++def _age_color_batch(ratios: torch.Tensor, device: torch.device) -> torch.Tensor:+ """Vectorised age-ratio -> RGB [0..1] mapping on GPU.++ Gradient: blue -> green -> yellow -> red.+ """+ colors = torch.zeros(ratios.shape[0], 3, device=device)++ m1 = ratios <= 1 / 3+ tr1 = ratios[m1] * 3+ colors[m1, 1] = tr1+ colors[m1, 2] = 1 - tr1++ m2 = (ratios > 1 / 3) & (ratios <= 2 / 3)+ tr2 = (ratios[m2] - 1 / 3) * 3+ colors[m2, 0] = tr2+ colors[m2, 1] = 1++ m3 = ratios > 2 / 3+ tr3 = (ratios[m3] - 2 / 3) * 3+ colors[m3, 0] = 1+ colors[m3, 1] = 1 - tr3++ return colors+++def _render_resolution(width: int, height: int, reference_short_side: int):+ """Compute the higher render resolution that preserves aspect ratio."""+ if height <= width:+ rw = int(width * reference_short_side / height)+ rh = reference_short_side+ else:+ rw = reference_short_side+ rh = int(height * reference_short_side / width)+ scale_x = rw / width+ scale_y = rh / height+ return rw, rh, scale_x, scale_y+++_MIN_RADIUS = 2+_MAX_RADIUS = 8+_MAX_TRAIL = 50+_REF_SHORT_SIDE = 1080+++@comfy_node(name="LTXVDrawTracks", description="LTX Draw Sparse Tracks")+class LTXVDrawTracks(io.ComfyNode):+ """GPU-accelerated sparse track renderer.++ Renders circles at a high reference resolution and downscales with+ bilinear interpolation so circle sizes match the CPU version.+ All work — rasterisation, compositing and resize — stays on GPU.+ """++ @classmethod+ def define_schema(cls):+ return io.Schema(+ node_id="LTXVDrawTracks",+ category="Lightricks/motion_tracking",+ description=(+ "GPU-accelerated sparse track renderer. Rasterises circles at "+ "high resolution and downscales with bilinear interpolation."+ ),+ inputs=[+ io.String.Input(+ "tracks",+ multiline=True,+ tooltip="JSON string of track coordinates (list of point lists with x/y keys).",+ ),+ io.Int.Input(+ "width",+ default=512,+ min=8,+ max=8192,+ step=8,+ tooltip="Output image width in pixels.",+ ),+ io.Int.Input(+ "height",+ default=512,+ min=8,+ max=8192,+ step=8,+ tooltip="Output image height in pixels.",+ ),+ ],+ outputs=[+ io.Image.Output(),+ ],+ )++ @classmethod+ def execute(cls, tracks: str, width: int, height: int) -> io.NodeOutput:+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")+ parsed = _parse_tracks(tracks)+ if not parsed:+ blank = torch.zeros(1, height, width, 3, device=device, dtype=torch.half)+ return io.NodeOutput(blank)+ num_tracks = len(parsed)+ num_frames = max(len(t) for t in parsed)+ rw, rh, sx, sy = _render_resolution(width, height, _REF_SHORT_SIDE)++ point_xy = torch.zeros(num_tracks, num_frames, 2, device=device)+ vis = torch.zeros(num_tracks, num_frames, dtype=torch.bool, device=device)+ for i, trk in enumerate(parsed):+ coords = torch.tensor(+ [[p["x"] * sx, p["y"] * sy] for p in trk],+ dtype=torch.float32,+ device=device,+ )+ point_xy[i, : len(trk)] = coords+ vis[i, : len(trk)] = True++ max_d = 2 * _MAX_RADIUS + 3+ half_d = max_d // 2+ offsets = torch.arange(max_d, device=device) - half_d+ oy, ox = torch.meshgrid(offsets, offsets, indexing="ij")+ template_dist_sq = oy.float().square() + ox.float().square()++ render_frames = torch.zeros(num_frames, rh, rw, 3, device=device)++ for t in range(num_frames):+ tau_min = max(0, t - _MAX_TRAIL)+ window = t - tau_min + 1++ active_xy = point_xy[:, tau_min : t + 1]+ active_vis = vis[:, tau_min : t + 1]++ ages = torch.arange(window - 1, -1, -1, device=device, dtype=torch.float32)+ ratios = 1.0 - ages / _MAX_TRAIL+ radii = _MIN_RADIUS + (_MAX_RADIUS - _MIN_RADIUS) * ratios+ colors = _age_color_batch(ratios, device)++ flat_xy = active_xy.reshape(-1, 2)+ flat_vis = active_vis.reshape(-1)+ flat_radii = radii.unsqueeze(0).expand(num_tracks, -1).reshape(-1)+ flat_colors = colors.unsqueeze(0).expand(num_tracks, -1, -1).reshape(-1, 3)++ idx = flat_vis.nonzero(as_tuple=True)[0]+ if idx.shape[0] == 0:+ continue++ pts = flat_xy[idx]+ r = flat_radii[idx]+ c = flat_colors[idx]++ flat_ages = ages.unsqueeze(0).expand(num_tracks, -1).reshape(-1)+ sort_order = flat_ages[idx].argsort(descending=True)+ pts = pts[sort_order]+ r = r[sort_order]+ c = c[sort_order]++ _rasterise_circles(+ render_frames[t], pts, r, c, template_dist_sq, half_d, max_d, rh, rw+ )++ out = torch.nn.functional.interpolate(+ render_frames.permute(0, 3, 1, 2),+ size=(height, width),+ mode="bilinear",+ align_corners=False,+ ).permute(0, 2, 3, 1)++ out = out[..., [2, 1, 0]] # RGB -> BGR to match IC-LoRA training data format+ return io.NodeOutput(out.half())+++def _rasterise_circles(+ frame: torch.Tensor,+ pts: torch.Tensor,+ radii: torch.Tensor,+ colors: torch.Tensor,+ template_dist_sq: torch.Tensor,+ half_d: int,+ max_d: int,+ H: int,+ W: int,+) -> None:+ """Stamp filled circles onto *frame* fully on-device.++ Uses ``scatter_reduce_`` with ``'amax'`` to resolve overlaps in+ painter's order (circles are expected oldest-first so the highest+ index = newest wins).+ """+ M = pts.shape[0]+ if M == 0:+ return+ device = pts.device++ # per-circle masks [M, D, D]+ radii_sq = (radii * radii).view(M, 1, 1)+ circle_masks = template_dist_sq.unsqueeze(0) <= radii_sq++ # frame-space indices [M, D, D]+ cx = pts[:, 0].round().long().view(M, 1, 1)+ cy = pts[:, 1].round().long().view(M, 1, 1)+ offsets_y = torch.arange(max_d, device=device).sub(half_d).view(1, max_d, 1)+ offsets_x = torch.arange(max_d, device=device).sub(half_d).view(1, 1, max_d)+ fy = (cy + offsets_y).expand(M, max_d, max_d) # [M, D, D]+ fx = (cx + offsets_x).expand(M, max_d, max_d) # [M, D, D]++ valid = circle_masks & (fy >= 0) & (fy < H) & (fx >= 0) & (fx < W)++ flat_fy = fy[valid]+ flat_fx = fx[valid]+ flat_lin = (flat_fy * W + flat_fx).long()++ # circle index per valid pixel (oldest=0 … newest=M-1)+ j_map = torch.arange(M, device=device, dtype=torch.float32).view(M, 1, 1)+ j_map = j_map.expand_as(valid)+ flat_j = j_map[valid]++ # priority map — highest index (newest) wins via 'amax' reduce+ priority = torch.full((H * W,), -1.0, device=device)+ priority.scatter_reduce_(0, flat_lin, flat_j, reduce="amax", include_self=False)+ priority = priority.view(H, W).long()++ has_circle = priority >= 0+ frame[has_circle] = colors[priority[has_circle]]diff --git a/text_embeddings_connectors.py b/text_embeddings_connectors.pynew file mode 100644index 0000000..a5a7688--- /dev/null+++ b/text_embeddings_connectors.py@@ -0,0 +1,376 @@+"""Text Embeddings Pipeline: Feature Extractors + Embeddings Processors.++Provides the 3-block Gemma text encoder pipeline:+ 1. Gemma Model (external) -- runs the LLM, gets hidden states+ 2. Feature Extractor (V1/V2) -- normalization + projection+ 3. Embeddings Processor (Video / AV) -- wraps Embeddings1DConnector(s)+"""++import json+import math+from pathlib import Path++import torch+from comfy.utils import load_torch_file+from einops import rearrange+from torch import nn++from .embeddings_connector import (+ Embeddings1DConnector,+ load_audio_embeddings_connector,+ load_video_embeddings_connector,+)++_PREFIX_BASE = "model.diffusion_model."+_PREFIX_TEXT_PROJ = "text_embedding_projection."+++# ---------------------------------------------------------------------------+# Helpers+# ---------------------------------------------------------------------------+++def _to_binary_mask(encoded, encoded_mask):+ """Convert additive mask to binary [B, seq, 1] and zero out padding."""+ binary_mask = (encoded_mask < 0.000001).to(torch.int64)+ binary_mask = binary_mask.reshape(encoded.shape[0], encoded.shape[1], 1)+ return encoded * binary_mask, binary_mask+++def _rescale_norm(x: torch.Tensor, target_dim: int, source_dim: int) -> torch.Tensor:+ """Rescale normalization: x * sqrt(target_dim / source_dim)."""+ return x * math.sqrt(target_dim / source_dim)+++def _filter_sd(sd: dict, prefix: str) -> dict:+ """Extract keys with *prefix* and strip the prefix."""+ return {k[len(prefix) :]: v for k, v in sd.items() if k.startswith(prefix)}+++def _load_aggregate_embed(sd: dict, modality: str, dtype) -> nn.Linear:+ """Load an aggregate_embed Linear from the state dict.++ Args:+ sd: Full checkpoint state dict.+ modality: ``"video"`` or ``"audio"``.+ dtype: Target dtype.++ Returns ``linear`` module.+ """+ name = f"{modality}_aggregate_embed"+ weight_key = f"{_PREFIX_TEXT_PROJ}{name}.weight"+ bias_key = f"{_PREFIX_TEXT_PROJ}{name}.bias"+ weight = sd[weight_key]+ out_features, embedding_dim = weight.shape+ linear = nn.Linear(embedding_dim, out_features, bias=bias_key in sd)+ linear.load_state_dict(_filter_sd(sd, f"{_PREFIX_TEXT_PROJ}{name}."))+ return linear.to(dtype=dtype)+++# ---------------------------------------------------------------------------+# Normalization functions (moved from gemma_encoder.py)+# ---------------------------------------------------------------------------+++def norm_and_concat_padded_batch(+ encoded_text: torch.Tensor,+ sequence_lengths: torch.Tensor,+ padding_side: str = "right",+) -> torch.Tensor:+ """+ Normalize a 4D tensor [B, T, D, L] per sample and per layer, using sequence_lengths to mask.+ Returns [B, T, D * L] tensor with original padding preserved.++ Args:+ encoded_text: 4D tensor [B, T, D, L]+ sequence_lengths: 1D tensor [B] with actual sequence lengths+ padding_side: "left" or "right" to indicate which side has padding+ """+ B, T, D, L = encoded_text.shape+ device = encoded_text.device++ # Build mask: [B, T, 1, 1]+ token_indices = torch.arange(T, device=device)[None, :] # [1, T]++ if padding_side == "right":+ # For right padding, valid tokens are from 0 to sequence_length-1+ mask = token_indices < sequence_lengths[:, None] # [B, T]+ elif padding_side == "left":+ # For left padding, valid tokens are from (T - sequence_length) to T-1+ start_indices = T - sequence_lengths[:, None] # [B, 1]+ mask = token_indices >= start_indices # [B, T]+ else:+ raise ValueError(f"padding_side must be 'left' or 'right', got {padding_side}")++ mask = rearrange(mask, "b t -> b t 1 1")++ # Compute masked mean: [B, 1, 1, L]+ masked = encoded_text.masked_fill(~mask, 0.0)+ # denom = mask.sum(dim=(1, 2), keepdim=True) # [B, 1, 1, 1]+ denom = (sequence_lengths * D).view(B, 1, 1, 1)+ mean = masked.sum(dim=(1, 2), keepdim=True) / (denom + 1e-6)++ # Compute masked min/max: [B, 1, 1, L]+ x_min = encoded_text.masked_fill(~mask, float("inf")).amin(dim=(1, 2), keepdim=True)+ x_max = encoded_text.masked_fill(~mask, float("-inf")).amax(+ dim=(1, 2), keepdim=True+ )+ range_ = x_max - x_min++ # Normalize only the valid tokens+ normed = 8 * (encoded_text - mean) / (range_ + 1e-6)++ # concat to be [Batch, T, D * L] - this preserves the original structure+ normed = normed.reshape(B, T, -1) # [B, T, D * L]++ # Apply mask to preserve original padding (set padded positions to 0)+ mask_flattened = rearrange(mask, "b t 1 1 -> b t 1").expand(-1, -1, D * L)+ normed = normed.masked_fill(~mask_flattened, 0.0)++ return normed+++def norm_and_concat_per_token_rms(+ encoded_text: torch.Tensor,+ attention_mask: torch.Tensor,+) -> torch.Tensor:+ """Per-token RMSNorm normalization.++ Each token is normalized independently using RMSNorm over its D+ dimension. This is naturally causal and supports packing since each+ token's normalization is self-contained.++ Args:+ encoded_text: 4D tensor [B, T, D, L]+ attention_mask: [B, T] binary mask (1=real, 0=pad)++ Returns:+ [B, T, D*L] normalized and flattened tensor with padding zeroed out.+ """+ B, T, D, L = encoded_text.shape+ variance = torch.mean(encoded_text**2, dim=2, keepdim=True) # [B,T,1,L]+ normed = encoded_text * torch.rsqrt(variance + 1e-6) # [B,T,D,L]+ normed = normed.reshape(B, T, D * L)+ # Zero out padding+ mask_3d = attention_mask.bool().unsqueeze(-1) # [B, T, 1]+ normed = torch.where(mask_3d, normed, torch.zeros_like(normed))+ return normed+++# ---------------------------------------------------------------------------+# Feature Extractors (Block 2)+# ---------------------------------------------------------------------------+++class FeatureExtractorV1(nn.Module):+ """19B: per-segment norm -> aggregate_embed -> 3840"""++ def __init__(self, aggregate_embed: nn.Module, is_av: bool = False):+ super().__init__()+ self.aggregate_embed = aggregate_embed+ self.is_av = is_av++ def forward(self, all_layer_hiddens, attention_mask, padding_side="left"):+ sequence_lengths = attention_mask.sum(dim=-1)+ normed = norm_and_concat_padded_batch(+ all_layer_hiddens, sequence_lengths, padding_side+ )+ normed = normed.to(all_layer_hiddens.dtype)+ features = self.aggregate_embed(normed)+ if self.is_av:+ return {"video": features, "audio": features}+ return {"video": features}+++class FeatureExtractorV2(nn.Module):+ """22B: per-token RMS norm -> rescale -> aggregate_embed(s)"""++ def __init__(+ self,+ video_aggregate_embed: nn.Linear,+ embedding_dim: int,+ audio_aggregate_embed: nn.Linear | None = None,+ ):+ super().__init__()+ self.video_aggregate_embed = video_aggregate_embed+ self.audio_aggregate_embed = audio_aggregate_embed+ self.embedding_dim = embedding_dim++ def forward(self, all_layer_hiddens, attention_mask, padding_side="left"):+ normed = norm_and_concat_per_token_rms(all_layer_hiddens, attention_mask)+ normed = normed.to(all_layer_hiddens.dtype)+ v_dim = self.video_aggregate_embed.out_features+ result = {+ "video": self.video_aggregate_embed(+ _rescale_norm(normed, v_dim, self.embedding_dim)+ )+ }+ if self.audio_aggregate_embed is not None:+ a_dim = self.audio_aggregate_embed.out_features+ result["audio"] = self.audio_aggregate_embed(+ _rescale_norm(normed, a_dim, self.embedding_dim)+ )+ return result+++# ---------------------------------------------------------------------------+# Embeddings Processors (Block 3)+# ---------------------------------------------------------------------------+++class VideoEmbeddingsProcessor(nn.Module):+ """Video-only embeddings processor: single connector."""++ def __init__(self, video_connector: Embeddings1DConnector):+ super().__init__()+ self.video_connector = video_connector++ def create_embeddings(self, features, attention_mask):+ encoded, mask = self.video_connector(features["video"], attention_mask)+ encoded, binary_mask = _to_binary_mask(encoded, mask)+ return encoded, binary_mask.squeeze(-1)+++class AVEmbeddingsProcessor(nn.Module):+ """Audio-video embeddings processor: dual connectors + concat."""++ def __init__(+ self,+ video_connector: Embeddings1DConnector,+ audio_connector: Embeddings1DConnector,+ ):+ super().__init__()+ self.video_connector = video_connector+ self.audio_connector = audio_connector++ def create_embeddings(self, features, attention_mask):+ encoded, mask = self.video_connector(features["video"], attention_mask)+ encoded, binary_mask = _to_binary_mask(encoded, mask)+ audio_encoded, _ = self.audio_connector(features["audio"], attention_mask)+ encoded = torch.cat([encoded, audio_encoded], dim=-1)+ return encoded, binary_mask.squeeze(-1)+++# ---------------------------------------------------------------------------+# Loading helpers+# ---------------------------------------------------------------------------+++def _load_single_aggregate_embed(sd, dtype):+ """Load the single aggregate_embed (V1 models).++ Returns:+ nn.Linear or None if key not found.+ """+ key = f"{_PREFIX_TEXT_PROJ}aggregate_embed.weight"+ if key not in sd:+ return None+ weight = sd[key]+ in_features, out_features = weight.shape[1], weight.shape[0]+ # Check for bias+ bias_key = f"{_PREFIX_TEXT_PROJ}aggregate_embed.bias"+ has_bias = bias_key in sd+ linear = nn.Linear(in_features, out_features, bias=has_bias)+ linear.load_state_dict(_filter_sd(sd, f"{_PREFIX_TEXT_PROJ}aggregate_embed."))+ return linear.to(dtype=dtype)+++def _load_single_aggregate_embed_from_file(path, dtype):+ """Load aggregate_embed from a standalone checkpoint file (legacy fallback).++ Args:+ path: Path to safetensors file containing aggregate_embed weights.+ dtype: Target dtype.++ Returns:+ nn.Linear or None if file does not exist.+ """+ path = Path(path)+ if not path.exists():+ return None+ loaded_sd = load_torch_file(str(path), return_metadata=False)+ if "aggregate_embed.weight" not in loaded_sd:+ raise ValueError(+ f"Checkpoint {path} does not contain 'aggregate_embed.weight'."+ )+ weight = loaded_sd["aggregate_embed.weight"]+ in_features, out_features = weight.shape[1], weight.shape[0]+ bias_key = "aggregate_embed.bias"+ has_bias = bias_key in loaded_sd+ linear = nn.Linear(in_features, out_features, bias=has_bias)+ linear.load_state_dict(+ {+ k.removeprefix("aggregate_embed."): v+ for k, v in loaded_sd.items()+ if k.startswith("aggregate_embed.")+ }+ )+ return linear.to(dtype=dtype)+++# ---------------------------------------------------------------------------+# Pipeline loader+# ---------------------------------------------------------------------------+++def load_text_embeddings_pipeline(+ ltxv_path, dtype=torch.bfloat16, fallback_proj_path=None+):+ """Load feature extractor + embeddings processor from LTX-V checkpoint.++ Auto-detects model variant (19B/22B, video-only/AV).++ Args:+ ltxv_path: Path to the LTX-V checkpoint.+ dtype: Target dtype for loaded modules.+ fallback_proj_path: Optional path to a standalone ``proj_linear.safetensors``+ file. Used as a legacy fallback when the aggregate_embed is not+ stored inside the LTX-V checkpoint (V1 models).++ Returns:+ (feature_extractor, embeddings_processor)+ """+ sd, metadata = load_torch_file(str(ltxv_path), return_metadata=True)+ config = json.loads(metadata.get("config", "{}"))+ transformer_config = config.get("transformer", {})++ is_av = f"{_PREFIX_BASE}audio_adaln_single.linear.weight" in sd+ has_dual_aggregate = f"{_PREFIX_TEXT_PROJ}video_aggregate_embed.weight" in sd++ # Load connectors (always needed)+ video_connector = load_video_embeddings_connector(sd, transformer_config, dtype)++ # Build embeddings processor (Block 3)+ if is_av:+ audio_connector = load_audio_embeddings_connector(sd, transformer_config, dtype)+ processor = AVEmbeddingsProcessor(video_connector, audio_connector)+ else:+ processor = VideoEmbeddingsProcessor(video_connector)++ # Build feature extractor (Block 2)+ if has_dual_aggregate:+ # V2 (22B): validate config matches expected settings+ _expected = {+ "caption_projection_first_linear": False,+ "caption_proj_input_norm": False,+ "caption_projection_second_linear": False,+ "caption_proj_before_connector": True,+ "text_encoder_norm_type": "per_token_rms",+ }+ for key, expected_val in _expected.items():+ actual = transformer_config.get(key)+ assert actual == expected_val, (+ f"Unexpected config for dual-aggregate model: "+ f"{key}={actual!r}, expected {expected_val!r}"+ )+ video_agg = _load_aggregate_embed(sd, "video", dtype)+ audio_agg = _load_aggregate_embed(sd, "audio", dtype) if is_av else None+ embedding_dim = transformer_config.get("prompt_embedding_dim", 3840)+ return (FeatureExtractorV2(video_agg, embedding_dim, audio_agg), processor)+ # V1 (19B)+ aggregate_embed = _load_single_aggregate_embed(sd, dtype)+ if aggregate_embed is None and fallback_proj_path is not None:+ aggregate_embed = _load_single_aggregate_embed_from_file(+ fallback_proj_path, dtype+ )+ return (FeatureExtractorV1(aggregate_embed, is_av=is_av), processor)diff --git a/vanish_nodes.py b/vanish_nodes.pynew file mode 100644index 0000000..6e2d2a7--- /dev/null+++ b/vanish_nodes.py@@ -0,0 +1,146 @@+import torch+import torch.nn.functional as F+from comfy_api.latest import io++from .nodes_registry import comfy_node+++@comfy_node(name="LTXVDilateVideoMask")+class LTXVDilateVideoMask(io.ComfyNode):+ """Dilates a video mask spatially and/or temporally using max-pooling and thresholds the result."""++ @classmethod+ def define_schema(cls):+ return io.Schema(+ node_id="LTXVDilateVideoMask",+ category="Lightricks/mask_operations",+ description=(+ "Dilates a video mask spatially and/or temporally using "+ "separable max-pooling and thresholds the result."+ ),+ inputs=[+ io.Int.Input(+ "spatial_radius",+ default=1,+ min=0,+ max=30,+ tooltip="Half-size of the spatial dilation kernel. Kernel = 2*radius+1.",+ ),+ io.Int.Input(+ "temporal_radius",+ default=0,+ min=0,+ max=10,+ tooltip="Half-size of the temporal dilation kernel. Kernel = 2*radius+1.",+ ),+ io.Mask.Input(+ "mask",+ optional=True,+ tooltip="Video mask to dilate. Either this or image_as_mask must be provided.",+ ),+ io.Image.Input(+ "image_as_mask",+ optional=True,+ tooltip="Image to use as mask (channel-averaged). Either this or mask must be provided.",+ ),+ ],+ outputs=[+ io.Mask.Output("mask"),+ ],+ )++ @classmethod+ def execute(+ cls,+ spatial_radius: int,+ temporal_radius: int,+ mask: torch.Tensor | None = None,+ image_as_mask: torch.Tensor | None = None,+ ) -> io.NodeOutput:+ if mask is None and image_as_mask is None:+ raise ValueError("Either 'mask' or 'image_as_mask' must be provided.")++ if mask is None:+ mask = image_as_mask.mean(dim=-1)++ if mask.ndim == 4:+ mask = mask[:, :, :, 0]++ s_kernel = spatial_radius * 2 + 1+ t_kernel = temporal_radius * 2 + 1++ # Separable dilation: 2D spatial + 1D temporal (much faster than 3D pooling)+ if s_kernel > 1:+ mask = mask.unsqueeze(1) # (B, 1, H, W)+ mask = F.max_pool2d(+ mask, kernel_size=s_kernel, stride=1, padding=spatial_radius+ )+ mask = mask.squeeze(1)++ if t_kernel > 1:+ B, H, W = mask.shape+ mask = mask.permute(1, 2, 0).reshape(H * W, 1, B)+ mask = F.max_pool1d(+ mask, kernel_size=t_kernel, stride=1, padding=temporal_radius+ )+ mask = mask.reshape(H, W, B).permute(2, 0, 1)++ mask = (mask > 0.5).float()+ return io.NodeOutput(mask)+++_BG_COLOR_RGB = (102, 255, 0)+++@comfy_node(name="LTXVInpaintPreprocess")+class LTXVInpaintPreprocess(io.ComfyNode):+ """Composites images with a green (#66FF00) background where mask is active.++ If the mask has a single frame it is broadcast to match the video length.+ """++ @classmethod+ def define_schema(cls):+ return io.Schema(+ node_id="LTXVInpaintPreprocess",+ category="Lightricks/image_processing",+ description=(+ "Composites images with a green background where mask is "+ "active, for inpainting conditioning."+ ),+ inputs=[+ io.Image.Input(+ "images",+ tooltip="Video frames to composite onto the green background.",+ ),+ io.Mask.Input(+ "mask",+ tooltip="Mask indicating regions to replace with green. Single-frame masks are broadcast.",+ ),+ ],+ outputs=[+ io.Image.Output("image"),+ ],+ )++ @classmethod+ def execute(+ cls,+ images: torch.Tensor,+ mask: torch.Tensor,+ ) -> io.NodeOutput:+ if mask.ndim == 4:+ mask = mask[:, :, :, 0]++ if mask.shape[0] == 1 and images.shape[0] > 1:+ mask = mask.expand(images.shape[0], -1, -1)++ min_frames = min(mask.shape[0], images.shape[0])+ mask = mask[:min_frames]+ images = images[:min_frames]++ mask_4d = mask.unsqueeze(-1) # (B, H, W, 1) for broadcasting+ bg_color = torch.tensor(_BG_COLOR_RGB).float().to(images.device) / 255++ result = images * (1 - mask_4d) + bg_color.view(1, 1, 1, 3) * mask_4d+ return io.NodeOutput(result)diff --git a/web/js/guider_parameters_advanced.js b/web/js/guider_parameters_advanced.jsnew file mode 100644index 0000000..8c999d9--- /dev/null+++ b/web/js/guider_parameters_advanced.js@@ -0,0 +1,346 @@+import { app } from "../../../scripts/app.js";++const PREFIXES = ["video", "audio"];+const STRING_FIELDS = [+ "sigmas", "cfg", "stg", "rescale", "modality_scale",+ "perturb_attn", "skip_step", "cross_attn",+ "cfg_zero_star",+];+const FIELD_LABELS = {+ sigmas: "Sigmas",+ cfg: "CFG",+ stg: "STG",+ rescale: "Rescale",+ modality_scale: "Modality Scale",+ perturb_attn: "Perturb Attn",+ skip_step: "Skip Step",+ cross_attn: "Cross Attn",+ cfg_zero_star: "CFG Zero*",+};++const _origProps = {};++function toggleWidget(node, widget, show) {+ if (!widget) return;+ if (!_origProps[widget.name]) {+ _origProps[widget.name] = {+ origComputeSize: widget.computeSize,+ };+ }+ const origSize = node.size;++ widget.hidden = !show;+ widget.computeSize = show+ ? _origProps[widget.name].origComputeSize+ : () => [0, -3.3];++ widget.linkedWidgets?.forEach((w) => toggleWidget(node, w, show));++ const height = show+ ? Math.max(node.computeSize()[1], origSize[1])+ : node.computeSize()[1];+ node.setSize([node.size[0], height]);++ if (show) delete widget.computedHeight;+ else widget.computedHeight = 0;+}++function toggleModalityWidgets(node, prefix, enabled) {+ for (const w of node.widgets) {+ if (+ w.name.startsWith(prefix + "_") &&+ w.name !== prefix + "_enabled"+ ) {+ toggleWidget(node, w, enabled);+ }+ }+}++function injectMultilineLabels(node) {+ const labelMap = {};+ for (const prefix of PREFIXES) {+ for (const field of STRING_FIELDS) {+ const key = prefix + "_" + field;+ labelMap[key] = prefix.toUpperCase() + " " + FIELD_LABELS[field];+ }+ }++ function applyLabels() {+ let allDone = true;+ for (const w of node.widgets) {+ if (!(w.name in labelMap)) continue;+ // w.element is the <textarea> itself, not the wrapper div+ const textarea = w.element;+ if (!textarea || textarea.tagName !== "TEXTAREA") {+ allDone = false;+ continue;+ }+ const container = textarea.parentElement;+ if (!container) {+ allDone = false;+ continue;+ }+ if (container.querySelector(".guider-param-label")) continue;++ textarea.placeholder = labelMap[w.name];++ const label = document.createElement("div");+ label.className = "guider-param-label";+ label.textContent = labelMap[w.name];+ label.style.cssText =+ "font-size:10px;font-weight:600;color:#bbb;" ++ "padding:0 4px;pointer-events:none;" ++ "position:absolute;top:-14px;left:0;z-index:1;";+ container.style.overflow = "visible";+ container.insertBefore(label, textarea);+ }+ return allDone;+ }++ let retries = 0;+ function tryApply() {+ if (applyLabels() || retries > 30) return;+ retries++;+ requestAnimationFrame(tryApply);+ }+ requestAnimationFrame(tryApply);+}++const MOD_PREFIX_MAP = { VIDEO: "video", AUDIO: "audio" };++function populateWidgets(node, data) {+ for (const [modName, fields] of Object.entries(data)) {+ const prefix = MOD_PREFIX_MAP[modName];+ if (!prefix) continue;+ for (const [field, value] of Object.entries(fields)) {+ const w = node.widgets.find(+ (w) => w.name === prefix + "_" + field+ );+ if (w) w.value = value;+ }+ }+}++async function importXlsxValues(node, filename) {+ try {+ const resp = await fetch("/guider_params/import", {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ filename }),+ });+ if (!resp.ok) return;+ const data = await resp.json();+ populateWidgets(node, data);+ } catch (err) {+ console.error("XLSX import error:", err);+ }+}++function setupUploadButton(node) {+ const fileInput = document.createElement("input");+ fileInput.type = "file";+ fileInput.accept = ".xlsx";+ fileInput.style.display = "none";+ document.body.appendChild(fileInput);++ fileInput.addEventListener("change", async () => {+ if (!fileInput.files || fileInput.files.length === 0) return;+ const file = fileInput.files[0];+ const formData = new FormData();+ formData.append("image", file, file.name);+ formData.append("type", "input");+ formData.append("overwrite", "true");++ try {+ const resp = await fetch("/upload/image", {+ method: "POST",+ body: formData,+ });+ if (!resp.ok) {+ console.error("XLSX upload failed:", resp.statusText);+ return;+ }+ const result = await resp.json();+ const uploadedName = result.name;++ await importXlsxValues(node, uploadedName);+ } catch (err) {+ console.error("XLSX upload error:", err);+ }+ fileInput.value = "";+ });++ node.addWidget("button", "Upload XLSX", "Upload XLSX", () => {+ fileInput.click();+ });+}++function hasConnectedInput(node, widgetName) {+ if (!node.inputs) return false;+ for (const inp of node.inputs) {+ if (inp.widget && inp.widget.name === widgetName && inp.link != null) {+ return true;+ }+ }+ return false;+}++function collectModalityParams(node) {+ const resolved = node._resolvedValues || {};+ const modalities = {};+ for (const prefix of PREFIXES) {+ const enabledWidget = node.widgets.find(+ (w) => w.name === prefix + "_enabled"+ );+ if (!enabledWidget || !enabledWidget.value) continue;+ const fields = {};+ const resolvedMod = resolved[prefix] || {};+ for (const field of STRING_FIELDS) {+ const widgetName = prefix + "_" + field;+ if (hasConnectedInput(node, widgetName) && field in resolvedMod) {+ fields[field] = resolvedMod[field];+ } else {+ const w = node.widgets.find(+ (w) => w.name === widgetName+ );+ if (w) fields[field] = w.value;+ }+ }+ const zisName = prefix + "_zero_init_sigma";+ if (hasConnectedInput(node, zisName) && "zero_init_sigma" in resolvedMod) {+ fields["zero_init_sigma"] = resolvedMod["zero_init_sigma"];+ } else {+ const zisWidget = node.widgets.find(+ (w) => w.name === zisName+ );+ if (zisWidget) fields["zero_init_sigma"] = String(zisWidget.value);+ }+ modalities[prefix === "video" ? "VIDEO" : "AUDIO"] = fields;+ }+ return modalities;+}++function setupExportButton(node) {+ node.addWidget("button", "Export XLSX", "Export XLSX", async () => {+ const filename = prompt("Enter filename for XLSX export:", "preset");+ if (!filename) return;++ const modalities = collectModalityParams(node);+ if (Object.keys(modalities).length === 0) {+ alert("No modalities enabled. Enable at least one.");+ return;+ }++ try {+ const resp = await fetch("/guider_params/export", {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ filename, modalities }),+ });+ const result = await resp.json();+ if (!resp.ok) {+ alert("Export failed: " + (result.error || resp.statusText));+ return;+ }++ const url =+ "/view?filename=" ++ encodeURIComponent(result.filename) ++ "&type=" ++ encodeURIComponent(result.type);+ window.open(url, "_blank");+ } catch (err) {+ console.error("Export error:", err);+ alert("Export failed: " + err.message);+ }+ });+}++app.registerExtension({+ name: "ltx.guider_parameters_advanced",++ async nodeCreated(node) {+ if (node.comfyClass !== "GuiderParametersAdvanced") {+ return;+ }++ // Hide internal widgets that buttons manage+ const saveWidget = node.widgets.find(+ (w) => w.name === "save_filename"+ );+ if (saveWidget) toggleWidget(node, saveWidget, false);++ setupUploadButton(node);+ setupExportButton(node);+ injectMultilineLabels(node);++ for (const prefix of PREFIXES) {+ const enabledWidget = node.widgets.find(+ (w) => w.name === prefix + "_enabled"+ );+ if (!enabledWidget) continue;++ const origCallback = enabledWidget.callback;+ enabledWidget.callback = function (...args) {+ if (origCallback) origCallback.apply(this, args);+ toggleModalityWidgets(node, prefix, enabledWidget.value);+ };++ toggleModalityWidgets(node, prefix, enabledWidget.value);+ }+ },++ async beforeRegisterNodeDef(nodeType, nodeData) {+ if (nodeData.name !== "GuiderParametersAdvanced") {+ return;+ }++ const origOnExecuted = nodeType.prototype.onExecuted;++ nodeType.prototype.onExecuted = function (message) {+ if (origOnExecuted) {+ origOnExecuted.apply(this, arguments);+ }++ if (+ Array.isArray(message.resolved_values) &&+ message.resolved_values.length > 0+ ) {+ this._resolvedValues = message.resolved_values[0];+ }++ if (+ Array.isArray(message.xlsx_download) &&+ message.xlsx_download.length > 0+ ) {+ const info = message.xlsx_download[0];+ const url =+ "/view?filename=" ++ encodeURIComponent(info.filename) ++ "&type=" ++ encodeURIComponent(info.type);++ let linkWidget = this.widgets.find(+ (w) => w.name === "_download_link"+ );+ if (!linkWidget) {+ linkWidget = this.addWidget(+ "button",+ "_download_link",+ "Download XLSX",+ () => {+ window.open(url, "_blank");+ }+ );+ }+ linkWidget.label = "Download: " + info.filename;+ linkWidget.callback = () => {+ window.open(url, "_blank");+ };++ this.setSize(this.computeSize());+ }++ };+ },+});diff --git a/web/js/sparse_track_editor.js b/web/js/sparse_track_editor.jsnew file mode 100644index 0000000..dcd5c2b--- /dev/null+++ b/web/js/sparse_track_editor.js@@ -0,0 +1,715 @@+import { app } from "../../../scripts/app.js";++// ---------------------------------------------------------------------------+// Catmull-Rom spline interpolation (written from scratch)+// ---------------------------------------------------------------------------++function catmullRom(p0, p1, p2, p3, t) {+ const t2 = t * t;+ const t3 = t2 * t;+ return {+ x:+ 0.5 *+ (2 * p1.x ++ (-p0.x + p2.x) * t ++ (2 * p0.x - 5 * p1.x + 4 * p2.x - p3.x) * t2 ++ (-p0.x + 3 * p1.x - 3 * p2.x + p3.x) * t3),+ y:+ 0.5 *+ (2 * p1.y ++ (-p0.y + p2.y) * t ++ (2 * p0.y - 5 * p1.y + 4 * p2.y - p3.y) * t2 ++ (-p0.y + 3 * p1.y - 3 * p2.y + p3.y) * t3),+ };+}++function interpolateSpline(controlPoints, numSamples) {+ if (controlPoints.length === 0) return [];+ if (controlPoints.length === 1) {+ return Array.from({ length: numSamples }, () => ({ ...controlPoints[0] }));+ }+ if (controlPoints.length === 2) {+ const [a, b] = controlPoints;+ return Array.from({ length: numSamples }, (_, i) => {+ const t = i / (numSamples - 1);+ return { x: a.x + (b.x - a.x) * t, y: a.y + (b.y - a.y) * t };+ });+ }+ // Pad with phantom endpoints for Catmull-Rom+ const pts = [+ controlPoints[0],+ ...controlPoints,+ controlPoints[controlPoints.length - 1],+ ];+ const nSeg = pts.length - 3;+ const result = [];+ for (let i = 0; i < numSamples; i++) {+ const gT = (i / (numSamples - 1)) * nSeg;+ const seg = Math.min(Math.floor(gT), nSeg - 1);+ const lT = gT - seg;+ result.push(catmullRom(pts[seg], pts[seg + 1], pts[seg + 2], pts[seg + 3], lT));+ }+ return result;+}++// ---------------------------------------------------------------------------+// Visual constants+// ---------------------------------------------------------------------------++const SPLINE_COLORS = [+ "#ef4444", "#22c55e", "#3b82f6", "#f59e0b",+ "#a855f7", "#06b6d4", "#f97316", "#84cc16",+];+const POINT_RADIUS = 5;+const ACTIVE_POINT_RADIUS = 7;+const HIT_TOLERANCE = 14;+const CURVE_LINE_WIDTH = 2.5;+const CANVAS_MIN_HEIGHT = 128;++// ---------------------------------------------------------------------------+// Helpers+// ---------------------------------------------------------------------------++function dist(a, b) {+ return Math.hypot(a.x - b.x, a.y - b.y);+}++function hideWidget(w) {+ if (!w) return;+ w.hidden = true;+ w._origComputeSize = w.computeSize;+ w.computeSize = () => [0, -3.3];+ w.computedHeight = 0;+}++function closestSegment(pts, p) {+ let best = Infinity;+ let bestIdx = 0;+ for (let i = 0; i < pts.length - 1; i++) {+ const a = pts[i];+ const b = pts[i + 1];+ const dx = b.x - a.x;+ const dy = b.y - a.y;+ const len2 = dx * dx + dy * dy;+ let t = len2 === 0 ? 0 : ((p.x - a.x) * dx + (p.y - a.y) * dy) / len2;+ t = Math.max(0, Math.min(1, t));+ const proj = { x: a.x + t * dx, y: a.y + t * dy };+ const d = dist(proj, p);+ if (d < best) {+ best = d;+ bestIdx = i;+ }+ }+ return { dist: best, segIndex: bestIdx };+}++// ---------------------------------------------------------------------------+// Extension registration+// ---------------------------------------------------------------------------++app.registerExtension({+ name: "LTXVideo.SparseTrackEditor",++ async nodeCreated(node) {+ if (node.comfyClass !== "LTXVSparseTrackEditor") return;+ initEditor(node);+ },++ async beforeRegisterNodeDef(nodeType, nodeData) {+ if (nodeData?.name !== "LTXVSparseTrackEditor") return;++ const origExecuted = nodeType.prototype.onExecuted;+ nodeType.prototype.onExecuted = function (data) {+ origExecuted?.apply(this, arguments);+ if (data?.bg_image?.[0]) {+ loadBgImage(this, data.bg_image[0]);+ }+ };++ const origConfigure = nodeType.prototype.onConfigure;+ nodeType.prototype.onConfigure = function (info) {+ origConfigure?.apply(this, arguments);+ if (this._ed) {+ reloadState(this);+ }+ };++ const origRemoved = nodeType.prototype.onRemoved;+ nodeType.prototype.onRemoved = function () {+ origRemoved?.apply(this, arguments);+ if (this._ed) {+ cancelAnimationFrame(this._ed.rafId);+ if (this._ed._docClickHandler) {+ document.removeEventListener("click", this._ed._docClickHandler);+ }+ this._ed = null;+ }+ };+ },+});++// ---------------------------------------------------------------------------+// Editor initialisation+// ---------------------------------------------------------------------------++function initEditor(node) {+ const pointsW = node.widgets.find((w) => w.name === "points_store");+ const coordsW = node.widgets.find((w) => w.name === "coordinates");+ hideWidget(pointsW);+ hideWidget(coordsW);++ const ed = {+ splines: [],+ active: 0,+ imgW: 1024,+ imgH: 576,+ bgImg: null,+ drag: null,+ hover: null,+ canvas: null,+ ctx: null,+ menu: null,+ dirty: true,+ rafId: null,+ };+ node._ed = ed;++ // Restore saved state+ try {+ const saved = JSON.parse(pointsW.value);+ if (Array.isArray(saved) && saved.length > 0) {+ ed.splines = saved;+ }+ } catch (_) {+ /* first run */+ }+ if (ed.splines.length === 0) {+ ed.splines = [+ [+ { x: ed.imgW * 0.3, y: ed.imgH * 0.5 },+ { x: ed.imgW * 0.7, y: ed.imgH * 0.5 },+ ],+ ];+ }++ // DOM+ const container = document.createElement("div");+ container.style.position = "relative";+ container.style.minHeight = `${CANVAS_MIN_HEIGHT}px`;++ const canvas = document.createElement("canvas");+ canvas.width = 1024;+ canvas.height = 576;+ canvas.style.width = "100%";+ canvas.style.display = "block";+ canvas.style.background = "#1a1a2e";+ canvas.style.borderRadius = "4px";+ canvas.style.cursor = "default";+ canvas.style.pointerEvents = "auto";+ canvas.style.touchAction = "none";+ container.appendChild(canvas);+ ed.canvas = canvas;+ ed.ctx = canvas.getContext("2d");++ const menu = buildContextMenu();+ container.appendChild(menu);+ ed.menu = menu;++ const widget = node.addDOMWidget("track_editor", "TrackEditorWidget", container, {+ serialize: false,+ hideOnZoom: false,+ });+ widget.computeSize = () => {+ const w = node.size[0];+ const aspect = node._ed.imgH / node._ed.imgW;+ const h = Math.max(CANVAS_MIN_HEIGHT, Math.round(w * aspect));+ return [w, h + 10];+ };++ setupEvents(node);+ syncWidgets(node);+ startRenderLoop(node);++ requestAnimationFrame(() => {+ node.setSize?.(node.computeSize());+ app.graph?.setDirtyCanvas(true, true);+ });+}++// ---------------------------------------------------------------------------+// State reload (fires on onConfigure, i.e. workflow load)+// ---------------------------------------------------------------------------++function reloadState(node) {+ const ed = node._ed;+ const pointsW = node.widgets.find((w) => w.name === "points_store");+ try {+ const saved = JSON.parse(pointsW?.value);+ if (Array.isArray(saved) && saved.length > 0) {+ ed.splines = saved;+ }+ } catch (_) {+ /* keep current splines */+ }+ ed.dirty = true;+ syncWidgets(node);+}++// ---------------------------------------------------------------------------+// Background image loading+// ---------------------------------------------------------------------------++function loadBgImage(node, b64) {+ const ed = node._ed;+ const img = new window.Image();+ img.onload = () => {+ const firstLoad = ed.bgImg === null;+ ed.bgImg = img;+ ed.imgW = img.width;+ ed.imgH = img.height;+ if (firstLoad && ed.splines.length === 1 && ed.splines[0].length === 2) {+ ed.splines[0][0] = { x: ed.imgW * 0.3, y: ed.imgH * 0.5 };+ ed.splines[0][1] = { x: ed.imgW * 0.7, y: ed.imgH * 0.5 };+ }+ ed.dirty = true;+ syncWidgets(node);+ requestAnimationFrame(() => {+ node.setSize?.(node.computeSize());+ app.graph?.setDirtyCanvas(true, true);+ });+ };+ img.src = `data:image/jpeg;base64,${b64}`;+}++// ---------------------------------------------------------------------------+// Coordinate transforms (image space <-> canvas pixel space)+// ---------------------------------------------------------------------------++function getScale(node) {+ const ed = node._ed;+ const c = ed.canvas;+ const scaleX = c.width / ed.imgW;+ const scaleY = c.height / ed.imgH;+ return Math.min(scaleX, scaleY);+}++function imgToCanvas(node, p) {+ const s = getScale(node);+ return { x: p.x * s, y: p.y * s };+}++function canvasToImg(node, p) {+ const s = getScale(node);+ return { x: p.x / s, y: p.y / s };+}++function mouseToCanvas(node, e) {+ const rect = node._ed.canvas.getBoundingClientRect();+ return {+ x: (e.clientX - rect.left) * (node._ed.canvas.width / rect.width),+ y: (e.clientY - rect.top) * (node._ed.canvas.height / rect.height),+ };+}++// ---------------------------------------------------------------------------+// Hit-testing+// ---------------------------------------------------------------------------++function hitTestPoint(node, canvasPos) {+ const ed = node._ed;+ const dpr = window.devicePixelRatio || 1;+ const tol = HIT_TOLERANCE * dpr;+ for (let si = 0; si < ed.splines.length; si++) {+ for (let pi = 0; pi < ed.splines[si].length; pi++) {+ const cp = imgToCanvas(node, ed.splines[si][pi]);+ if (dist(cp, canvasPos) < tol) {+ return { si, pi };+ }+ }+ }+ return null;+}++// ---------------------------------------------------------------------------+// Context menu+// ---------------------------------------------------------------------------++function buildContextMenu() {+ const menu = document.createElement("div");+ Object.assign(menu.style, {+ display: "none",+ position: "absolute",+ background: "#252530",+ border: "1px solid #555",+ borderRadius: "6px",+ padding: "4px 0",+ zIndex: "1000",+ boxShadow: "0 4px 12px rgba(0,0,0,0.4)",+ minWidth: "160px",+ fontFamily: "system-ui, sans-serif",+ fontSize: "13px",+ });+ return menu;+}++function showMenu(node, canvasEvt, imgPos) {+ const ed = node._ed;+ const menu = ed.menu;+ menu.innerHTML = "";++ const hit = hitTestPoint(node, mouseToCanvas(node, canvasEvt));++ const items = [];+ items.push({+ label: "Add Point at Cursor",+ action: () => {+ ed.splines[ed.active].push({ x: imgPos.x, y: imgPos.y });+ ed.dirty = true;+ syncWidgets(node);+ },+ });+ items.push({+ label: "Subdivide Nearest Segment",+ action: () => {+ const spline = ed.splines[ed.active];+ if (spline.length < 2) return;+ const { segIndex } = closestSegment(spline, imgPos);+ const a = spline[segIndex];+ const b = spline[segIndex + 1];+ const mid = { x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 };+ spline.splice(segIndex + 1, 0, mid);+ ed.dirty = true;+ syncWidgets(node);+ },+ });+ items.push({ separator: true });+ items.push({+ label: "New Spline",+ action: () => {+ ed.splines.push([+ { x: imgPos.x - 40, y: imgPos.y },+ { x: imgPos.x + 40, y: imgPos.y },+ ]);+ ed.active = ed.splines.length - 1;+ ed.dirty = true;+ syncWidgets(node);+ },+ });+ items.push({+ label: "New Static Spline",+ action: () => {+ ed.splines.push([{ x: imgPos.x, y: imgPos.y }]);+ ed.active = ed.splines.length - 1;+ ed.dirty = true;+ syncWidgets(node);+ },+ });+ items.push({+ label: "Delete Spline",+ action: () => {+ if (ed.splines.length <= 1) return;+ ed.splines.splice(ed.active, 1);+ ed.active = Math.min(ed.active, ed.splines.length - 1);+ ed.dirty = true;+ syncWidgets(node);+ },+ disabled: ed.splines.length <= 1,+ });+ if (hit) {+ const spline = ed.splines[hit.si];+ if (spline.length > 1) {+ items.push({ separator: true });+ items.push({+ label: "Delete Point",+ action: () => {+ spline.splice(hit.pi, 1);+ ed.dirty = true;+ syncWidgets(node);+ },+ });+ }+ }++ for (const item of items) {+ if (item.separator) {+ const hr = document.createElement("div");+ hr.style.borderTop = "1px solid #444";+ hr.style.margin = "4px 8px";+ menu.appendChild(hr);+ continue;+ }+ const el = document.createElement("div");+ el.textContent = item.label;+ const isDisabled = item.disabled;+ Object.assign(el.style, {+ padding: "6px 14px",+ cursor: isDisabled ? "default" : "pointer",+ color: isDisabled ? "#666" : "#ddd",+ whiteSpace: "nowrap",+ });+ if (!isDisabled) {+ el.addEventListener("mouseenter", () => (el.style.background = "#3a3a4a"));+ el.addEventListener("mouseleave", () => (el.style.background = "none"));+ el.addEventListener("click", (e) => {+ e.stopPropagation();+ menu.style.display = "none";+ item.action();+ });+ }+ menu.appendChild(el);+ }++ const rect = node._ed.canvas.getBoundingClientRect();+ const containerRect = node._ed.canvas.parentElement.getBoundingClientRect();+ menu.style.left = `${canvasEvt.clientX - containerRect.left}px`;+ menu.style.top = `${canvasEvt.clientY - containerRect.top}px`;+ menu.style.display = "block";+}++// ---------------------------------------------------------------------------+// Event handling+// ---------------------------------------------------------------------------++function setupEvents(node) {+ const ed = node._ed;+ const canvas = ed.canvas;++ canvas.addEventListener("pointerdown", (e) => {+ ed.menu.style.display = "none";+ if (e.button === 2) return; // right-click handled by contextmenu+ if (e.button !== 0) return;+ e.preventDefault();+ e.stopPropagation();+ canvas.setPointerCapture(e.pointerId);++ const cp = mouseToCanvas(node, e);+ const hit = hitTestPoint(node, cp);+ if (hit) {+ ed.active = hit.si;+ ed.drag = { ...hit, pointerId: e.pointerId };+ canvas.style.cursor = "grabbing";+ ed.dirty = true;+ }+ });++ canvas.addEventListener("pointermove", (e) => {+ const cp = mouseToCanvas(node, e);++ if (ed.drag) {+ e.preventDefault();+ e.stopPropagation();+ const imgP = canvasToImg(node, cp);+ imgP.x = Math.max(0, Math.min(ed.imgW, imgP.x));+ imgP.y = Math.max(0, Math.min(ed.imgH, imgP.y));+ ed.splines[ed.drag.si][ed.drag.pi] = imgP;+ ed.dirty = true;+ syncWidgets(node);+ return;+ }++ const hit = hitTestPoint(node, cp);+ if (hit) {+ canvas.style.cursor = "grab";+ ed.hover = hit;+ } else {+ canvas.style.cursor = "default";+ ed.hover = null;+ }+ ed.dirty = true;+ });++ canvas.addEventListener("pointerup", (e) => {+ if (ed.drag) {+ e.preventDefault();+ e.stopPropagation();+ canvas.releasePointerCapture(e.pointerId);+ ed.drag = null;+ canvas.style.cursor = "default";+ ed.dirty = true;+ syncWidgets(node);+ }+ });++ canvas.addEventListener("pointerleave", () => {+ ed.hover = null;+ ed.dirty = true;+ });++ canvas.addEventListener("lostpointercapture", () => {+ if (ed.drag) {+ ed.drag = null;+ canvas.style.cursor = "default";+ ed.dirty = true;+ syncWidgets(node);+ }+ });++ canvas.addEventListener("contextmenu", (e) => {+ e.preventDefault();+ e.stopPropagation();+ const cp = mouseToCanvas(node, e);+ const imgP = canvasToImg(node, cp);+ showMenu(node, e, imgP);+ });++ const docClickHandler = (e) => {+ if (!ed.menu.contains(e.target)) {+ ed.menu.style.display = "none";+ }+ };+ document.addEventListener("click", docClickHandler);+ ed._docClickHandler = docClickHandler;+}++// ---------------------------------------------------------------------------+// Widget synchronisation+// ---------------------------------------------------------------------------++function syncWidgets(node) {+ const ed = node._ed;+ const pointsW = node.widgets.find((w) => w.name === "points_store");+ const coordsW = node.widgets.find((w) => w.name === "coordinates");+ const samplesW = node.widgets.find((w) => w.name === "points_to_sample");++ if (pointsW) pointsW.value = JSON.stringify(ed.splines);++ const numSamples = samplesW ? samplesW.value : 121;+ const interpolated = ed.splines.map((sp) => interpolateSpline(sp, numSamples));+ // Round to integers for pixel-level coordinates+ const rounded = interpolated.map((track) =>+ track.map((p) => ({ x: Math.round(p.x), y: Math.round(p.y) }))+ );+ if (coordsW) coordsW.value = JSON.stringify(rounded);+}++// ---------------------------------------------------------------------------+// Rendering+// ---------------------------------------------------------------------------++function startRenderLoop(node) {+ const ed = node._ed;++ function loop() {+ ed.rafId = requestAnimationFrame(loop);+ resizeCanvas(node);+ if (!ed.dirty) return;+ ed.dirty = false;+ render(node);+ }++ loop();+}++function resizeCanvas(node) {+ const ed = node._ed;+ const canvas = ed.canvas;+ const dispW = canvas.clientWidth || node.size?.[0] || 400;++ const aspect = ed.imgH / ed.imgW;+ const dispH = Math.max(CANVAS_MIN_HEIGHT, Math.round(dispW * aspect));++ canvas.style.height = `${dispH}px`;++ const dpr = window.devicePixelRatio || 1;+ const bufW = Math.round(dispW * dpr);+ const bufH = Math.round(dispH * dpr);++ if (canvas.width !== bufW || canvas.height !== bufH) {+ canvas.width = bufW;+ canvas.height = bufH;+ ed.dirty = true;+ }+}++function render(node) {+ const ed = node._ed;+ const ctx = ed.ctx;+ const c = ed.canvas;++ ctx.clearRect(0, 0, c.width, c.height);++ // Background image+ if (ed.bgImg) {+ const s = getScale(node);+ ctx.globalAlpha = 0.85;+ ctx.drawImage(ed.bgImg, 0, 0, ed.imgW * s, ed.imgH * s);+ ctx.globalAlpha = 1.0;+ }++ const samplesW = node.widgets.find((w) => w.name === "points_to_sample");+ const numSamples = samplesW ? samplesW.value : 121;+ const dpr = window.devicePixelRatio || 1;++ // Draw each spline+ for (let si = 0; si < ed.splines.length; si++) {+ const isActive = si === ed.active;+ const color = SPLINE_COLORS[si % SPLINE_COLORS.length];+ const spline = ed.splines[si];++ // Interpolated curve+ if (spline.length >= 2) {+ const curve = interpolateSpline(spline, Math.max(numSamples, 60));+ ctx.beginPath();+ const p0 = imgToCanvas(node, curve[0]);+ ctx.moveTo(p0.x, p0.y);+ for (let i = 1; i < curve.length; i++) {+ const p = imgToCanvas(node, curve[i]);+ ctx.lineTo(p.x, p.y);+ }+ ctx.strokeStyle = color;+ ctx.lineWidth = (isActive ? CURVE_LINE_WIDTH * 1.4 : CURVE_LINE_WIDTH) * dpr;+ ctx.globalAlpha = isActive ? 1.0 : 0.5;+ ctx.stroke();+ ctx.globalAlpha = 1.0;+ }++ // Control points+ for (let pi = 0; pi < spline.length; pi++) {+ const cp = imgToCanvas(node, spline[pi]);+ const isHov = ed.hover && ed.hover.si === si && ed.hover.pi === pi;+ const isDrag = ed.drag && ed.drag.si === si && ed.drag.pi === pi;+ const baseR =+ isHov || isDrag+ ? ACTIVE_POINT_RADIUS+ : isActive+ ? POINT_RADIUS+ : POINT_RADIUS * 0.8;+ const r = baseR * dpr;++ // Outer ring+ ctx.beginPath();+ ctx.arc(cp.x, cp.y, r + 2 * dpr, 0, Math.PI * 2);+ ctx.fillStyle = isActive ? "#fff" : "rgba(255,255,255,0.5)";+ ctx.fill();++ // Inner fill+ ctx.beginPath();+ ctx.arc(cp.x, cp.y, r, 0, Math.PI * 2);+ ctx.fillStyle = color;+ ctx.fill();++ // Point number label+ if (isActive) {+ ctx.fillStyle = "#fff";+ ctx.font = `bold ${Math.round(11 * dpr)}px system-ui`;+ ctx.textAlign = "center";+ ctx.fillText(String(pi), cp.x, cp.y - r - 4 * dpr);+ }+ }+ }++ // Active spline indicator+ if (ed.splines.length > 1) {+ const dpr = window.devicePixelRatio || 1;+ ctx.fillStyle = "rgba(0,0,0,0.5)";+ ctx.fillRect(4 * dpr, 4 * dpr, 130 * dpr, 20 * dpr);+ ctx.fillStyle = SPLINE_COLORS[ed.active % SPLINE_COLORS.length];+ ctx.font = `bold ${11 * dpr}px system-ui`;+ ctx.textAlign = "left";+ ctx.fillText(+ `Spline ${ed.active + 1} / ${ed.splines.length}`,+ 10 * dpr,+ 18 * dpr+ );+ }+}