Instructions to use MedcellStudios/OLM3Nano with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MedcellStudios/OLM3Nano with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MedcellStudios/OLM3Nano", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("MedcellStudios/OLM3Nano", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MedcellStudios/OLM3Nano with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MedcellStudios/OLM3Nano" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MedcellStudios/OLM3Nano", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/MedcellStudios/OLM3Nano
- SGLang
How to use MedcellStudios/OLM3Nano 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 "MedcellStudios/OLM3Nano" \ --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": "MedcellStudios/OLM3Nano", "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 "MedcellStudios/OLM3Nano" \ --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": "MedcellStudios/OLM3Nano", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use MedcellStudios/OLM3Nano with Docker Model Runner:
docker model run hf.co/MedcellStudios/OLM3Nano
File size: 3,043 Bytes
ee61f98 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | ---
license: apache-2.0
language:
- en
library_name: transformers
datasets:
- HuggingFaceFW/fineweb
tags:
- text-generation
- causal-lm
- custom-code
pipeline_tag: text-generation
---
# OLM3 Nano
OLM3 Nano is a small (~1B parameter) decoder-only causal language model, trained from scratch on the [FineWeb](https://huggingface.co/datasets/HuggingFaceFW/fineweb) corpus.
## Model details
| | |
|---|---|
| Architecture | Decoder-only Transformer with RoPE positional embeddings |
| Parameters | ~1.02B |
| Hidden size | 2048 |
| Layers | 16 |
| Attention heads | 16 |
| Vocabulary size | 50304 |
| Max context length | 2048 tokens |
| Positional encoding | Rotary (RoPE), θ = 10000 |
| Normalization | RMSNorm |
| Weight tying | Input embeddings and output (LM head) are tied |
| Training data | FineWeb |
| Checkpoint step | 14086 |
## Tokenizer
This model was trained with the **GPT-2 tokenizer** (as used by [`tiktoken`](https://github.com/openai/tiktoken)'s `"gpt2"` encoding). Use `GPT2TokenizerFast` / `AutoTokenizer` from this repo, or `tiktoken.get_encoding("gpt2")` directly.
## Usage
This model uses custom modeling code, so `trust_remote_code=True` is required.
```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "MedcellStudios/OLM3Nano"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
trust_remote_code=True,
dtype=torch.float32,
).to("cuda")
model.eval()
prompt = "Hello! How are you?"
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to("cuda")
with torch.no_grad():
output = model.generate(
input_ids,
max_new_tokens=80,
do_sample=True,
temperature=0.8,
top_k=40,
repetition_penalty=1.2,
no_repeat_ngram_size=3,
eos_token_id=tokenizer.eos_token_id,
pad_token_id=tokenizer.eos_token_id,
)
print(tokenizer.decode(output[0, input_ids.shape[1]:], skip_special_tokens=True))
```
## Intended use and limitations
OLM3 Nano is a small research/hobby-scale language model. It is **not instruction-tuned or aligned**, and its outputs should not be treated as factual, safe, or suitable for production use without further fine-tuning and evaluation. Given its small parameter count and training scale, expect frequent repetition, factual errors, and limited reasoning ability compared to larger models.
### Known issue: over-memorized personality section
After training and deploying this model on our website, we noticed that the model had **over-memorized the personality section of its SFT data**. As a result, some responses can be inconsistent — the model may repeat fixed personality-related phrasing verbatim rather than generating a natural, context-appropriate reply. We're aware of this and plan to address it in a future fine-tuning pass with more varied personality examples; in the meantime, treat personality-flavored outputs with some skepticism.
## License
Apache 2.0. |