---
title: checkpoint_compat
---

<div class="python-reference">
<a id="fastvideo.mlx_runtime.checkpoint_compat-classes"></a>
<a id="fastvideo.mlx_runtime.checkpoint_compat-functions"></a>
<a id="fastvideo.mlx_runtime.checkpoint_compat"></a>
<p>Reject NVIDIA FastWan-QAD checkpoints on the Apple Silicon MLX path.</p>
<p>FastMetal-QAD is the Apple Silicon release: DMD2 students trained on the affine
INT8 grid, shipped as packed <code>mlx_dit.safetensors</code> + <code>mlx_dit.json</code>.
<code>FastVideo/FastWan-QAD-1.3B</code> and <code>FastVideo/FastWan-QAD-FP8-1.3B</code> are
NVIDIA-only QAD checkpoints (NVFP4 / FP8). Loading them through the MLX
Diffusers path silently requantizes the wrong weights and produces videos that
ignore the prompt. Fail loudly instead.</p>
<h2 id="fastvideo.mlx_runtime.checkpoint_compat.UnsupportedMLXCheckpointError"><code>fastvideo.mlx_runtime.checkpoint_compat.UnsupportedMLXCheckpointError</code></h2>
<pre class="doc-signature"><code>UnsupportedMLXCheckpointError()</code></pre>
<p>Raised when an NVIDIA FastWan-QAD (or similarly incompatible) tree is used on MLX.</p>
<details><summary>Source</summary><pre><code>class UnsupportedMLXCheckpointError(ValueError):
    &quot;&quot;&quot;Raised when an NVIDIA FastWan-QAD (or similarly incompatible) tree is used on MLX.&quot;&quot;&quot;</code></pre></details>
<h2 id="fastvideo.mlx_runtime.checkpoint_compat.is_mlx_dit_checkpoint"><code>fastvideo.mlx_runtime.checkpoint_compat.is_mlx_dit_checkpoint</code></h2>
<pre class="doc-signature"><code>is_mlx_dit_checkpoint(path: str | Path) -&gt; bool</code></pre>
<p>Return True if <code>path</code> is a packed FastMetal / MLX DiT directory.</p>
<details><summary>Source</summary><pre><code>def is_mlx_dit_checkpoint(path: str | Path) -&gt; bool:
    &quot;&quot;&quot;Return True if ``path`` is a packed FastMetal / MLX DiT directory.&quot;&quot;&quot;
    checkpoint_dir = Path(path)
    return (checkpoint_dir / MLX_DIT_MANIFEST).is_file() and (checkpoint_dir / MLX_DIT_WEIGHTS).is_file()</code></pre></details>
<h2 id="fastvideo.mlx_runtime.checkpoint_compat.discover_mlx_checkpoint"><code>fastvideo.mlx_runtime.checkpoint_compat.discover_mlx_checkpoint</code></h2>
<pre class="doc-signature"><code>discover_mlx_checkpoint(*candidates: str | Path | None) -&gt; Path | None</code></pre>
<p>Return the first candidate that is a packed MLX DiT directory.</p>
<details><summary>Source</summary><pre><code>def discover_mlx_checkpoint(*candidates: str | Path | None) -&gt; Path | None:
    &quot;&quot;&quot;Return the first candidate that is a packed MLX DiT directory.&quot;&quot;&quot;
    for candidate in candidates:
        if candidate is None:
            continue
        path = Path(candidate)
        if is_mlx_dit_checkpoint(path):
            return path
    return None</code></pre></details>
<h2 id="fastvideo.mlx_runtime.checkpoint_compat.resolve_mlx_checkpoint"><code>fastvideo.mlx_runtime.checkpoint_compat.resolve_mlx_checkpoint</code></h2>
<pre class="doc-signature"><code>resolve_mlx_checkpoint(explicit: str | Path | None, *search_roots: str | Path | None) -&gt; Path | None</code></pre>
<p>Prefer an explicit <code>--mlx-checkpoint</code>, otherwise scan search roots.</p>
<details><summary>Source</summary><pre><code>def resolve_mlx_checkpoint(explicit: str | Path | None, *search_roots: str | Path | None) -&gt; Path | None:
    &quot;&quot;&quot;Prefer an explicit ``--mlx-checkpoint``, otherwise scan search roots.&quot;&quot;&quot;
    if explicit is not None:
        return Path(explicit)
    return discover_mlx_checkpoint(*search_roots)</code></pre></details>
<h2 id="fastvideo.mlx_runtime.checkpoint_compat.mlx_checkpoint_missing_hint"><code>fastvideo.mlx_runtime.checkpoint_compat.mlx_checkpoint_missing_hint</code></h2>
<pre class="doc-signature"><code>mlx_checkpoint_missing_hint(checkpoint_dir: str | Path) -&gt; str</code></pre>
<p>Extra FileNotFoundError text when a directory is not a packed MLX DiT.</p>
<details><summary>Source</summary><pre><code>def mlx_checkpoint_missing_hint(checkpoint_dir: str | Path) -&gt; str:
    &quot;&quot;&quot;Extra FileNotFoundError text when a directory is not a packed MLX DiT.&quot;&quot;&quot;
    nvidia_reason = nvidia_fastwan_qad_reason(checkpoint_dir)
    prefix = (f&quot;Not an MLX DiT checkpoint directory: &#123;checkpoint_dir&#125; &quot;
              f&quot;(expected &#123;MLX_DIT_MANIFEST&#125; and &#123;MLX_DIT_WEIGHTS&#125;).&quot;)
    if nvidia_reason is not None:
        return prefix + &quot;\n\n&quot; + _nvidia_fastwan_qad_message(Path(checkpoint_dir), nvidia_reason)
    return prefix + &quot;\n\n&quot; + _fastmetal_howto()</code></pre></details>
<h2 id="fastvideo.mlx_runtime.checkpoint_compat.raise_if_unsupported_mlx_checkpoint"><code>fastvideo.mlx_runtime.checkpoint_compat.raise_if_unsupported_mlx_checkpoint</code></h2>
<pre class="doc-signature"><code>raise_if_unsupported_mlx_checkpoint(*paths: str | Path | None) -&gt; None</code></pre>
<p>Raise if any path is an NVIDIA FastWan-QAD tree that must not run on MLX.</p>
<p>Packed FastMetal / MLX DiT directories are always allowed, including the
older FastWan-QAD-INT8 directory name, because those already contain
<code>mlx_dit.json</code>.</p>
<details><summary>Source</summary><pre><code>def raise_if_unsupported_mlx_checkpoint(*paths: str | Path | None) -&gt; None:
    &quot;&quot;&quot;Raise if any path is an NVIDIA FastWan-QAD tree that must not run on MLX.

    Packed FastMetal / MLX DiT directories are always allowed, including the
    older FastWan-QAD-INT8 directory name, because those already contain
    ``mlx_dit.json``.
    &quot;&quot;&quot;
    for path in paths:
        if path is None:
            continue
        checkpoint = Path(path)
        if is_mlx_dit_checkpoint(checkpoint):
            continue
        reason = nvidia_fastwan_qad_reason(checkpoint)
        if reason is None:
            continue
        raise UnsupportedMLXCheckpointError(_nvidia_fastwan_qad_message(checkpoint, reason))</code></pre></details>
<h2 id="fastvideo.mlx_runtime.checkpoint_compat.nvidia_fastwan_qad_reason"><code>fastvideo.mlx_runtime.checkpoint_compat.nvidia_fastwan_qad_reason</code></h2>
<pre class="doc-signature"><code>nvidia_fastwan_qad_reason(path: str | Path) -&gt; str | None</code></pre>
<p>Return a short reason if <code>path</code> looks like NVIDIA FastWan-QAD, else None.</p>
<details><summary>Source</summary><pre><code>def nvidia_fastwan_qad_reason(path: str | Path) -&gt; str | None:
    &quot;&quot;&quot;Return a short reason if ``path`` looks like NVIDIA FastWan-QAD, else None.&quot;&quot;&quot;
    checkpoint = Path(path)
    haystack = _path_haystack(checkpoint)
    if &quot;int8&quot; in haystack and is_mlx_dit_checkpoint(checkpoint):
        return None
    if _NVIDIA_FASTWAN_QAD_RE.search(haystack) and &quot;int8&quot; not in haystack:
        return &quot;NVIDIA FastWan-QAD checkpoint name (NVFP4/FP8, not FastMetal INT8)&quot;
    if (checkpoint / CUDA_QAD_OVERLAY_DIR).is_dir() or (checkpoint.parent / CUDA_QAD_OVERLAY_DIR).is_dir():
        return f&quot;CUDA QAD overlay directory (&#123;CUDA_QAD_OVERLAY_DIR&#125;/)&quot;
    for config_path in _config_candidates(checkpoint):
        marker = _quant_marker_in_file(config_path)
        if marker is not None:
            return f&quot;&#123;config_path.name&#125; contains NVIDIA quantization marker &#123;marker!r&#125;&quot;
    return None</code></pre></details>
</div>
