Text Generation
Transformers
English
storylm
tiny
slm
small-language-model
from-scratch
llama
rope
swiglu
rmsnorm
tinystories
Instructions to use Compactbot/storylm-10m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Compactbot/storylm-10m with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Compactbot/storylm-10m")# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Compactbot/storylm-10m", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Compactbot/storylm-10m with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Compactbot/storylm-10m" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Compactbot/storylm-10m", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Compactbot/storylm-10m
- SGLang
How to use Compactbot/storylm-10m 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 "Compactbot/storylm-10m" \ --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": "Compactbot/storylm-10m", "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 "Compactbot/storylm-10m" \ --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": "Compactbot/storylm-10m", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Compactbot/storylm-10m with Docker Model Runner:
docker model run hf.co/Compactbot/storylm-10m
Add StoryLM-10M model card
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869---language: enlicense: apache-2.0tags: - tiny - slm - small-language-model - from-scratch - llama - rope - swiglu - rmsnorm - text-generation - tinystoriespipeline_tag: text-generationlibrary_name: transformers---
# StoryLM-10M
A ~12.6M parameter LLaMA-style causal language model trained from scratch on TinyStories.
## Architecture
| Parameter | Value ||-----------|-------|| d_model | 256 || n_heads | 8 (MHA) || n_kv_heads | 8 || n_layers | 8 || head_dim | 32 || FFN dim | 1024 (SwiGLU, 4x) || Vocab size | 8192 || Context length | 512 || Tied embeddings | Yes || Total params | 12,603,648 |
## Training
- **Data**: TinyStories (2,119,719 stories, 533.7M tokens)- **Steps**: 24,400 (batch 4, seq 512)- **Optimizer**: AdamW, LR 3e-4, cosine schedule, 500-step warmup- **Best val loss**: 1.8635- **Val perplexity**: 6.45
## Generation Samples
```Prompt: Once upon a time, there was a littleOutput: Once upon a time, there was a little
Prompt: The cat sat on theOutput: The cat sat on the
Prompt: In the beginning, the world wasOutput: In the beginning, the world was
Prompt: A small robot namedOutput: A small ro bot named
Prompt: Every morning, the sunOutput: Every morning, the sun```
## Notes
- Trained on a single RTX 5090 (32 GB) in ~281 seconds of training time.- The model is a custom implementation (not HuggingFace transformers-compatible out of the box).- Weights are stored as a single PyTorch checkpoint (`model.pt`).README.mdAdded+69