Instructions to use Nwna/olmo3-190m-zh-v2-continue with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Nwna/olmo3-190m-zh-v2-continue with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Nwna/olmo3-190m-zh-v2-continue") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Nwna/olmo3-190m-zh-v2-continue") model = AutoModelForCausalLM.from_pretrained("Nwna/olmo3-190m-zh-v2-continue") 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
- vLLM
How to use Nwna/olmo3-190m-zh-v2-continue with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Nwna/olmo3-190m-zh-v2-continue" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Nwna/olmo3-190m-zh-v2-continue", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Nwna/olmo3-190m-zh-v2-continue
- SGLang
How to use Nwna/olmo3-190m-zh-v2-continue 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 "Nwna/olmo3-190m-zh-v2-continue" \ --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": "Nwna/olmo3-190m-zh-v2-continue", "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 "Nwna/olmo3-190m-zh-v2-continue" \ --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": "Nwna/olmo3-190m-zh-v2-continue", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Nwna/olmo3-190m-zh-v2-continue with Docker Model Runner:
docker model run hf.co/Nwna/olmo3-190m-zh-v2-continue
OLMo3-190M-zh-v2-continue
中文 continue-pretrain 教学模型,基于 Nwna/olmo3-190m-zh-v2-base,继续注入 Wikipedia-zh + Cosmopedia-Chinese + base replay 组成的 1.194B tokens 中文语料。
这是《零基础 AI 大模型研发训练营》第 04 讲进阶作业模型。它是 continue-pretrained base model,不是 instruction/chat model。
来源与动机
本模型的目标是验证 continue pretrain / mid-training 的工业范式:在已有 base model 上继续训练较小规模但更高事实密度、更强解释风格的数据,以较低成本改变模型的数据分布和表达风格。
本次实验特别关注:
1. 是否能从 base checkpoint 正确继续训练,而不是重新随机初始化。
2. tokenizer 是否和 base 模型严格一致。
3. Wiki / Cosmopedia 是否能提升事实密度和解释型表达。
4. continue pretrain 是否能替代 SFT。
结论简述:
- ✅ 训练链路健康,loss 从 smoke 阶段约 3.42 降到 full final 约 3.04。
- ✅ Continue 模型更容易生成教材式、百科式长段落。
- ⚠️ 事实问答仍不可靠,例如“北京大学位于”“四大发明是”仍可能答错。
- ⚠️ 该模型不能替代 SFT;后续仍需要监督微调来学习问答格式和事实表达。
架构
与 Nwna/olmo3-190m-zh-v2-base 相同:
| 字段 | 值 |
|---|---|
architectures |
["Olmo3ForCausalLM"] |
hidden_size |
768 |
num_hidden_layers |
12 |
num_attention_heads |
12 |
intermediate_size |
3072 |
vocab_size |
48,000 |
max_position_embeddings |
4096 |
| training seq_len | 2048 |
| total params | ~187M |
使用
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("Nwna/olmo3-190m-zh-v2-continue")
model = AutoModelForCausalLM.from_pretrained("Nwna/olmo3-190m-zh-v2-continue")
inputs = tok("人工智能是", return_tensors="pt")
outputs = model.generate(
**inputs,
max_new_tokens=120,
do_sample=True,
temperature=0.8,
top_p=0.9,
)
print(tok.decode(outputs[0], skip_special_tokens=True))
用于 SFT
v2-continue 是 continue-pretrained base model。它可以作为后续 SFT 底座:
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("Nwna/olmo3-190m-zh-v2-continue")
# ... 用 SFTTrainer / 自定义 Trainer 做监督微调
训练配方
数据混合(1.194B tokens)
| 数据源 | 来源 | tokens | 作用 |
|---|---|---|---|
| base replay | base raw 抽样 | 300M | 防止灾难性遗忘,保留通用中文能力 |
| Wikipedia-zh | wikimedia/wikipedia config 20231101.zh |
394M | 注入实体、地点、历史、文学等百科事实 |
| Cosmopedia-Chinese | opencsg/chinese-cosmopedia |
500M | 注入解释型、教材型、知识组织文本 |
| 合计 | - | 1.194B | continue pretrain full data |
所有 continue 数据都使用 Nwna/olmo3-190m-zh-v2-tokenizer 重新编码,没有直接复用其他模型或数据集中的 tokenized .bin。这是必须条件:token id 的语义由 tokenizer 决定,混用 tokenizer 会导致 embedding / lm_head 语义错位。
数据健康检查
actual_tokens: 1,194,000,000
documents: 1,203,778
file_size_bytes: 2,388,000,000
max_token_id: 47,999
eos_token_id: 0
avg_traditional_probe_ratio: 0.000508
noise_pattern_hit: false
定向抽查覆盖了 北京大学、四大发明、造纸术、印刷术、火药、指南针、红楼梦、贾宝玉、林黛玉、Python、人工智能 等关键词。抽查只能证明语料中有覆盖,不能保证模型一定稳定回答。
超参
| 项目 | 值 |
|---|---|
| base checkpoint | Nwna/olmo3-190m-zh-v2-base |
| GPU | H100 |
| precision | bf16 |
| attention | SDPA |
| epochs | 1.0 |
| total steps | 4,328 |
| per-device batch | 16 |
| grad accumulation | 8 |
| effective batch | 128 sequences |
| tokens / step | 262,144 |
| peak lr | 2e-4 |
| min lr | 2e-5 |
| warmup ratio | 10% |
| scheduler | warmup + cosine |
| optimizer | AdamW |
| weight decay | 0.1,embedding / norm / bias excluded |
为什么学习率低于 base:continue 阶段模型已有中文语言建模能力,过大学习率容易破坏已有能力;因此使用更低 peak lr 和更长 warmup,使模型更平滑地适应新分布。
Loss 轨迹
20-step smoke
| steps | train_loss | eval_loss | GPU |
|---|---|---|---|
| 20 | 3.4235 | 3.3283 | A100-80G |
A100 40G 在同样 batch 配置下 OOM;A100-80G 可跑通;正式 full 使用 H100。
Full 1 epoch
| metric | value |
|---|---|
| total steps | 4,328 |
| train_runtime | 8,964.52s |
| train_steps_per_second | 0.483 |
| train_loss | 3.0431 |
| last_eval_loss | 2.9404 |
| final learning_rate | 2.0002e-05 |
| final grad_norm | 0.2779 |
Base → Continue 7-prompt 抽测
使用 src/eval.py 的采样生成设置:
max_new_tokens=120
do_sample=True
temperature=0.8
top_p=0.9
repetition_penalty=1.1
| Prompt | Base | Continue | 变化 |
|---|---|---|---|
| 人工智能是 | 🟡 可生成科普,但较泛 | 🟡 更像教材式分领域展开 | 风格增强 |
| 山里有座庙 | 🟡 偏文物/寺庙说明 | 🟡 更像故事长叙事 | 续写更长,但仍虚构 |
| 今天天气不错,我准备 | 🟡 对话关系混乱 | 🟡 叙事更完整但漂移到奇幻故事 | 表达增强,控制仍弱 |
| 北京大学位于 | 🔴 答错地点 | 🔴 仍答错地点 | 未解决事实问答 |
| 四大发明是 | 🔴 错到电力设备列表 | 🔴 错到科学史人物 | 未解决事实问答 |
| 《红楼梦》人物 | 🔴 标题式重复 | 🔴 输出过短,未答人物 | 未解决文学知识 |
| Python 是一种 | 🟡 知道与编程相关但定义混乱 | 🟡 更像解释型文本,但仍不准确 | 小幅改善 |
关键 takeaways:
- ✅ Continue pretrain 改变了表达风格,模型更容易生成解释型、教材型文本。
- ⚠️ Continue pretrain 没有把模型变成可靠问答模型。
- ⚠️ 事实问答、格式控制和重复控制应交给后续 SFT。
限制
- 事实记忆上限:190M 参数规模较小,即使语料中包含事实,也不保证稳定召回。
- 未做 SFT:该模型不是 chat model,不会稳定遵循指令。
- 采样评估会波动:
do_sample=True时,同一 prompt 多次生成可能不同。 - Wiki / 网页格式风险:尽管已清洗,仍可能出现标题腔、列表腔或重复。
- in-domain eval 不能等同通用能力:continue eval loss 在 continue 数据分布上更低,不能直接代表所有下游任务变好。
License
- 模型权重:Apache-2.0
- 训练数据:混合 license
- base replay 来自 base 阶段中文网页/教育数据
- Cosmopedia-Chinese:请参考原数据集许可
- Wikipedia-zh:含 CC-BY-SA-3.0 + GFDL 许可风险,商用前请咨询法律
权重声明为 Apache-2.0,但训练数据含 Wikipedia-zh,使用者应自行评估 share-alike 数据对下游使用的影响。
配套资源
- Base model: https://huggingface.co/Nwna/olmo3-190m-zh-v2-base
- Tokenizer: https://huggingface.co/Nwna/olmo3-190m-zh-v2-tokenizer
- Continue data card: https://huggingface.co/datasets/Nwna/olmo3-190m-zh-v2-continue-data
- Space demo: https://huggingface.co/spaces/Nwna/olmo3-190m-zh-v2-continue
- 作业报告:
ch04(下)进阶作业:持续预训练_v2.md
Citation
@misc{nwna-olmo3-190m-zh-v2-continue,
title={OLMo3-190M-zh-v2-continue: Chinese Continue-Pretrained Teaching Model},
author={Nwna},
year={2026},
howpublished={\url{https://huggingface.co/Nwna/olmo3-190m-zh-v2-continue}},
note={LLM001 Course, Lecture 04 advanced homework}
}
- Downloads last month
- 135