How to use from
Docker Model Runner
docker model run hf.co/tiny-random/mamba
Quick Links

This is a randomly initialized tiny model based on state-spaces/mamba-2.8b-hf for testing and debugging.

Feature Source This repo
Checkpoint tensor elements 2.77B F32 6.90M BF16
Safetensors weight files 11.07 GB (3 files) 13.81 MB (model.safetensors)
Layers 64 4
Hidden width / inner width (2x) 2,560 / 5,120 128 / 256
SSM state size / conv kernel 16 / 4 Same
Time-step rank 160 (hidden/16) 8 (hidden/16)
Vocabulary rows / embedding tying 50,280 / tied Same
Stored precision FP32 weights, residuals FP32 BF16 weights, residuals FP32

SGLang 0.5.10 registers no native implementation for MambaForCausalLM (no EntryClass in sglang/srt/models), so only the generic TransformersForCausalLM fallback exists, which does not shard the model across tensor-parallel ranks. Serving evidence for this repository is the Transformers example.

File path Size
model.safetensors 13.8MB

Example usage

Transformers (βœ… verified)

def run_transformers(model_id: str):
    # Force Transformers' built-in reference scan/conv kernels: the tiny
    # inner widths trip the external causal_conv1d alignment checks. Block the
    # packages before importing transformers (its kernel fallback decorator
    # probes them through importlib at import time).
    import importlib.abc
    import sys

    class _BlockSSM(importlib.abc.MetaPathFinder):
        def find_spec(self, fullname, path=None, target=None):
            if fullname == "mamba_ssm" or fullname.startswith("mamba_ssm.") or fullname.startswith("causal_conv1d"):
                raise ModuleNotFoundError(f"blocked {fullname} for reference kernels")
            return None

    sys.meta_path.insert(0, _BlockSSM())
    sys.modules.pop("mamba_ssm", None)
    sys.modules.pop("causal_conv1d", None)

    import torch
    from transformers import AutoModelForCausalLM, AutoTokenizer

    model_id = str(model_id)
    tokenizer = AutoTokenizer.from_pretrained(model_id)
    model = (
        AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, attn_implementation="eager").eval().cuda()
    )
    inputs = tokenizer("The quick brown fox jumps over the lazy dog.", return_tensors="pt").to("cuda")
    with torch.no_grad():
        assert torch.isfinite(model(**inputs).logits).all()
        output = model.generate(**inputs, do_sample=False, max_new_tokens=8)
    print(tokenizer.decode(output[0], skip_special_tokens=True))


if __name__ == "__main__":
    run_transformers(model_id="tiny-random/mamba")

Creating this repo

Change log

  • 2026-11-07: Initial version rebuilt from the official state-spaces/mamba-2.8b-hf source with four selective-state-space layers.

This repo is generated by GPT-6.1-Sol.

Downloads last month
120
Safetensors
Model size
6.9M params
Tensor type
BF16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for tiny-random/mamba

Finetuned
(9)
this model

Collection including tiny-random/mamba