{"record":{"id":"e8f6d8af207a0123","repo":"Comfy-Org/ComfyUI","slug":"unknown-dinov2-backbone-variant-backbone-name-r","errorCode":null,"errorMessage":"Unknown DINOv2 backbone variant: {backbone_name!r}","messagePattern":"Unknown DINOv2 backbone variant: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy/ldm/depth_anything_3/model.py","lineNumber":40,"sourceCode":"# Backbone presets (mirror the upstream DINOv2 ViT variants).\n_BACKBONE_PRESETS = {\n    \"vits\": dict(hidden_size=384,  num_hidden_layers=12, num_attention_heads=6,  use_swiglu_ffn=False),\n    \"vitb\": dict(hidden_size=768,  num_hidden_layers=12, num_attention_heads=12, use_swiglu_ffn=False),\n    \"vitl\": dict(hidden_size=1024, num_hidden_layers=24, num_attention_heads=16, use_swiglu_ffn=False),\n    \"vitg\": dict(hidden_size=1536, num_hidden_layers=40, num_attention_heads=24, use_swiglu_ffn=True),\n}\n\n\ndef _build_backbone_config(\n    backbone_name: str,\n    *,\n    alt_start: int,\n    qknorm_start: int,\n    rope_start: int,\n    cat_token: bool,\n) -> dict:\n    if backbone_name not in _BACKBONE_PRESETS:\n        raise ValueError(f\"Unknown DINOv2 backbone variant: {backbone_name!r}\")\n    cfg = dict(_BACKBONE_PRESETS[backbone_name])\n    cfg.update(dict(\n        layer_norm_eps=1e-6,\n        patch_size=14,\n        image_size=518,\n        # No mask_token in DA3 weights; omit param to avoid load warnings.\n        use_mask_token=False,\n        alt_start=alt_start,\n        qknorm_start=qknorm_start,\n        rope_start=rope_start,\n        cat_token=cat_token,\n        rope_freq=100.0,\n    ))\n    return cfg\n\n\nclass DepthAnything3Net(nn.Module):\n","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/ldm/depth_anything_3/model.py#L22-L58","documentation":"DepthAnything 3 selects a DINOv2 ViT backbone from a fixed preset table (_BACKBONE_PRESETS, e.g. ViT-S/B/L variants). _build_backbone_config() raises ValueError when backbone_name is not a key of that table. The backbone name is derived from the checkpoint config, so an unexpected name means the checkpoint is not a recognized DA3 model or the config parsing picked the wrong field.","triggerScenarios":"Loading a DepthAnything 3 checkpoint whose config yields a backbone name outside the presets (e.g. 'vitb14_pretrained' vs expected 'vit_base_patch14_dinov2.lvd142m'), or passing a manual backbone name with wrong casing/spacing.","commonSituations":"New DA3 releases with renamed backbones not yet in _BACKBONE_PRESETS; community-finetuned checkpoints with edited configs; custom nodes constructing the DA3 model directly with a guessed name.","solutions":["Print the table keys (sorted(_BACKBONE_PRESETS)) and use the exact preset key matching your checkpoint's backbone.","If your checkpoint is a legitimate new variant, add a preset entry derived from its config (embed dim, depth, num heads) rather than passing a free-form name.","If the name comes from config parsing, fix the extraction so it maps the checkpoint's backbone identifier to a preset key."],"exampleFix":"# before\ncfg = _build_backbone_config(\"ViT-B/14\", ...)\n\n# after\ncfg = _build_backbone_config(\"vit_base_patch14_dinov2.lvd142m\", ...)","handlingStrategy":"validation","validationCode":"from comfy.ldm.depth_anything_3.model import _BACKBONE_PRESETS\nassert backbone_name in _BACKBONE_PRESETS, f\"backbone must be one of {sorted(_BACKBONE_PRESETS)}\"","typeGuard":"def is_known_da3_backbone(name: str) -> bool:\n    from comfy.ldm.depth_anything_3.model import _BACKBONE_PRESETS\n    return name in _BACKBONE_PRESETS","tryCatchPattern":null,"preventionTips":["Derive the backbone name from the checkpoint config, never guess it.","When adding new DA3 checkpoints, verify their backbone name against the preset table first."],"tags":["depth-anything-3","dinov2","backbone","config"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}