Instructions to use 42ailab/OLMo3-190M-zh with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use 42ailab/OLMo3-190M-zh with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="42ailab/OLMo3-190M-zh") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("42ailab/OLMo3-190M-zh") model = AutoModelForCausalLM.from_pretrained("42ailab/OLMo3-190M-zh") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use 42ailab/OLMo3-190M-zh with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "42ailab/OLMo3-190M-zh" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "42ailab/OLMo3-190M-zh", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/42ailab/OLMo3-190M-zh
- SGLang
How to use 42ailab/OLMo3-190M-zh 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 "42ailab/OLMo3-190M-zh" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "42ailab/OLMo3-190M-zh", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "42ailab/OLMo3-190M-zh" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "42ailab/OLMo3-190M-zh", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use 42ailab/OLMo3-190M-zh with Docker Model Runner:
docker model run hf.co/42ailab/OLMo3-190M-zh
OLMo3-190M-zh (v3, base)
从零训练的 190M 中文 base 模型,OLMo3 canonical 架构。活水 42ailab 出品,配套《零基础 AI 大模型研发训练营》L04 预训练讲。
用法
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("42ailab/OLMo3-190M-zh")
model = AutoModelForCausalLM.from_pretrained("42ailab/OLMo3-190M-zh")
训练
- 架构:OLMo3-190M(d=768, L=12, ffn=3072, QK-Norm, SWA=4096)
- Tokenizer:48k 中文 BPE(自训)
- 数据:Ultra-FineWeb-zh + Fineweb-Edu-Chinese V2.1(合计 3.4B tokens)
- 训练:Modal H100,14500 steps × 262K tokens/step,cosine 5e-4 → 5e-5
- Final mean train loss: 3.953
7-prompt 抽测(v3 基线)
| Prompt | 结果 |
|---|---|
| 人工智能是 | 🟢 流畅科普 |
| 山里有座庙 | 🟡 主题漂移 |
| 今天天气不错,我准备 | 🟡 漂移 |
| 北京大学位于 | 🔴 "江苏省"(错) |
| 四大发明是 | 🔴 "铜管/铁器/铜锤/铜镐"(全错) |
| 《红楼梦》人物 | 🟡 对错混杂 |
| Python 是一种 | 🔴 "开源库"(错) |
合计 1 绿 / 3 黄 / 3 红 — 这是 base 的状态。改进版见 42ailab/OLMo3-190M-zh-v3.1(continue pretrain 后"北大在北京"/"Python 是编程语言"等改善)。
关系
v3 (本 repo) ──continue pretrain──▶ v3.1 (42ailab/OLMo3-190M-zh-v3.1)
License
- 权重 Apache-2.0
- 训练数据主要 Apache-2.0;不含 Wikipedia(v3.1 才引入 wiki)
Citation
@misc{huoshui-olmo3-190m-zh,
title={OLMo3-190M-zh: Chinese Pretrain Teaching Model},
author={活水 AI 实验室 (42ailab) and 阳志平},
year={2026},
howpublished={\url{https://huggingface.co/42ailab/OLMo3-190M-zh}},
note={LLM001 Course, Lecture 04}
}
- Downloads last month
- 6