{"record":{"id":"6beafeec40e1f39a","repo":"Comfy-Org/ComfyUI","slug":"error-audio-encoder-not-supported","errorCode":null,"errorMessage":"ERROR: audio encoder not supported.","messagePattern":"ERROR: audio encoder not supported\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"comfy/audio_encoders/audio_encoders.py","lineNumber":83,"sourceCode":"            config = {\n                \"model_type\": \"wav2vec2\",\n                \"embed_dim\": 768,\n                \"num_heads\": 12,\n                \"num_layers\": 12,\n                \"conv_norm\": False,\n                \"conv_bias\": False,\n                \"do_normalize\": False, # chinese-wav2vec2-base has this False\n                \"do_stable_layer_norm\": False\n            }\n        else:\n            raise RuntimeError(\"ERROR: audio encoder file is invalid or unsupported embed_dim: {}\".format(embed_dim))\n    elif \"model.encoder.embed_positions.weight\" in sd:\n        sd = comfy.utils.state_dict_prefix_replace(sd, {\"model.\": \"\"})\n        config = {\n            \"model_type\": \"whisper3\",\n        }\n    else:\n        raise RuntimeError(\"ERROR: audio encoder not supported.\")\n\n    audio_encoder = AudioEncoderModel(config)\n    m, u = audio_encoder.load_sd(sd)\n    if len(m) > 0:\n        logging.warning(\"missing audio encoder: {}\".format(m))\n    if len(u) > 0:\n        logging.warning(\"unexpected audio encoder: {}\".format(u))\n\n    return audio_encoder\n","sourceCodeStart":65,"sourceCodeEnd":93,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/audio_encoders/audio_encoders.py#L65-L93","documentation":"load_audio_encoder recognizes exactly two state-dict signatures: wav2vec2-style keys (with known embed_dim) and whisper3-style 'model.encoder.embed_positions.weight'. A checkpoint matching neither raises RuntimeError('audio encoder not supported.') — the loader refuses unknown architectures instead of misloading them.","triggerScenarios":"Loading a whisper (non-v3) checkpoint with different key layout, a CLAP/FLAN-T5 audio encoder, or any audio embedding model whose tensor names differ from wav2vec2/whisper3 conventions.","commonSituations":"Pointing an audio-capable node at a text encoder or audio classifier by mistake; using a newer/different encoder release (whisper-large-v3 vs v2); safetensors exported from an incompatible transformers version.","solutions":["Confirm the file is actually the expected wav2vec2 or whisper3 encoder checkpoint for the node.","Inspect the checkpoint's keys (comfy.utils.load_torch_file then sd.keys()) and compare with the two supported signatures.","Re-export/convert the model, or extend load_audio_encoder with a branch for your architecture."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"sd = comfy.utils.load_torch_file(path)\nkeys = set(sd.keys())\nis_wav2vec2 = any(k.endswith(\"self_attn.q_proj.weight\") for k in keys)\nis_whisper3 = \"model.encoder.embed_positions.weight\" in keys\nif not (is_wav2vec2 or is_whisper3):\n    raise SystemExit(\"unsupported audio encoder architecture\")","typeGuard":"def is_supported_audio_encoder(sd: dict) -> bool:\n    ks = set(sd.keys())\n    return \"model.encoder.embed_positions.weight\" in ks or any(\n        k.endswith(\"self_attn.q_proj.weight\") for k in ks)","tryCatchPattern":"try:\n    enc = load_audio_encoder(sd)\nexcept RuntimeError as e:\n    if \"not supported\" in str(e):\n        print(\"supported: wav2vec2 (768/1024) or whisper3 encoders only\")\n    raise","preventionTips":["Confirm the file is the expected wav2vec2/whisper3 encoder before wiring the node.","Inspect checkpoint keys when integrating a new audio model."],"tags":["audio","model-loading","whisper"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}