Instructions to use tegancao/owt-45m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tegancao/owt-45m with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tegancao/owt-45m")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tegancao/owt-45m") model = AutoModelForCausalLM.from_pretrained("tegancao/owt-45m", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tegancao/owt-45m with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tegancao/owt-45m" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tegancao/owt-45m", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/tegancao/owt-45m
- SGLang
How to use tegancao/owt-45m 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 "tegancao/owt-45m" \ --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": "tegancao/owt-45m", "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 "tegancao/owt-45m" \ --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": "tegancao/owt-45m", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use tegancao/owt-45m with Docker Model Runner:
docker model run hf.co/tegancao/owt-45m
OpenWebText 45M
A 45.2M parameter language model trained from scratch on a sample of OpenWebText (web pages linked from Reddit; a 2.7B-token sample), as a learning project. It is a small educational model: useful for learning how language models work and for quick experiments, not for any real application. Its text has the style of news and web articles, but not reliable content.
How to use
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("tegancao/owt-45m")
model = AutoModelForCausalLM.from_pretrained("tegancao/owt-45m")
torch.manual_seed(0)
ids = tok("<|endoftext|>" + "The new study shows", return_tensors="pt").input_ids # start like a new document
out = model.generate(ids, max_new_tokens=100, do_sample=True, temperature=0.8, top_p=0.9)
print(tok.decode(out[0, 1:], skip_special_tokens=True))
Sample output (the code above, as is):
The new study shows that people with mental health disorders are more likely to be treated with mental health conditions.
The study, published in the journal PLoS ONE in New York, found that just 3% of people with mental health issues, compared with 7% of people with mental health, had symptoms of alcoholism, which is nearly the same as those with mental health problems.
The study showed that mental health issues were more likely to be related to physical health than mental health problems.
The
It is a base model: it continues text and does not follow instructions or answer questions. Prompts that look like the start of its training documents work best.
Training
| Training data | a sample of OpenWebText (web pages linked from Reddit; a 2.7B-token sample) |
| Tokenizer | byte-level BPE trained on the same data, 32,000-token vocabulary, GPT-2 pre-tokenization pattern; `< |
| Architecture | Llama-style decoder: 4 layers, d_model 512, 16 heads (head dim 32), SwiGLU FFN (d_ff 1344), RMSNorm (pre-norm), RoPE (θ = 10,000), no biases, untied input/output embeddings |
| Context length | 256 tokens |
| Optimizer | AdamW (β₁ 0.9, β₂ 0.95, ε 1e-8, weight decay 0.1), gradient clipping at 1.0 |
| Learning rate | 3e-3 peak, 1,000 linear warm-up steps, cosine decay to 3e-4 |
| Batch | 32 sequences × 256 tokens = 8,192 tokens per step |
| Steps / tokens | 40,000 steps = 327.68M tokens |
| Precision / hardware | float32, one NVIDIA L4 GPU |
| Training time | ~4.5 hours |
The model was implemented and trained with my own from-scratch PyTorch code, then converted to the standard
LlamaForCausalLM format (RoPE pairs reordered in the Q/K projections). The conversion was verified: the converted
model's logits match the original within ~2 × 10⁻⁵, greedy generations are identical, and the tokenizer produces
identical token ids on 2 MB of validation text.
Evaluation
| Metric | Value |
|---|---|
| Validation loss (cross-entropy, nats per token) | 4.154 |
| Validation perplexity | 63.7 |
Measured on held-out validation text at the end of training, averaged over 20 random batches (about 164K tokens). The model saw about 12% of its training data (one partial pass over a 2.7B-token sample).
Evaluation and experiments
In a benchmark comparison with the TinyStories models, Pythia and GPT-2, this model scores 73.8% on the BLiMP grammar test, the same as Pythia-70M (trained on ~1,000× more tokens), while staying near chance on most reasoning benchmarks.
- Benchmark evaluation: 8 benchmarks, 11 models, scaling plots
- Token embeddings: what the embeddings learned, and why output embeddings look alike
- Chat demo: talk to the model, with real example sessions and limitations
Intended use
- Learning how language models work: inspecting a small model, experimenting with sampling (temperature, top-p), seeing how training data shapes behavior.
- Fast experiments that need a tiny model: decoding methods, interpretability, testing inference code.
- Demos of what a model trained from scratch on a small budget can and cannot do.
Out of scope
- Any factual use: the model makes things up.
- Anything user-facing or in production: there is no instruction tuning and no safety tuning.
- Decisions about people, or any application where mistakes matter.
Limitations
- Continues text instead of answering it (base model, no instruction tuning).
- Loose logic and weak tracking of who is who over longer passages; falls into repetition loops, especially with greedy decoding.
- Sees at most the last 256 tokens.
- Generates convincing-looking but false text: invented quotes attributed to real people and organizations, made-up studies and statistics (like the "PLoS ONE" study in the sample above). Never treat its output as fact.
- Trained on unfiltered web text, so it may produce biased or offensive content.
- Much of its parameter count is vocabulary: the 32K-token embedding and output layers hold 32.8M of the 45.2M parameters; the 4 Transformer blocks are the same 12.5M as in the TinyStories model.
Acknowledgments
The architecture and training setup follow the publicly available materials of Stanford CS336 (Language Modeling from Scratch). Training data: a sample of OpenWebText (web pages linked from Reddit; a 2.7B-token sample). Please see the dataset's own card for its license and terms.
- Downloads last month
- 52