本文档记录 allenai/OLMo-2-0425-1B 模型在 vLLM-Ascend 环境的快速部署与验证结果。
OLMo-2-0425-1B 是 Allen AI 开发的 10 亿参数基础语言模型,基于 OLMo2 架构,适用于文本生成和自然语言理解任务。
相关获取地址:
| 组件 | 版本 |
|---|---|
vllm-ascend | 0.18.0rc1 |
vllm | 0.18.0 |
transformers | 4.57.6 |
torch-npu | 2.9.0 |
CANN | 8.5.1 |
SOC | ascend910_9391 |
1 逻辑卡(Ascend 910B2,64GB HBM)/home/openmind/.cache/modelscope/hub/models/allenai/OLMo-2-0425-1B| 参数 | 值 |
|---|---|
| 架构 | Olmo2ForCausalLM |
| 参数量 | 1B |
| 层数 | 16 |
| 隐藏维度 | 2048 |
| 注意力头数 | 16 |
| 词表大小 | 100352 |
| 精度 | Float16(vLLM 推理) |
# 从 ModelScope 下载
modelscope download --model allenai/OLMo-2-0425-1B使用 vLLM-Ascend 加载模型进行推理:
from vllm import LLM, SamplingParams
MODEL_PATH = "allenai/OLMo-2-0425-1B"
llm = LLM(
model=MODEL_PATH,
trust_remote_code=True,
dtype="float16",
tensor_parallel_size=1,
max_model_len=2048,
gpu_memory_utilization=0.9,
)
sampling = SamplingParams(max_tokens=64, temperature=0)
outputs = llm.generate(["The capital of France is"], sampling)
print(outputs[0].outputs[0].text)
# Paris. The French language is spoken in France.运行 4 项冒烟测试验证模型功能:
python3 smoke_test.py=== OLMo-2-0425-1B vLLM-Ascend Smoke Test ===
[1/4] Testing basic generation...
PASS: Paris. The French language is spoken in France. The French people are known as t
[2/4] Testing factual knowledge...
PASS: The answer is 4. This is the final answer.
[3/4] Testing batch generation...
[1] Jupiter, which is 318 times the mass of Earth. Jupiter is th...
[2] The ocean is a large body of salt water.
[3] The sky is blue because of the way light interacts with the ...
PASS: 3 prompts processed
[4/4] Testing reasoning...
PASS: 3
=== All 4/4 tests PASSED (47.8s) ===验证项说明:
| 测试项 | 输入 | 预期 | 结果 |
|---|---|---|---|
| 英文基础生成 | The capital of France is | 包含 Paris | PASS |
| 事实知识 | What is 2 + 2? | 包含 4 | PASS |
| 批量生成 | 3 个 prompt | 3 条非空输出 | PASS |
| 推理能力 | 数学推理题目 | 包含 3 | PASS |
modelscope/ai2_arcpython3 eval_arc_vllm.py --output logs/arc_challenge_vllm.json| 指标 | 基线 | NPU 结果 | 差异 |
|---|---|---|---|
| ARC-Challenge 25-shot | 50.00% | 49.15% (576/1172) | -0.85% |
ARC-Challenge NPU 准确率为 49.15%,与基线 50.00% 的差异为 -0.85%(< 1%),验证通过。
=== OLMo-2-0425-1B ARC-Challenge 25-shot vLLM-Ascend ===
Total test samples: 1172
Loading model with vLLM-Ascend...
Model loaded.
Generating (1172 samples)...
============================================================
OLMo-2-0425-1B ARC-Challenge 25-shot Results (vLLM-Ascend)
============================================================
Accuracy: 49.15% (576/1172)
Total time: 4s
Throughput: 276.03 samples/s
============================================================
Results saved to logs/arc_challenge_vllm.jsonpython3 benchmark.py| 场景 | 输出 tokens | 吞吐量 | TPOT |
|---|---|---|---|
| 单请求 | 128 | 66.60 tok/s | 15.1 ms/tok |
| 批量 (8 并发) | 512 | 545.31 tok/s | — |
=== OLMo-2-0425-1B vLLM-Ascend Benchmark ===
--- Single prompt (128 tokens) ---
Run 1: 128 tokens, 2.05s, 62.50 tok/s, TPOT 16.0 ms/tok
Run 2: 128 tokens, 1.78s, 71.88 tok/s, TPOT 13.9 ms/tok
Run 3: 128 tokens, 1.86s, 68.88 tok/s, TPOT 14.5 ms/tok
Run 4: 128 tokens, 1.96s, 65.33 tok/s, TPOT 15.3 ms/tok
Run 5: 128 tokens, 1.99s, 64.39 tok/s, TPOT 15.5 ms/tok
Avg: 66.60 tok/s, TPOT 15.1 ms/tok
--- Batch (8 prompts, 64 tokens each) ---
Run 1: 512 tokens, 0.99s, 518.88 tok/s
Run 2: 512 tokens, 0.92s, 555.49 tok/s
Run 3: 512 tokens, 0.91s, 561.56 tok/s
Avg: 545.31 tok/s
==================================================
Single prompt: 66.60 tok/s, TPOT 15.1 ms/tok
Batch (8): 545.31 tok/s
==================================================Base 模型:此为基础模型(非 Instruct 版本),不具备指令跟随能力,评测时使用续写方式生成答案。
显存占用:float16 推理时模型约占用 2.2 GB HBM,单卡即可运行。
推理速度:OLMo-2-0425-1B 为小模型,vLLM-Ascend 单请求推理吞吐量 66.60 tok/s,8 并发批量吞吐量 545.31 tok/s。