Files
alisson-anjos-ComfyUI-BFSNodes/__init__.py
T
Claude 0795e3fda2 Add MiniMax-H3 single-frame VAE loaders with tile control (1.24.0)
The published single-frame decoder (iamkaikai/MiniMax-H3-Single-Frame-VAE-500K)
cannot be loaded by the stock VAELoader: detection in comfy/sd.py requires an
encoder key, and the file is decoder-only in diffusers naming, so it falls back
to Stable Diffusion geometry (4 latent channels, 8x upscale) and decodes blocks.

Two nodes:
- MiniMaxH3SingleFrameVAELoader: combines the official H3 VAE with the author's
  decoder-only checkpoint, translating the naming in memory. Validated against
  the author's own diffusers path (load_decoder.py) on the same latent: 72.92 dB,
  i.e. fp16 noise.
- MiniMaxH3VAELoaderTiled: loads an already complete H3 VAE and exposes tile_size,
  which the stock loader does not.

Two key conversions are not derivable from names, and getting either wrong
produces wrong output with no load error. Both were settled by correlating
against the official VAE:
- to_qkv is interleaved per head (heads, 3, dim_head), not stacked [q;k;v]
  (see qkv.view(B, S, -1, 3*dim_head) in comfy/ldm/minimax/vae.py); corr 0.998.
- ff.w1 halves are swapped relative to diffusers, since ComfyUI reads gate first;
  correlation: straight -0.013, swapped +2.00.

tile_size defaults to 512 rather than the constructor's 256. Measured on a
1056x640 image: 512 gives 26.00 dB with a seam ratio of 0.91 (indistinguishable),
against 22.17/1.49 at 256 and 21.35/2.42 at 1024. The author trained 475k of
500k images at <=512px, so 512-wide tiles keep each piece inside the regime that
has training mass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 12:14:33 +00:00

88 lines
4.6 KiB
Python

from .nodes import NODE_CLASS_MAPPINGS as BFS_NODE_CLASS_MAPPINGS
from .nodes import NODE_DISPLAY_NAME_MAPPINGS as BFS_NODE_DISPLAY_NAME_MAPPINGS
from .ltxv_editanything import NODE_CLASS_MAPPINGS as LTXV_EA_NODE_CLASS_MAPPINGS
from .ltxv_editanything import NODE_DISPLAY_NAME_MAPPINGS as LTXV_EA_NODE_DISPLAY_NAME_MAPPINGS
from .headswap_node import NODE_CLASS_MAPPINGS as HEADSWAP_NODE_CLASS_MAPPINGS
from .headswap_node import NODE_DISPLAY_NAME_MAPPINGS as HEADSWAP_NODE_DISPLAY_NAME_MAPPINGS
from .anime2real_node import NODE_CLASS_MAPPINGS as A2R_NODE_CLASS_MAPPINGS
from .anime2real_node import NODE_DISPLAY_NAME_MAPPINGS as A2R_NODE_DISPLAY_NAME_MAPPINGS
from .amv_guide_node import NODE_CLASS_MAPPINGS as AMV_NODE_CLASS_MAPPINGS
from .amv_guide_node import NODE_DISPLAY_NAME_MAPPINGS as AMV_NODE_DISPLAY_NAME_MAPPINGS
from .ltx_identity_overlap import NODE_CLASS_MAPPINGS as IDT_NODE_CLASS_MAPPINGS
from .ltx_identity_overlap import NODE_DISPLAY_NAME_MAPPINGS as IDT_NODE_DISPLAY_NAME_MAPPINGS
from .ltx_multiref_slots import NODE_CLASS_MAPPINGS as MRSLOT_NODE_CLASS_MAPPINGS
from .ltx_multiref_slots import NODE_DISPLAY_NAME_MAPPINGS as MRSLOT_NODE_DISPLAY_NAME_MAPPINGS
from .ltx_multiple_controls import NODE_CLASS_MAPPINGS as MC_NODE_CLASS_MAPPINGS
from .ltx_multiple_controls import NODE_DISPLAY_NAME_MAPPINGS as MC_NODE_DISPLAY_NAME_MAPPINGS
from .color_mask_node import NODE_CLASS_MAPPINGS as CM_NODE_CLASS_MAPPINGS
from .color_mask_node import NODE_DISPLAY_NAME_MAPPINGS as CM_NODE_DISPLAY_NAME_MAPPINGS
try:
from .minimax_h3_singleframe_vae import NODE_CLASS_MAPPINGS as MMVAE_NODE_CLASS_MAPPINGS
from .minimax_h3_singleframe_vae import NODE_DISPLAY_NAME_MAPPINGS as MMVAE_NODE_DISPLAY_NAME_MAPPINGS
except Exception as _e: # noqa
print(f"[BFSNodes] MiniMax-H3 VAE loaders not loaded: {_e!r}")
MMVAE_NODE_CLASS_MAPPINGS, MMVAE_NODE_DISPLAY_NAME_MAPPINGS = {}, {}
try:
from .ltx_identity_multiangle import NODE_CLASS_MAPPINGS as MA_NODE_CLASS_MAPPINGS
from .ltx_identity_multiangle import NODE_DISPLAY_NAME_MAPPINGS as MA_NODE_DISPLAY_NAME_MAPPINGS
except Exception as _e: # noqa
print(f"[BFSNodes] LTX Identity Multiple Angles node not loaded: {_e!r}")
MA_NODE_CLASS_MAPPINGS, MA_NODE_DISPLAY_NAME_MAPPINGS = {}, {}
try:
from .ltx_identity_gemma_vision import NODE_CLASS_MAPPINGS as GV_NODE_CLASS_MAPPINGS
from .ltx_identity_gemma_vision import NODE_DISPLAY_NAME_MAPPINGS as GV_NODE_DISPLAY_NAME_MAPPINGS
except Exception as _e: # noqa
print(f"[BFSNodes] LTX Identity Gemma-Vision node not loaded: {_e!r}")
GV_NODE_CLASS_MAPPINGS, GV_NODE_DISPLAY_NAME_MAPPINGS = {}, {}
try:
from .multiref_sheet_node import NODE_CLASS_MAPPINGS as MRS_NODE_CLASS_MAPPINGS
from .multiref_sheet_node import NODE_DISPLAY_NAME_MAPPINGS as MRS_NODE_DISPLAY_NAME_MAPPINGS
except Exception as _e: # noqa
print(f"[BFSNodes] Multi-Ref Sheet Builder node not loaded: {_e!r}")
MRS_NODE_CLASS_MAPPINGS, MRS_NODE_DISPLAY_NAME_MAPPINGS = {}, {}
try:
from .ltx_multishot_prompt import NODE_CLASS_MAPPINGS as MSP_NODE_CLASS_MAPPINGS
from .ltx_multishot_prompt import NODE_DISPLAY_NAME_MAPPINGS as MSP_NODE_DISPLAY_NAME_MAPPINGS
except Exception as _e: # noqa
print(f"[BFSNodes] LTX Multishot Prompt node not loaded: {_e!r}")
MSP_NODE_CLASS_MAPPINGS, MSP_NODE_DISPLAY_NAME_MAPPINGS = {}, {}
# CAN / AdaLN node disabled: empirically the AdaLN modulation degrades the video (the identity
# gain came from the projector + LoRA, not the CAN). Kept the file but not registered.
CAN_NODE_CLASS_MAPPINGS, CAN_NODE_DISPLAY_NAME_MAPPINGS = {}, {}
NODE_CLASS_MAPPINGS = {
**GV_NODE_CLASS_MAPPINGS,
**CAN_NODE_CLASS_MAPPINGS,
**BFS_NODE_CLASS_MAPPINGS,
**LTXV_EA_NODE_CLASS_MAPPINGS,
**HEADSWAP_NODE_CLASS_MAPPINGS,
**A2R_NODE_CLASS_MAPPINGS,
**AMV_NODE_CLASS_MAPPINGS,
**IDT_NODE_CLASS_MAPPINGS,
**MC_NODE_CLASS_MAPPINGS,
**MRSLOT_NODE_CLASS_MAPPINGS,
**MA_NODE_CLASS_MAPPINGS,
**MRS_NODE_CLASS_MAPPINGS,
**CM_NODE_CLASS_MAPPINGS,
**MSP_NODE_CLASS_MAPPINGS,
**MMVAE_NODE_CLASS_MAPPINGS,
}
NODE_DISPLAY_NAME_MAPPINGS = {
**GV_NODE_DISPLAY_NAME_MAPPINGS,
**CAN_NODE_DISPLAY_NAME_MAPPINGS,
**BFS_NODE_DISPLAY_NAME_MAPPINGS,
**LTXV_EA_NODE_DISPLAY_NAME_MAPPINGS,
**HEADSWAP_NODE_DISPLAY_NAME_MAPPINGS,
**A2R_NODE_DISPLAY_NAME_MAPPINGS,
**AMV_NODE_DISPLAY_NAME_MAPPINGS,
**IDT_NODE_DISPLAY_NAME_MAPPINGS,
**MC_NODE_DISPLAY_NAME_MAPPINGS,
**MRSLOT_NODE_DISPLAY_NAME_MAPPINGS,
**MA_NODE_DISPLAY_NAME_MAPPINGS,
**MRS_NODE_DISPLAY_NAME_MAPPINGS,
**CM_NODE_DISPLAY_NAME_MAPPINGS,
**MSP_NODE_DISPLAY_NAME_MAPPINGS,
**MMVAE_NODE_DISPLAY_NAME_MAPPINGS,
}