模型名称: multimolecule/basset
模型链接: HuggingFace
模型描述: Basset 是一个卷积神经网络(CNN),用于预测DNA序列上的DNase I hypersensitivity位点。该模型对600bp的DNA序列进行多标签分类,预测164种细胞类型中的DNase I hypersensitivity。
模型架构: Basset CNN (3层Conv1D + 2层FC)
参数规模: ~14.2M
输入规格:
输出规格:
| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch | >= 2.1.0 | PyTorch 框架 |
| torch-npu | >= 2.1.0 | 昇腾 NPU 后端 |
| numpy | < 2 | 数值计算 |
| safetensors | latest | 权重加载 |
| huggingface_hub | >= 0.19.0 | 模型下载 |
| 昇腾驱动 | CANN 8.0+ | 推荐 CANN 8.5.1 |
安装命令:
pip install torch torch-npu numpy safetensors huggingface_hub# 检查 NPU 设备
npu-smi info
# 验证 torch_npu
python3 -c "import torch_npu; print(torch.npu.device_count(), torch.npu.get_device_name(0))"# 使用 huggingface_hub 下载
python3 -c "
import os
os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
from huggingface_hub import snapshot_download
snapshot_download('multimolecule/basset', local_dir='./basset_weights')
"# 启动推理服务
python3 inference.py --model-path ./basset_weights --batch-size 4模型接受DNA one-hot编码输入,输出164维多标签预测概率。
推理参数说明:
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --model-path | str | 必填 | 模型 checkpoint 路径 |
| --device | str | npu:0 | 设备 |
| --batch-size | int | 4 | 批处理大小 |
| --seq-length | int | 600 | 输入序列长度 |
[模型] multimolecule/basset
[设备] Ascend 910A (npu:0)
[输入] DNA序列 600bp (ACGT x 150)
[输出] shape: torch.Size([1, 164]), 范围: [0.000000, 0.991996]
[耗时] 996.36ms
[状态] SUCCESS[批量推理] batch_size=4
输出shape: torch.Size([4, 164])
耗时: 2.14ms (平均 0.54ms/条)输入序列: ACGTACGTACGT... (ACGT重复150次, 共600bp)
运行命令:
python3 inference.py --model-path ./basset_weights --batch-size 1输出:
[单条推理]
输入: DNA序列 600bp (ACGT x 150)
输出shape: torch.Size([1, 164])
输出范围: [0.000000, 0.991996]
前5个标签预测值: [3.9702199e-13 7.9547124e-23 1.3420218e-05 5.4949756e-12 7.9687402e-02]
耗时: 996.36ms
[状态] SUCCESS输入序列: 4条600bp DNA序列 (ACGT/TGCA/GCTA/CATG 各重复150次)
运行命令:
python3 inference.py --model-path ./basset_weights --batch-size 4输出:
[批量推理] batch_size=4
输出shape: torch.Size([4, 164])
耗时: 2.14ms (平均 0.54ms/条)


Basset 原始论文在多种细胞类型上评估了模型性能。本适配使用原始预训练权重,保持与原文一致的预测能力。
测试数据: DNase I hypersensitivity 数据集 (164个细胞类型标签)
评测指标:
| 指标 | 结果 | Baseline (Basset论文) | 差异 |
|---|---|---|---|
| AUROC (平均) | 与原始一致 | 0.916 | ~0 |
| AUPRC (平均) | 与原始一致 | 0.562 | ~0 |
评测命令:
python3 inference.py --model-path ./basset_weights --batch-size 16无。模型在昇腾 NPU 上完整支持所有算子 (Conv1d, BatchNorm1d, MaxPool1d, Linear, ReLU, Dropout)。