Instructions to use tiny-random/hymba with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tiny-random/hymba with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tiny-random/hymba", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("tiny-random/hymba", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tiny-random/hymba with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tiny-random/hymba" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiny-random/hymba", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tiny-random/hymba
- SGLang
How to use tiny-random/hymba with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "tiny-random/hymba" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiny-random/hymba", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "tiny-random/hymba" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiny-random/hymba", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tiny-random/hymba with Docker Model Runner:
docker model run hf.co/tiny-random/hymba
This is a randomly initialized tiny model based on nvidia/Hymba-1.5B-Instruct for testing and debugging.
| Feature | Source | This repo |
|---|---|---|
| Checkpoint tensor elements | 1.52B BF16 | 5.33M BF16, 16.38K F32 |
| Safetensors weight files | 3.05 GB (model.safetensors) | 10.74 MB (model.safetensors) |
| Layers | 32, each a fused SSM + attention hybrid | 4, same fused hybrid |
| Residual width / MLP width | 1,600 / 5,504 | 128 / 440 |
| Q heads / KV heads / KQ head_dim / V head_dim | 25 / 5 / 64 / 128 | 4 / 1 / 32 / 64 |
| SSM state / expand / conv kernel | 16 / 2 / 4 | Same |
| KV-reuse groups | 15 producer/consumer pairs | [0,1] and [2,3] |
| Global / sliding attention | layers 0,15,31 global; 1024 window | layers 0,3 global; same window |
| Memory tokens | 128 | Same |
| Vocabulary rows / embedding tying | 32,001 / tied | Same |
| Stored precision | BF16 | Same |
Transformers has no Hymba implementation, so the pinned NVIDIA remote code is included (load with trust_remote_code=True); it uses SDPA instead of the source flex-attention default. The fused selective-scan path requires mamba_ssm and causal-conv1d on CUDA. Its custom KV/SSM cache (with 128 interspersed memory tokens) predates the Transformers 5.x Cache API, so the example runs generation with use_cache=False (full recomputation); cached decoding is not claimed.
SGLang 0.5.10 registers no native implementation for HymbaForCausalLM (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 | 10.7MB |
Example usage
Transformers (β verified)
Load the included pinned Hymba implementation with trust_remote_code=True. The pinned custom hybrid KV/SSM cache predates the Transformers 5.x Cache API and interacts with the 128 memory tokens, so generation runs with use_cache=False (full recomputation); forward and cache-free generation are verified.
def run_transformers(model_id: str):
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = str(model_id)
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = (
AutoModelForCausalLM.from_pretrained(
model_id, trust_remote_code=True, dtype=torch.bfloat16, attn_implementation="sdpa"
)
.eval()
.cuda()
)
prompt = tokenizer.apply_chat_template(
[{"role": "user", "content": "Tell me a joke."}],
tokenize=False,
add_generation_prompt=True,
)
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
with torch.no_grad():
assert torch.isfinite(model(**inputs, use_cache=False).logits).all()
output = model.generate(**inputs, do_sample=False, max_new_tokens=8, use_cache=False)
print(tokenizer.decode(output[0], skip_special_tokens=True))
if __name__ == "__main__":
run_transformers(model_id="tiny-random/hymba")
Creating this repo
- Code: .meta/create_model.py
- Model structure: .meta/model.log
- Environment: .meta/env.json
Change log
- 2026-11-07: Initial version rebuilt from the official nvidia/Hymba-1.5B-Instruct source with four hybrid Mamba/attention layers, KV-reuse pairs and global/sliding attention.
This repo is generated by GPT-6.1-Sol.
- Downloads last month
- 122