feat: Add Ideogram4 model support (CORE-208) - #14259
Conversation
📝 WalkthroughWalkthroughThis PR introduces complete Ideogram 4 model support to ComfyUI. The core implementation adds a single-stream transformer backbone with AdaLN-modulated attention blocks, QKV projections, and RoPE positional encoding. A Qwen3-VL 8B text encoder taps 13 hidden-state layers to produce per-token LLM features injected into text token positions. The model integrates with ComfyUI via detection from state dict keys, registration in supported models, and CLIP type routing. Sampling extensions include a logit-normal sigma scheduler tuned to Ideogram 4's diffusion process and dual-model guidance for separate conditional and unconditional prediction passes. Advanced sampler nodes for CFG override and dynamic guidance scaling complete the feature set. 🚥 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. 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: 2
🤖 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/ldm/ideogram4/model.py`:
- Line 40: The forward (and any _backbone) signature uses a mutable default
transformer_options={}, which can leak state; change the signature to use
transformer_options=None and inside forward (and _backbone if present) set
transformer_options = {} if None, then use/mutate that local dict. Update
references in comfy/ldm/ideogram4/model.py around the forward method and any
_backbone helper to stop relying on a shared default dict.
In `@comfy/text_encoders/ideogram4.py`:
- Around line 61-65: The flatten currently uses out.permute(0, 2, 3,
1).reshape(b, seq, h * n) which produces hidden-major ordering; to concatenate
each full 4096-dim tap vector in tap-major order change the permutation so taps
are adjacent before the reshape. In encode_token_weights, after getting out,
permute to (0, 2, 1, 3) to produce shape (B, seq, n, h) and then reshape to (b,
seq, n * h) so each tap's full 4096 vector is concatenated in sequence (keep
variables out, b, n, seq, h and returned pooled, extra as before).
🪄 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: b6a62744-ae09-4ed5-8de0-ac0c2f54c6f1
📒 Files selected for processing (9)
comfy/ldm/ideogram4/model.pycomfy/model_base.pycomfy/model_detection.pycomfy/sd.pycomfy/supported_models.pycomfy/text_encoders/ideogram4.pycomfy_extras/nodes_custom_sampler.pycomfy_extras/nodes_ideogram4.pynodes.py
|
Isn't that a closed model? |
Not the latest version. They have it as open weight now. |
Ideogram 4 support
Adds support for the Ideogram 4 text-to-image model, plus a few generic sampling/conditioning nodes to use it's separate uncondtional model.
Model
comfy/ldm/ideogram4/model.py— NextDiT/Lumina2-family single-stream DiT. Packs[text, image]into one sequence with block-diagonal segment attention and 3D interleaved MRoPE; runs image-only when no context is given.Nodes (
comfy_extras/nodes_ideogram4.py)Generic additions
[start, end]step range.