How to use from
vLLM
Install from pip and serve model
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "tiny-random/mamba2"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
	-H "Content-Type: application/json" \
	--data '{
		"model": "tiny-random/mamba2",
		"prompt": "Once upon a time,",
		"max_tokens": 512,
		"temperature": 0.5
	}'
Use Docker
docker model run hf.co/tiny-random/mamba2
Quick Links

Configuration Parsing Warning:Invalid JSON for config file config.json

This is a randomly initialized tiny model based on mistralai/Mamba-Codestral-7B-v0.1 for testing and debugging.

Feature Source This repo
Checkpoint tensor elements 7.29B BF16 9.34M BF16
Safetensors weight files 14.57 GB (3 files) 18.67 MB (model.safetensors)
Layers 64 4
Hidden width / inner width (2x) 4,096 / 8,192 128 / 256
Mamba2 heads / groups / head_dim 128 / 8 / 64 4 / 4 / 64
SSM state size / chunk size 128 / 256 Same
Time-step rank 256 8 (divides head count)
Vocabulary rows / embedding tying 32,768 / untied Same
Stored precision BF16, residuals FP32 Same

SGLang 0.5.10 registers no native implementation for Mamba2ForCausalLM (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 18.7MB

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("def fibonacci(n):", 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/mamba2")

Creating this repo

Change log

  • 2026-11-07: Initial version rebuilt from the official mistralai/Mamba-Codestral-7B-v0.1 source with four Mamba2 layers.

This repo is generated by GPT-6.1-Sol.

Downloads last month
120
Safetensors
Model size
9.34M 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/mamba2

Finetuned
(8)
this model

Collection including tiny-random/mamba2