{"record":{"id":"65d682937f07dd84","repo":"Comfy-Org/ComfyUI","slug":"invalid-style-model","errorCode":null,"errorMessage":"invalid style model {}","messagePattern":"invalid style model (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"comfy/sd.py","lineNumber":1484,"sourceCode":"        return patcher is not None and patcher.is_dynamic()\n\nclass StyleModel:\n    def __init__(self, model, device=\"cpu\"):\n        self.model = model\n\n    def get_cond(self, input):\n        return self.model(input.last_hidden_state)\n\n\ndef load_style_model(ckpt_path):\n    model_data = comfy.utils.load_torch_file(ckpt_path, safe_load=True)\n    keys = model_data.keys()\n    if \"style_embedding\" in keys:\n        model = comfy.t2i_adapter.adapter.StyleAdapter(width=1024, context_dim=768, num_head=8, n_layes=3, num_token=8)\n    elif \"redux_down.weight\" in keys:\n        model = comfy.ldm.flux.redux.ReduxImageEncoder()\n    else:\n        raise Exception(\"invalid style model {}\".format(ckpt_path))\n    model.load_state_dict(model_data)\n    return StyleModel(model)\n\nclass CLIPType(Enum):\n    STABLE_DIFFUSION = 1\n    STABLE_CASCADE = 2\n    SD3 = 3\n    STABLE_AUDIO = 4\n    HUNYUAN_DIT = 5\n    FLUX = 6\n    MOCHI = 7\n    LTXV = 8\n    HUNYUAN_VIDEO = 9\n    PIXART = 10\n    COSMOS = 11\n    LUMINA2 = 12\n    WAN = 13\n    HIDREAM = 14","sourceCodeStart":1466,"sourceCodeEnd":1502,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/sd.py#L1466-L1502","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the file contains 'redux_down.weight' (FLUX Redux) or 'style_embedding' (T2I style adapter) keys before loading.","Put only style models in models/style_models and double-check the file you selected in the node.","Re-download the Redux/style-adapter checkpoint if the signature keys are absent (possible truncation)."],"exampleFix":"# before\nstyle_model = load_style_model('models/style_models/ip-adapter_sd15.safetensors')  # Exception\n\n# after\nfrom comfy.utils import load_torch_file\nkeys = load_torch_file(path, safe_load=True).keys()\nassert 'redux_down.weight' in keys or 'style_embedding' in keys, 'not a style model'\nstyle_model = load_style_model(path)","handlingStrategy":"validation","validationCode":"from comfy.utils import load_torch_file\nkeys = load_torch_file(path, safe_load=True).keys()\nassert 'style_embedding' in keys or 'redux_down.weight' in keys, f'{path} is not a style model'","typeGuard":null,"tryCatchPattern":"try:\n    style_model = load_style_model(path)\nexcept Exception as e:\n    if 'invalid style model' in str(e):\n        raise SystemExit(f'{path} is not a FLUX Redux / T2I style adapter; check the file type.')\n    raise","preventionTips":["Keep only Redux and T2I style-adapter files in models/style_models.","Check for the redux_down.weight or style_embedding keys before pointing StyleModelLoader at a file."],"tags":["style-model","redux","checkpoint-loading","file-format"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}