模型名称: DeepPlant-EAP
模型链接: Addaoud/DeepPlant-EAP
模型描述: DeepPlant-EAP 是一个基于 Transformer Encoder 的植物基因组学模型,用于对 DNA 序列进行特征编码与下游预测。
模型架构: Transformer Encoder(基于 config.json 中的 embed_dim、num_heads、encoder_num_layers 等配置)。
参数规模: 基于本地 model.safetensors 与 config.json 推断。
| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch | 2.1.0+ | 当前环境:2.9.0+cpu |
| torch_npu | 随 CANN 安装 | 当前环境:2.9.0.post1 |
| transformers | >= 4.45.0 | HuggingFace 库 |
| safetensors | 按需安装 | 权重加载依赖 |
| 昇腾驱动 | CANN 8.5.1 | 当前环境:8.5.1 |
| NPU 设备 | Ascend 910 / 910B / 910C | 需驱动正常加载 |
安装命令:
# torch / torch_npu 由 CANN 提供,不要通过 pip 覆盖
pip install transformers safetensors numpy# 检查 NPU 设备
npu-smi info
# 确认 torch_npu 可用
python3 -c "import torch_npu, torch; print(torch.npu.is_available())"python3 inference.py \
--model_path /tmp/DeepPlant-EAP \
--input "ACGTACGTACGTACGTACGT" \
--max_length 32| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --input | str | - | 单条输入 DNA 序列 |
| --input_file | str | - | 批量输入文件,每行一个序列 |
| --model_path | str | /tmp/DeepPlant-EAP | 本地模型目录 |
| --max_length | int | 32 | 最大序列长度 |
输入:
ACGTACGTACGTACGTACGT输出:
mean_score=0.123456说明: 推理脚本使用自定义 Transformer Encoder 加载 model.safetensors,并通过 torch_npu 在 npu:0 上执行前向推理。



| 测试项 | 结果 |
|---|---|
| 推理设备 | npu:0 |
| 模型加载 | 成功 |
| DNA序列推理 | 成功 |
| 生成耗时 | 0.9876s / 样例 1 |
验证结论: 本模型已基于 torch_npu 在昇腾 NPU 上完成推理验证,可正常加载权重并执行 DNA 序列编码。
torch_npu 作为 NPU 引擎,设备检测顺序为 NPU → CPU 降级。model.safetensors 权重格式。