Comfy-Org/ComfyUI · error · Exception

invalid style model {}

Error message

invalid style model {}

What it means

load_style_model in comfy/sd.py recognizes style models by two signatures only: a 'style_embedding' key (T2I-Adapter StyleAdapter) or a 'redux_down.weight' key (FLUX Redux image encoder). Any other checkpoint falls through to this Exception, meaning the file is not a ComfyUI style model.

Source

Thrown at comfy/sd.py:1484

        return patcher is not None and patcher.is_dynamic()

class StyleModel:
    def __init__(self, model, device="cpu"):
        self.model = model

    def get_cond(self, input):
        return self.model(input.last_hidden_state)


def load_style_model(ckpt_path):
    model_data = comfy.utils.load_torch_file(ckpt_path, safe_load=True)
    keys = model_data.keys()
    if "style_embedding" in keys:
        model = comfy.t2i_adapter.adapter.StyleAdapter(width=1024, context_dim=768, num_head=8, n_layes=3, num_token=8)
    elif "redux_down.weight" in keys:
        model = comfy.ldm.flux.redux.ReduxImageEncoder()
    else:
        raise Exception("invalid style model {}".format(ckpt_path))
    model.load_state_dict(model_data)
    return StyleModel(model)

class CLIPType(Enum):
    STABLE_DIFFUSION = 1
    STABLE_CASCADE = 2
    SD3 = 3
    STABLE_AUDIO = 4
    HUNYUAN_DIT = 5
    FLUX = 6
    MOCHI = 7
    LTXV = 8
    HUNYUAN_VIDEO = 9
    PIXART = 10
    COSMOS = 11
    LUMINA2 = 12
    WAN = 13
    HIDREAM = 14

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Verify the file contains 'redux_down.weight' (FLUX Redux) or 'style_embedding' (T2I style adapter) keys before loading.
  2. Put only style models in models/style_models and double-check the file you selected in the node.
  3. Re-download the Redux/style-adapter checkpoint if the signature keys are absent (possible truncation).

Example fix

# before
style_model = load_style_model('models/style_models/ip-adapter_sd15.safetensors')  # Exception

# after
from comfy.utils import load_torch_file
keys = load_torch_file(path, safe_load=True).keys()
assert 'redux_down.weight' in keys or 'style_embedding' in keys, 'not a style model'
style_model = load_style_model(path)
Defensive patterns

Strategy: validation

Validate before calling

from comfy.utils import load_torch_file
keys = load_torch_file(path, safe_load=True).keys()
assert 'style_embedding' in keys or 'redux_down.weight' in keys, f'{path} is not a style model'

Try / catch

try:
    style_model = load_style_model(path)
except Exception as e:
    if 'invalid style model' in str(e):
        raise SystemExit(f'{path} is not a FLUX Redux / T2I style adapter; check the file type.')
    raise

Prevention

When it happens

Trigger: Loading a random safetensors/ckpt (LoRA, CLIP, VAE, IP-Adapter, ControlNet) into a StyleModelLoader node; a Redux file with renamed keys; style model formats from forks that use different key names.

Common situations: Confusing IP-Adapter or ControlNet files with style models; pointing StyleModelLoader at the wrong file in a crowded models/style_models directory; partial downloads that lost the signature keys.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/65d682937f07dd84. Report an issue: GitHub.