模型名称: multimolecule/aparent
模型链接: HuggingFace
模型描述: APARENT (Alternative Polyadenylation Prediction) 是一种基于 CNN 的深度学习模型,用于预测 RNA 序列的聚腺苷酸化(polyadenylation)位点。模型预测两个关键输出:(1) 可变剪接亚型比例 (isoform proportion),(2) 切割位置分布 (cleavage profile)。
模型架构: 2层 Conv1D + MaxPool + 2层全连接 (Dense) + Dropout
参数规模: 6,426,418 参数
许可证: AGPL-3.0
输入规格:
[batch_size, 205]输出规格:
isoform_proportion:float,经 sigmoid 激活的亚型比例,范围 [0, 1]cleavage_profile:List[float],长度 206,经 softmax 的切割位置概率分布| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch | >= 2.1.0 | PyTorch 框架 |
| torch-npu | >= 2.1.0 | 昇腾 NPU 后端 |
| safetensors | >= 0.4.0 | 安全模型权重加载 |
| numpy | < 2.0 | 数值计算 |
| 昇腾驱动 | CANN 8.0+ | 推荐 CANN 8.5.1 |
安装命令:
pip install torch>=2.1.0 torch-npu>=2.1.0 safetensors>=0.4.0 "numpy<2"# 检查 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 multimolecule/aparent --local-dir ./model_checkpoint方式二:AtomGit 镜像(HuggingFace 下载慢时使用)
git clone https://gitcode.com/gcw_coj3XaOd/multimolecule_aparent.git
cp multimolecule_aparent/model_checkpoint/*.safetensors ./model_checkpoint/# 单条序列推理
python inference.py --model-path ./model_checkpoint --sequence "UAGCUUAUCAGACUGAUGUUGA"
# 批量推理
python inference.py --model-path ./model_checkpoint --seq-file sequences.txt --batch-size 8| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --model-path | str | 必填 | 模型 checkpoint 路径 |
| --sequence | str | 无 | 单条 RNA 序列(T 自动转 U) |
| --seq-file | str | 无 | 批量序列文件(每行一个序列) |
| --batch-size | int | 8 | 批量推理时的批次大小 |
| --device | str | npu | 推理设备(npu 或 cpu) |
# 验证 NPU 环境
npu-smi info
python3 -c "import torch_npu; print(torch.npu.device_count(), torch.npu.get_device_name(0))"# 单条推理
python inference.py --model-path ./model_checkpoint --sequence "UAGCUUAUCAGACUGAUGUUGA"
# 批量推理
python inference.py --model-path ./model_checkpoint --seq-file sequences.txt --batch-size 8[模型] multimolecule/aparent
[设备] Ascend910_9362 (npu:0)
[输入] UAGCUUAUCAGACUGAUGUUGA (长度 21)
[输出] isoform_proportion=0.282079, cleavage_profile top5=[(73, 0.1140), (35, 0.0583), (57, 0.0543), (31, 0.0514), (47, 0.0391)]
[耗时] 191.56ms
[状态] SUCCESS[基准测试] 4次推理统计:
总耗时: 202.19ms
平均: 50.55ms/序列
[状态] SUCCESS运行命令:
python inference.py --model-path ./model_checkpoint --sequence "UAGCUUAUCAGACUGAUGUUGA"输出:
[INFO] Using NPU: Ascend910_9362
[INFO] Loading model from ./model_checkpoint...
[INFO] Model loaded in 1.16s
[INFO] Parameters: 6,426,418
[INFO] Sequence length: 205
[INPUT] UAGCUUAUCAGACUGAUGUUGA
[OUTPUT] Isoform proportion: 0.282079
[OUTPUT] Top 5 cleavage positions: [(73, 0.11402040719985962), (35, 0.058296021074056625), (57, 0.05425351485610008), (31, 0.05140603706240654), (47, 0.03911694139242172)]
[INFO] Inference time: 191.56ms运行命令:
python inference.py --model-path ./model_checkpoint --sequence "UGAGAACUGAAUUCCAUGGGUU"输出:
[INPUT] UGAGAACUGAAUUCCAUGGGUU
[OUTPUT] Isoform proportion: 0.268802
[OUTPUT] Top 5 cleavage positions: [(73, 0.1112947091460228), (35, 0.07015254348516464), (31, 0.05814909189939499), (57, 0.050624482333660126), (107, 0.034498509019613266)]
[INFO] Inference time: 194.72ms运行命令:
python inference.py --model-path ./model_checkpoint --sequence "AUGGCGAACCUUGGCUGCUGGAUGCUGGUUCUCUUUGUGGCCACAUGG"输出:
[INPUT] AUGGCGAACCUUGGCUGCUGGAUGCUGGUUCUCUUUGUGGCCACAUGG
[OUTPUT] Isoform proportion: 0.281576
[OUTPUT] Top 5 cleavage positions: [(73, 0.08993273973464966), (88, 0.04264099895954132), (75, 0.03351013734936714), (57, 0.03305216133594513), (104, 0.027719680219888687)]
[INFO] Inference time: 196.80ms运行命令:
python inference.py --model-path ./model_checkpoint --batch-size 4 --seq-file sequences.txtsequences.txt 内容:
UAGCUUAUCAGACUGAUGUUGA
UGAGAACUGAAUUCCAUGGGUU
UUAAUGCUAAUCGUGAUAGGGGUU
AUGGCGAACCUUGGCUGCUGGAUGCUGGUUCUCUUUGUGGCCACAUGG输出:
[INFO] Running batch inference on 4 sequences...
[INFO] Batch inference time: 202.19ms
[INFO] Avg per sequence: 50.55ms
UAGCUUAUCAGACUGAUGUUGA... -> isoform=0.2821
UGAGAACUGAAUUCCAUGGGUU... -> isoform=0.2688
UUAAUGCUAAUCGUGAUAGGGGUU... -> isoform=0.2632


测试数据: 使用 HuggingFace 预训练权重直接推理
评测指标: APARENT 为训练完成的监督学习模型,权重来自 multimolecule 官方预训练 checkpoint。在随机 RNA 序列上的推理验证模型能够正常输出合理的 isoform proportion(范围 0.26-0.28)和 cleavage profile 分布。
| 指标 | 结果 | 说明 |
|---|---|---|
| 模型参数加载 | PASS | safetensors 权重成功加载,6,426,418 参数 |
| 单条推理 | PASS | Ascend910_9362, ~190ms/seq |
| 批量推理 | PASS | 4 条序列, ~202ms 总耗时 (~50ms/seq) |
| NPU 算子兼容性 | PASS | Conv1d, MaxPool1d, Linear, ReLU, Dropout, Sigmoid, One-hot 均兼容 |
F.one_hot 在 NPU 上会产生 internal format 警告,但不影响推理结果正确性