模型地址: Addaoud/DeepPlant-GEP(HuggingFace 镜像 hf-mirror.com) 适配引擎: torch_npu(昇腾 NPU PyTorch 后端,模型结构 1:1 重建 + safetensors 直载) 适配状态: ✅ 已在昇腾 NPU 上跑通推理
| 字段 | 内容 |
|---|---|
| 模型名称 | Addaoud_DeepPlant-GEP# |
| 模型链接 | Addaoud/DeepPlant-GEP |
| 模型描述 | 植物基因表达预测(GEP):输入 2.5kb DNA 序列,输出 2935 维表达谱(多 track 表达量回归) |
| 模型架构 | Conv1dWithRC + 残差卷积 + 6 层 Transformer encoder(d=2048) + AttentionPool + 线性头 |
| 参数规模 | 248.7M |
| 任务类型 | 基因表达预测(表达谱回归) |
| 硬件 | NPU(hardware: NPU) |
| 特性 | 说明 |
|---|---|
| 任务类型 | 按探测结果(自动) |
| 推理引擎 | torch_npu(昇腾 NPU PyTorch 后端,transformers 直载) |
| 设备 | npu:0 |
| 精度 | bfloat16(torch_dtype) |
| 项 | 规格 |
|---|---|
| NPU | 昇腾 Ascend 910(Atlas 系列) |
| 显存 | 单卡 HBM 64 GB |
| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch / torch_npu | 2.1.0+ | 昇腾 NPU 必选(版本需与 CANN 匹配) |
| transformers | >= 4.45.0 | HuggingFace 库 |
| 昇腾驱动 | CANN 8.0.RC2+ | 推荐最新版 |
安装命令:
npu-smi info # 确认 NPU 健康状态为 OK
pip install -r requirements.txt从 HuggingFace 镜像下载模型权重(国内推荐使用 hf-mirror.com 加速):
pip install huggingface_hub
export HF_ENDPOINT=https://hf-mirror.com
huggingface-cli download Addaoud/DeepPlant-GEP --local-dir ./weights --local-dir-use-symlinks False备选镜像: 若 HuggingFace 镜像不可用,可改用 ModelScope(魔搭)下载:
pip install modelscope python -c "from modelscope import snapshot_download; snapshot_download('Addaoud/DeepPlant-GEP', cache_dir='./weights')"
# 确认 NPU 设备健康状态为 OK
npu-smi info
# 安装项目依赖
pip install -r requirements.txtpython inference.py --model_path ./weights --input test_sequence.fa| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --model_path | str | ./weights | 模型权重目录(含 config.json / model.safetensors) |
| --input | str | test_sequence.fa | 输入 DNA 序列 FASTA 文件(2.5kb 窗口,中心裁剪/补 N) |
| --max_new_tokens | int | 128 | 兼容参数(本模型不使用) |
运行命令:
python inference.py --model_path ./weights --input test_sequence.fa输入:
test_sequence.fa(拟南芥 2.5kb 片段,来自官方代码仓 Demo/seq.fa)+ 同序列随机打乱对照
输入张量 one-hot (2, 4, 2500)输出(NPU 真实推理结果,npu:0):
[1] 设备: npu:0 -> Ascend910_9362
[2] 模型重建+权重加载(strict 全键命中,248.7M 参数),耗时 1.5s
[3] 测试输入: test_sequence.fa 原始序列 + 打乱对照(各 2500 bp -> one-hot (2, 4, 2500))
[4] 原始序列: 2935 维表达谱 | 均值=0.5517 最大=1.0187 min=-0.2151 非零=2933 (1393ms)
top5 track 索引/值: [2512]=1.019 [93]=0.908 [94]=0.900 [89]=0.893 [2606]=0.886
[4] 打乱对照: 2935 维表达谱 | 均值=1.1221 最大=1.6037 min=-0.4883 非零=2931 (1393ms)
真实 vs 打乱表达谱 Pearson 相关: 0.3307(差异明显说明模型响应序列 motif 而非组成噪声)
[5] CPU vs NPU logits 最大绝对误差: 1.65e-03
PASS: DeepPlant-GEP 在 npu:0 上完成基因表达预测| 指标 | 实测值 | 说明 |
|---|---|---|
| 端到端耗时 | 1.393 s | 2 样本 batch,含 one-hot 编码 + 前向 |
| 指标 | 实测值 | 说明 |
|---|---|---|
| 真实vs打乱 Pearson 相关 | 0.3307 | 表达谱差异 |
| CPU vs NPU 最大误差 | 1.65e-03 | fp32 一致性 |
| 重复推理一致性 | 逐位一致 | 同输入 |
按探测结果加载模型,在 NPU 上执行一次前向/生成,校验输出非空