huggingface/transformers · error · FileNotFoundError

No baseline with name '{name}' in {RESULTS_DIR}

Error message

No baseline with name '{name}' in {RESULTS_DIR}

What it means

`load_deepgemm_kernel` tried to lazily download/import the `kernels-community/deep-gemm` hub kernel via `lazy_load_kernel("deep-gemm")` and got `None`. This means the hub `kernels` machinery could not return a usable module — typically no prebuilt build matching your current torch/CUDA combination, or the `kernels` package is missing/outdated (the earlier `is_deepgemm_loadable(raise_error=True)` already passed, so the failure is at kernel fetch time).

Source

Thrown at benchmark_v2/benchmark_scripts/continuous_batching_overall.py:298

        """Save all entries to a timestamped JSON file keyed by name."""
        RESULTS_DIR.mkdir(parents=True, exist_ok=True)
        filename = RESULTS_DIR / f"{name}__{int(time.time())}.json"
        payload = {
            "model_id": self.model_id,
            "attn_impl": self.attn_impl,
            "entries": [asdict(e) for e in self.entries],
        }
        with open(filename, "w") as f:
            json.dump(payload, f, indent=2)
        print(f"\nResults saved to {filename}")
        return filename

    @classmethod
    def load_most_recent(cls, name: str) -> "BenchmarkResults":
        """Load the most recent JSON file matching name."""
        candidates = sorted(RESULTS_DIR.glob(f"{name}__*.json"))
        if not candidates:
            raise FileNotFoundError(f"No baseline with name '{name}' in {RESULTS_DIR}")
        data = json.loads(candidates[-1].read_text())
        instance = cls(
            model_id=data.get("model_id"),
            attn_impl=data.get("attn_impl"),
        )
        instance.entries = [BenchmarkEntry(**e) for e in data["entries"]]
        print(f"Loaded baseline from {candidates[-1]}")
        return instance

    # Display
    def print_summary(self) -> None:
        rows = [
            {
                "label": e.label,
                "samples": e.num_samples,
                "avg_in": f"{e.avg_input_tokens:.1f}",
                "max_new": e.max_new_tokens,
                "time (s)": _fmt(e.time_seconds, ".2f"),

View on GitHub (pinned to a597f97485)

Solutions

  1. Check that a `kernels` release matching your torch/CUDA exists and install a compatible version (`pip install -U kernels`, respecting the integration's min/max pins)
  2. Verify torch/CUDA pairing (`python -c "import torch; print(torch.__version__, torch.version.cuda)"`) and, if unsupported, switch to a torch version for which deep-gemm builds are published (e.g. stable torch + CUDA 12.x)
  3. Ensure network/credentials work for hub download (HF_TOKEN for gated/large files, https://huggingface.co reachable, or set HF_HUB_OFFLINE=0)
  4. If the environment cannot be fixed, fall back: run experts with `model.set_experts_implementation('grouped_mm')` or disable the deepgemm path so Triton is used

Example fix

// before
model.set_experts_implementation("deepgemm")
out = model(x)  # ImportError: Failed to load `kernels-community/deep-gemm`

// after
# fix env: pip install -U "kernels==<compatible>" and use a supported torch/CUDA pair
# or opt out:
model.set_experts_implementation("grouped_mm")
out = model(x)
Defensive patterns

Strategy: fallback

Validate before calling

from transformers.integrations.deepgemm import is_deepgemm_loadable

if not is_deepgemm_loadable(raise_error=False):
    model.set_experts_implementation("grouped_mm")  # avoid deep-gemm load

Try / catch

try:
    out = deepgemm_fp8_fp4_linear(x, w, w_sf)
except ImportError as e:
    if "deep-gemm" in str(e):
        out = triton_fp8_linear(x, w, w_sf)  # documented fallback
    else:
        raise

Prevention

When it happens

Trigger: First forward pass through a DeepGEMM FP8/FP4 path (`experts_implementation='deepgemm'`, `fp8_linear` with DeepGEMM enabled) on a machine where `kernels`' hub resolution for `kernels-community/deep-gemm` finds no matching wheel for the installed torch+CUDA (e.g. torch nightly, CUDA 12.8 vs 12.6, or an exotic arch), or an offline environment where the download failed.

Common situations: Custom/local torch build with no published kernel wheel; air-gapped cluster without HF hub access; torch upgraded after kernels cache was populated; mismatched CUDA minor version between torch and the prebuilt deep-gemm kernels.

Related errors


AI-assisted analysis of huggingface/transformers@a597f97485 (2026-08-14). Data as JSON: /api/errors/492b4cadf46a62f9. Report an issue: GitHub.