Instructions to use tiny-random/grok-1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tiny-random/grok-1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tiny-random/grok-1", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("tiny-random/grok-1", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tiny-random/grok-1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tiny-random/grok-1" # 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/grok-1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/tiny-random/grok-1
- SGLang
How to use tiny-random/grok-1 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/grok-1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiny-random/grok-1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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/grok-1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiny-random/grok-1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use tiny-random/grok-1 with Docker Model Runner:
docker model run hf.co/tiny-random/grok-1
This is a randomly initialized tiny model based on hpcai-tech/grok-1 for testing and debugging.
| Feature | Source | This repo |
|---|---|---|
| Parameters | 316.5B (65 BF16 .bin shards, 632.99GB; source ships no safetensors) | 10.01M |
| Weight files | 65 pytorch_model .bin shards, 632.99GB | 20.04 MB (model.safetensors) |
| Layers | 64, all MoE | 4, all MoE |
| Residual width / FFN width | 6,144 / 32,768 | 64 / 256 |
| Q heads / KV heads / head_dim | 48 / 8 (GQA 6:1) / 128 | 2 / 1 (GQA 2:1) / 32 |
| Experts / top-k | 8 / 2 | Same |
| Attention | tanh-capped logits, custom scale constants | Same |
| Vocabulary rows / embedding tying | 131,072 / tied | Same |
| Stored precision | BF16 | Same |
Transformers has no Grok-1 implementation, so the pinned upstream remote code is included. It predates Transformers 5.x and ships targeted compatibility shims: an empty all_tied_weights_keys map and a bridge between its tuple KV cache and the modern DynamicCache, so cached generation works. Load with trust_remote_code=True.
SGLang 0.5.10 has a native Grok1 implementation, but it cannot serve this checkpoint: at TP>1 it loads grok-1's pre-sharded weight files (*-{rank:03d}.bin or *-TP-{rank:03d}.safetensors), and at TP=1 the KV pool rejects the qkv layout (view size is not compatible with input tensor's size and stride in memory_pool.set_kv_buffer). The two query heads also cap TP at 2. Serving evidence for this repository is the Transformers example.
| File path | Size |
|---|---|
| model.safetensors | 20.0MB |
Example usage
Transformers (β verified)
Load the included pinned Grok-1 implementation with trust_remote_code=True.
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="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/grok-1")
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 hpcai-tech/grok-1 source, shipping its pinned remote code with Transformers 5.x DynamicCache compatibility.
This repo is generated by GPT-6.1-Sol.
- Downloads last month
- -
Model tree for tiny-random/grok-1
Base model
hpcai-tech/grok-1