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
|
Download README.md from Compactbot/storylm-10m: direct link, hf CLI and curl.
- Browser
- Download file 1.5 kB
-
https://huggingface.co/Compactbot/storylm-10m/resolve/main/README.md
- Command line
-
hf download hf://Compactbot/storylm-10m/README.md
-
curl -L -o README.md https://huggingface.co/Compactbot/storylm-10m/resolve/main/README.md
1.5 kB
| language: en | |
| license: apache-2.0 | |
| tags: | |
| - tiny | |
| - slm | |
| - small-language-model | |
| - from-scratch | |
| - llama | |
| - rope | |
| - swiglu | |
| - rmsnorm | |
| - text-generation | |
| - tinystories | |
| pipeline_tag: text-generation | |
| library_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 little | |
| Output: Once upon a time, there was a little | |
| Prompt: The cat sat on the | |
| Output: The cat sat on the | |
| Prompt: In the beginning, the world was | |
| Output: In the beginning, the world was | |
| Prompt: A small robot named | |
| Output: A small ro bot named | |
| Prompt: Every morning, the sun | |
| Output: 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`). |