{"record":{"id":"8d6f309f3365d22d","repo":"Comfy-Org/ComfyUI","slug":"ar-video-sampler-requires-a-causal-wan-compatible","errorCode":null,"errorMessage":"ar_video sampler requires a Causal-WAN compatible model whose diffusion_model exposes init_kv_caches() and init_crossattn_caches(). The loaded checkpoint does not support this interface — choose a different sampler.","messagePattern":"ar_video sampler requires a Causal-WAN compatible model whose diffusion_model exposes init_kv_caches\\(\\) and init_crossattn_caches\\(\\)\\. The loaded checkpoint does not support this interface — choose a different sampler\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"comfy/k_diffusion/sampling.py","lineNumber":1871,"sourceCode":"\n    All AR-loop parameters are passed via the SamplerARVideo node, not read\n    from the checkpoint or transformer_options.\n    \"\"\"\n    extra_args = {} if extra_args is None else extra_args\n    model_options = extra_args.get(\"model_options\", {})\n    transformer_options = model_options.get(\"transformer_options\", {})\n\n    if x.ndim != 5:\n        raise ValueError(\n            f\"ar_video sampler requires 5-D video latents [B,C,T,H,W], got {x.ndim}-D tensor with shape {x.shape}. \"\n            \"This sampler is only compatible with autoregressive video models (e.g. Causal-WAN).\"\n        )\n\n    inner_model = model.inner_model.inner_model\n    causal_model = inner_model.diffusion_model\n\n    if not (hasattr(causal_model, \"init_kv_caches\") and hasattr(causal_model, \"init_crossattn_caches\")):\n        raise TypeError(\n            \"ar_video sampler requires a Causal-WAN compatible model whose diffusion_model \"\n            \"exposes init_kv_caches() and init_crossattn_caches(). The loaded checkpoint \"\n            \"does not support this interface — choose a different sampler.\"\n        )\n\n    seed = extra_args.get(\"seed\", 0)\n\n    bs, c, lat_t, lat_h, lat_w = x.shape\n    frame_seq_len = -(-lat_h // 2) * -(-lat_w // 2) # ceiling division\n    num_blocks = -(-lat_t // num_frame_per_block)   # ceiling division\n    device = x.device\n    model_dtype = inner_model.get_dtype()\n\n    kv_caches = causal_model.init_kv_caches(bs, lat_t * frame_seq_len, device, model_dtype)\n    crossattn_caches = causal_model.init_crossattn_caches(bs, device, model_dtype)\n\n    output = torch.zeros_like(x)\n    s_in = x.new_ones([x.shape[0]])","sourceCodeStart":1853,"sourceCodeEnd":1889,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/k_diffusion/sampling.py#L1853-L1889","documentation":"Raised by sample_ar_video after the latent-shape check: the sampler drives autoregressive generation via the loaded diffusion model's init_kv_caches() / init_crossattn_caches() interface, which only Causal-WAN checkpoints expose. If the loaded model is any other architecture, those attributes are absent and a TypeError is raised telling you the checkpoint does not support AR sampling.","triggerScenarios":"Selecting the ar_video sampler while a non-Causal-WAN diffusion model (SD, Flux, standard Wan 2.x, etc.) is loaded. The hasattr probe on model.inner_model.inner_model.diffusion_model fails before any step runs.","commonSituations":"Switching sampler in a workflow without swapping the checkpoint; loading a Wan variant that was converted without the causal cache methods; older checkpoints against a newer ComfyUI where ar_video was newly added.","solutions":["Load a Causal-WAN checkpoint whose transformer implements init_kv_caches / init_crossattn_caches","Or switch the sampler to a standard one (dpmpp_2m_sde, euler, etc.) for the loaded model","If using a re-converted checkpoint, re-export it so the causal cache interface is preserved"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"dm = model.inner_model.inner_model.diffusion_model\nif not (hasattr(dm, 'init_kv_caches') and hasattr(dm, 'init_crossattn_caches')):\n    raise TypeError('load a Causal-WAN checkpoint or pick a non-AR sampler')","typeGuard":"def is_causal_wan(model) -> bool:\n    dm = model.inner_model.inner_model.diffusion_model\n    return hasattr(dm, 'init_kv_caches') and hasattr(dm, 'init_crossattn_caches')","tryCatchPattern":"try:\n    out = sample_ar_video(model, x, sigmas, ...)\nexcept TypeError:\n    out = sample_dpmpp_2m_sde(model, x, sigmas)  # fallback sampler","preventionTips":["Probe for init_kv_caches/init_crossattn_caches before choosing the ar_video sampler","Pair sampler choice with checkpoint family in workflow templates"],"tags":["sampling","ar-video","causal-wan","model-compatibility","checkpoint"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}