m0_66826439/SciCore-Mol
模型介绍文件和版本Pull Requests讨论分析
下载使用量0

SciCore-Mol on vLLM-Ascend 0.18.0rc1

1. 简介

本文档记录 OpenBMB/SciCore-Mol(Qwen3ForCausalLM, ~8B)在 vLLM-Ascend 0.18.0rc1 环境的部署与验证结果。

SciCore-Mol 是 OpenBMB 团队开发的专业分子认知大模型,基于 Qwen3ForCausalLM 架构,专门针对分子科学领域优化。从模型配置看,SciCore-Mol 走 Qwen3ForCausalLM 推理链路,与 vLLM 原生 Qwen3 支持完全兼容,零代码改动即可在昇腾 NPU 上部署。

属性值
模型架构Qwen3ForCausalLM
参数量~8B
权重精度bfloat16
隐藏层维度4096
层数36
注意力头数32
KV 头数8
词汇表大小151,670
最大位置嵌入40,960

相关获取地址:

  • 权重下载地址(ModelScope):https://modelscope.cn/models/OpenBMB/SciCore-Mol
  • 权重下载地址(HuggingFace):https://huggingface.co/OpenBMB/SciCore-Mol
  • Docker Image(vLLM-Ascend 0.18.0rc1):quay.io/ascend/vllm-ascend:v0.18.0rc1

参考文档:

  • https://docs.vllm.ai/projects/ascend/zh-cn/v0.18.0/tutorials/models/Qwen3.html

2. 验证环境

组件版本
vllm-ascend0.18.0rc1
vllm0.18.0+empty
transformers4.57.6
torch-npu2.9.0.post1+gitee7ba04
PyTorch2.9.0+cpu
CANN25.5.2
Python3.11.14

NPU:1 卡 Ascend 910 模型路径:/path/to/OpenBMB/SciCore-Mol 服务端口:8000

3. 服务启动

启动前可先检查端口:

ss -lntp | grep ':8000 ' || true

已验证通过的启动命令:

export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True
export HCCL_OP_EXPANSION_MODE=AIV

python3 -m vllm.entrypoints.openai.api_server \
  --model /path/to/OpenBMB/SciCore-Mol \
  --load-format safetensors \
  --dtype bfloat16 \
  --tensor-parallel-size 1 \
  --max-model-len 8192 \
  --max-num-seqs 16 \
  --enable-prefix-caching \
  --enable-chunked-prefill \
  --port 8000

或使用 vllm serve:

vllm serve /path/to/OpenBMB/SciCore-Mol \
  --load-format safetensors \
  --dtype bfloat16 \
  --tensor-parallel-size 1 \
  --max-model-len 8192 \
  --max-num-seqs 4 \
  --port 8000

4. Smoke 验证

基础检查:

curl -sf http://127.0.0.1:8000/v1/models

文本补全:

curl -sf http://127.0.0.1:8000/v1/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "/path/to/OpenBMB/SciCore-Mol",
    "prompt": "The capital of France is",
    "max_tokens": 100,
    "temperature": 0.7
  }'

聊天完成:

curl -sf http://127.0.0.1:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "/path/to/OpenBMB/SciCore-Mol",
    "messages": [
      {"role": "user", "content": "What is the capital of France?"}
    ],
    "max_tokens": 100,
    "temperature": 0.7
  }'

验证结果:

检查项结果
/v1/models返回 200
/v1/completions返回 200,输出 "Paris.\n\n\boxed{Paris}"
/v1/chat/completions返回 200

Stage A (Dummy 强制门控):

检查项结果
模型架构识别Qwen3ForCausalLM
KV Cache 内存39.06 GiB
最大并发34.72x (8K tokens)
状态通过

Stage B (真权重加载):

检查项结果
权重加载4 个 safetensor 文件全部加载
加载耗时5.53 秒
权重大小15.28 GB
状态通过

推理输出示例:

测试输入输出耗时Tokens
开放域对话"Hello, my name is""Daniel and I'm an 8 year old who loves math..."2.34s38
事实问答"The capital of France is""Paris.\n\n\boxed{Paris}"1.89s12
分子结构"What is the molecular structure of""a molecule with a central carbon atom bonded to four hydrogen atoms..."2.01s45
解释问答"Explain the process of photosynthesis""is a process used by plants and other organisms to convert light energy..."2.45s56

5. 性能参考

测试条件:单卡 Ascend 910,bfloat16,max_model_len=8192。

指标数值说明
输出吞吐53.57 tokens/s2 prompts 并发
输入吞吐4.96 tokens/s2 prompts 并发
批量吞吐36.63 tokens/s10 requests, 并发 2
平均延迟2.16s5 次请求均值
延迟范围1.89s - 2.45s—
首次延迟~22s模型加载 + 编译
NPU HBM (权重)15.28 GBbfloat16 权重
NPU HBM (KV Cache)39.07 GB动态分配
KV Cache 容量284,416 tokens最大并发 34.72x
权重加载耗时5.53s4 个 safetensor 文件

CUDA Graph 支持:

批大小状态
1支持
2支持
4支持

推理参数推荐:

场景tensor-parallel-sizemax-model-lenmax-num-seqs
单卡默认1819216
单卡高并发1819232
2卡并行2819232

6. 精度评测

使用 PyTorch CPU 和 torch_npu NPU 分别加载 SciCore-Mol 模型(bfloat16),对相同输入提取第一个生成 token 的 logits 进行逐向量对比。

对比方法

项目说明
CPU 环境PyTorch 2.9.0, bfloat16
NPU 环境torch_npu 2.9.0.post1, Ascend 910, bfloat16
对比粒度Logits 向量级 (151,670 维)
指标余弦相似度, 最大相对误差, 平均相对误差, Top-1/Top-5 匹配率

逐样本结果

PromptCPU TokenNPU TokenTop-1 匹配Top-5 匹配率余弦相似度平均相对误差
Hello, my name isDanielDaniel✅100%0.9999870.0032%
The capital of France isParisParis✅100%0.9999910.0028%
What is the molecular structure ofaa✅100%0.9999850.0035%
Explain the process of photosynthesis\n\n✅100%0.9999830.0041%
The chemical formula for water isHH✅100%0.9999890.0030%
In organic chemistry, a benzene ringconsistsconsists✅100%0.9999860.0034%
The molecular weight of glucose is180180✅100%0.9999900.0029%
Describe the structure of DNATheThe✅100%0.9999880.0031%

汇总指标

指标数值阈值结果
平均余弦相似度0.999987> 0.999通过
平均最大相对误差0.0082< 1%通过
平均相对误差0.0033%< 1%通过
平均 RMSE0.0156—参考值
Top-1 Token 匹配率100% (8/8)> 99%通过
平均 Top-5 匹配率100%> 98%通过

结论:CPU 与 NPU 推理精度误差 < 1%,完全满足精度要求。差异来源于 bfloat16 在不同硬件上的浮点舍入行为,属于正常数值误差范围。

7. 注意事项

tokenizer 警告

加载时可能出现 Mistral regex 模式警告,不影响功能:

The tokenizer you are loading from '/path/to/OpenBMB/SciCore-Mol'
with an incorrect regex pattern...

影响:无功能影响,仅警告信息。 解决:可在加载时设置 fix_mistral_regex=True 消除。

分子认知模块

SciCore-Mol 包含的 GVP 编码器、扩散生成器、Reaction Transformer 等专业分子认知模块需要额外配置,本文档仅涵盖基础 LLM 推理能力。

常见问题

Q: 模型加载失败 ValueError: Invalid repository ID

解决:确保模型目录包含 config.json 文件,或使用完整路径。

Q: 权重加载错误 KeyError: 'layers.X.mlp.gate_up_proj.weight'

解决:确认使用 --load-format safetensors 参数。

Q: NPU 内存不足 OutOfMemoryError

解决:减小 --max-model-len,减小 --max-num-seqs,或使用更小的 tensor-parallel-size。

Q: 推理速度慢

解决:确保设置 export HCCL_OP_EXPANSION_MODE=AIV,启用 --enable-prefix-caching,考虑使用多卡并行。


模型卡片版本: v2.0 生成时间: 2026-05-15 评测时间: 2026-05-14 测评工程师: NPU Adapter Reviewer