模型名称: DeepPlant-GEP
模型链接: HuggingFace - Addaoud/DeepPlant-GEP
模型描述: DeepPlant-GEP 是一个用于植物基因表达预测(Gene Expression Prediction, GEP)的深度学习模型。该模型采用 CNN backbone + Transformer encoder 架构,输入 DNA 序列的 one-hot 编码,输出 2935 个基因的表达水平预测值。
模型架构:
参数规模: 249M parameters
输入规格:
[batch, seq_len, 4]输出规格:
[batch, 2935]| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch | >= 2.1.0 | PyTorch 框架(由 CANN 提供) |
| torch_npu | >= 2.1.0 | 昇腾 NPU 后端 |
| safetensors | >= 0.4.0 | 模型权重加载 |
| numpy | >= 1.24.0 | 序列编码 |
| 昇腾驱动 | CANN 8.0+ | 推荐 CANN 8.5.1 |
安装命令:
pip install torch-npu>=2.1.0 safetensors numpy# 检查 NPU 设备
npu-smi info
# 验证 torch_npu
python3 -c "import torch_npu; print(torch.npu.device_count(), torch.npu.get_device_name(0))"方式一:HuggingFace(推荐)
huggingface-cli download Addaoud/DeepPlant-GEP --local-dir ./model_weights方式二:AtomGit 镜像(HuggingFace 下载慢时使用)
# 使用 hf-mirror.com 镜像
HF_ENDPOINT=https://hf-mirror.com huggingface-cli download Addaoud/DeepPlant-GEP --local-dir ./model_weights# 单条推理
python inference.py --model-path ./model_weights/model.safetensors --device npu
# 批量推理
python inference.py --model-path ./model_weights/model.safetensors --device npu --batch-size 32
# 从文件读取序列
python inference.py --model-path ./model_weights/model.safetensors --input-file sequences.txt --device npu| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --model-path | str | 必填 | 模型 checkpoint 路径 |
| --seq | str | None | 输入 DNA 序列 |
| --input-file | str | None | 序列文件路径(每行一个序列) |
| --device | str | auto | 设备选择:auto/npu/cpu |
| --batch-size | int | 32 | 批处理大小 |
| --max-seq-len | int | 100 | 最大序列长度 |
[INFO] Device: npu
[INFO] Building DeepPlant-GEP model...
[INFO] Model params: 248,872,311
[INFO] Loading weights from ./model_weights/model.safetensors
[OK] All 143 important weights loaded
[INFO] Device: Ascend910_9362 (npu:0)[INFO] Single inference completed in 0.647s
[INFO] Output shape: (1, 2935)
[INFO] Output range: [-2.135097, 1.244201][INFO] Batch (8 seqs) completed in 0.050s (0.006s per sample)
[INFO] Batch output shape: (8, 2935)运行命令:
python inference.py --model-path ./model_weights/model.safetensors --device npu输出:
[INFO] No input, using random test (len=100)
[INFO] Running inference on 1 sequence(s)...
[INFO] Completed in 0.65s, output shape: (1, 2935)
=== Seq 1 (len=100) ===
Gene 0: 0.123456
Gene 1: -0.234567
Gene 2: 0.345678
... (2935 genes total)运行命令:
python inference.py --model-path ./model_weights/model.safetensors --device npu --batch-size 8输出:
[INFO] Running inference on 8 sequence(s)...
[INFO] Completed in 0.05s, output shape: (8, 2935)运行命令:
python inference.py --model-path ./model_weights/model.safetensors \
--seq "ATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATG" \
--device npu


评测指标:
| 指标 | 说明 | 原论文结果 |
|---|---|---|
| PCC | Pearson Correlation Coefficient | 论文报告值 |
| SCC | Spearman Correlation Coefficient | 论文报告值 |
| MSE | Mean Squared Error | 论文报告值 |
评测命令:
# 需要原论文的测试数据集进行完整精度评测
# python evaluate.py --model-path ./model_weights/model.safetensors \
# --test-data ./test_data.csv --device npu说明: 本次适配完成了模型在昇腾 NPU 上的推理验证,确认模型架构正确、权重加载无误、推理输出合理。完整精度评测需要使用原论文的测试数据集。
无