Model Name: multimolecule/basenji
Model Link: HuggingFace
Model Description: Basenji2 is a CNN-based genomic sequence model designed to predict gene expression coverage tracks across DNA sequences. The model takes DNA sequences of length 131072 bp as input and outputs predictions for 5313 gene expression tracks across 896 bins.
Model Architecture: CNN (Convolutional Neural Network)
Parameter Count: 30,092,548 (~30M)
Input Specification:
Output Specification:
| Dependency | Version Requirement | Description |
|---|---|---|
| Python | >= 3.10 | 3.11 recommended |
| torch | >= 2.1.0 | PyTorch framework |
| torch_npu | >= 2.1.0 | Ascend NPU backend |
| safetensors | >= 0.4.0 | Model weight loading |
| numpy | < 2.0 | Numerical computation |
| Ascend driver | CANN 8.0+ | CANN 8.5.1 recommended |
Installation Commands:
pip install torch torch_npu 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 multimolecule/basenji --local-dir ./basenji_weights方式二:AtomGit 镜像(HuggingFace 下载速度较慢时使用)
huggingface-cli download --repo-type model https://ai.gitcode.com/hf_mirrors/multimolecule/basenji --local-dir ./basenji_weights# CPU 推理
python3 inference.py --model-path ./basenji_weights --device cpu --sequence ACGTACGT...
# NPU 推理
python3 inference.py --model-path ./basenji_weights --device npu --sequence ACGTACGT...
# 从文件读取序列
python3 inference.py --model-path ./basenji_weights --device npu --input-file sequence.txt| Parameter | Type | Default | Description |
|---|---|---|---|
--model-path | str | Required | Path to the model checkpoint |
--sequence | str | None | DNA sequence string (e.g., "ACGT...") |
--input-file | str | None | Path to a file containing DNA sequences |
--device | str | npu | Device type: npu/cpu |
[INFO] Model path: /tmp/adapt_multimolecule_basenji/weights
[INFO] Device: npu
[INFO] Sequence length: 131072
[INFO] Num labels (tracks): 5313
[INFO] Model type: basenji
[INFO] Building model...
[INFO] Total parameters: 30,092,548
[INFO] Loading weights...
[INFO] Weights loaded in 0.08s
[INFO] Model moved to npu
[INFO] Input shape: torch.Size([1, 131072])
[INFO] Running inference...
[INFO] Inference completed in 0.2063s
[INFO] Logits shape: torch.Size([1, 896, 5313])
[INFO] Coverage shape: torch.Size([1, 896, 5313])
[INFO] Logits range: [-18.094591, 4.737417]
[INFO] Coverage range: [0.000000, 4.746140]
[INFO] Mean coverage: 0.017190
[状态] SUCCESS[INFO] Model path: /tmp/adapt_multimolecule_basenji/weights
[INFO] Device: cpu
[INFO] Sequence length: 131072
[INFO] Num labels (tracks): 5313
[INFO] Model type: basenji
[INFO] Building model...
[INFO] Total parameters: 30,092,548
[INFO] Loading weights...
[INFO] Weights loaded in 0.08s
[INFO] Model moved to cpu
[INFO] Input shape: torch.Size([1, 131072])
[INFO] Running inference...
[INFO] Inference completed in 5.1688s
[INFO] Logits shape: torch.Size([1, 896, 5313])
[INFO] Coverage shape: torch.Size([1, 896, 5313])
[INFO] Logits range: [-18.098328, 4.738169]
[INFO] Coverage range: [0.000000, 4.746886]
[INFO] Mean coverage: 0.017176
[状态] SUCCESS运行命令:
python3 inference.py --model-path ./basenji_weights --device npu输出:
[INFO] No sequence provided, using random sequence of length 131072
[INFO] Input shape: torch.Size([1, 131072])
[INFO] Inference completed in 0.2063s
[INFO] Logits shape: torch.Size([1, 896, 5313])
[INFO] Coverage range: [0.000000, 4.746140]
[INFO] Mean coverage: 0.017190
[状态] SUCCESS运行命令:
python3 inference.py --model-path ./basenji_weights --device npu --sequence "ACGTACGTACGT"输出:
[INFO] Sequence padded to 131072 bases with N
[INFO] Input shape: torch.Size([1, 131072])
[INFO] Inference completed in 0.2063s
[INFO] Logits shape: torch.Size([1, 896, 5313])
[INFO] Coverage range: [0.000000, 4.746140]
[INFO] Mean coverage: 0.017190
[状态] SUCCESS


无。