Instructions to use tiny-random/mpt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tiny-random/mpt with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tiny-random/mpt", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tiny-random/mpt", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("tiny-random/mpt", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tiny-random/mpt with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tiny-random/mpt" # 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/mpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/tiny-random/mpt
- SGLang
How to use tiny-random/mpt 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/mpt" \ --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/mpt", "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/mpt" \ --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/mpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use tiny-random/mpt with Docker Model Runner:
docker model run hf.co/tiny-random/mpt
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/mpt" \
--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/mpt",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'This is a randomly initialized tiny model based on RedHatAI/mpt-7b-gsm8k-pt for testing and debugging.
| Feature | Source | This repo |
|---|---|---|
| Parameters | 6.73B | 13.70M |
| Weight files | 3 pytorch_model .bin shards, 27.42GB (BF16; source ships no safetensors) | 27.40 MB (model.safetensors) |
| Layers | 32 | 4 |
| Hidden width / FFN width (4x) | 4,096 / 16,384 | 128 / 512 |
| Attention heads / head_dim | 32 / 128 | 4 / 32 |
| Position encoding | learned embeddings | Same, length 1,024 |
| Norm / bias layout | low-precision LayerNorm, no biases | Same |
| Vocabulary rows / embedding tying | 50,432 / tied (SharedEmbedding) | Same |
| Stored precision | BF16 | Same |
Transformers has not registered this MPT revision, so the pinned upstream remote code is included with attn_impl='torch'; load with trust_remote_code=True.
SGLang 0.5.10 registers no native implementation for MPTForCausalLM (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 | 27.4MB |
Example usage
Transformers (β verified)
Load the included pinned MPT 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, 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/mpt")
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 RedHatAI/mpt-7b-gsm8k-pt source (the Red Hat AI migration of mosaicml/mpt-7b), shipping its pinned remote code with the pure-torch attention path.
This repo is generated by GPT-6.1-Sol.
- Downloads last month
- 112
Model tree for tiny-random/mpt
Base model
RedHatAI/mpt-7b-gsm8k-pt
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/mpt" \ --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/mpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'