feat: Add downscaled IC-LoRA support to LTXVAddGuide (CORE-102)#13896
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR adds LoRA metadata propagation through the LoRA loading and application pipeline. LoRA files are loaded with metadata and cached alongside weights. load_lora_for_models accepts optional lora_metadata and attaches it to model and clip patchers. LTXVAddGuide gains an optional ic_lora input, extracts a reference_downscale_factor from IC‑LoRA metadata, applies latent downscaling (with validation), optionally dilates and masks the guide latent, and passes guide_mask and latent_downscale_factor into keyframe conditioning for correct alignment. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@comfy/sd.py`:
- Around line 103-104: The code calls new_clip.set_attachments but new_clip is a
CLIP wrapper without that method; instead attach lora_metadata to the patcher.
Replace the set_attachments call on new_clip with using the CLIP patcher (e.g.,
patcher.set_attachments or patcher.attachments API) to store "lora_metadata" so
references to new_clip remain valid; update the logic around new_clip and the
patcher usage to set the attachment via the patcher rather than on new_clip.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5c3664e2-ee0a-4e3e-a75d-3b811b87a568
📒 Files selected for processing (3)
comfy/sd.pycomfy_extras/nodes_lt.pynodes.py
Brings the IC-LoRA guide work up to date with upstream master. Resolved nodes_lt.py by keeping the ic_lora input and adopting master's strength max increase (1.0 to 10.0).
Supersedes the ic_lora model-input approach with the approved Get IC-LoRA Parameters node feeding an iclora_parameters socket on LTXVAddGuide. Resolved nodes_lt.py to the new design while keeping master's strength range and guide_mask VRAM clamp from 33ce449.

IC-LoRAs that need a non-default downscale factor have been usable in ComfyUI through Lightricks'
LTXAddVideoICLoRAGuidecustom node from ComfyUI-LTXVideo, which exposeslatent_downscale_factoras a manual numeric input.This proposed ComfyUI core version uses a new node (
Get IC-LoRA Parameters) to tell theLTXVAddGuidehow to process the guide latents, including performing the correct downscaling if necessary.Under the hood,
LoraLoadernow exposes the LoRA's safetensors metadata on the model as an attachment under the keylora_metadata. TheGet IC-LoRA Parametersnode reads that attachment from the model and outputs aniclora_parametersobject.LTXVAddGuidereadsreference_downscale_factorfrom thaticlora_parametersinput. It falls back to factor 1 when nothing is connected or the metadata key is missing.Workflow for testing:
droz_LTX23_canny_union_control_ic_lora_parameters_v3.json
Expected output:
ComfyUI_00113_.mp4
Input assets for test workflow:
CannyTest.mp4
Previous version (Old and busted)
droz_LTX23_canny_union_control_v1.json