Skip to main content

promoterai-torch

PyPI Tests PyPI Downloads

A PyTorch port of PromoterAI v1 from Illumina — a deep learning model that predicts the regulatory impact of promoter DNA variants on gene expression.

Install

Python 3.10–3.14 are supported.

pip install promoterai-torch        # or: uv add promoterai-torch

The core package scores variants, extracts embeddings, runs inference and converts the official Keras models (no TensorFlow needed). Optional extras:

Extra Enables
train Preprocess data, train from scratch, or fine-tune
wandb Weights & Biases logging (combine with train)
interpret DeepLIFT/SHAP references and logo plots (tangermeme)

PyPI's torch supports NVIDIA GPUs of compute capability 7.5+ (Turing and newer). For older GPUs (Maxwell, Pascal, Volta) or CPU-only machines, see docs/installation.md. For a development checkout, see CONTRIBUTING.md.

Convert a pretrained Keras model

Download a pretrained PromoterAI SavedModel from Illumina/PromoterAI and convert it (architecture parameters are inferred from the SavedModel):

promoterai-torch convert \
    --keras_model models/promoterAI_v1_hg38_mm10_finetune \
    --output models/promoterAI_v1_hg38_mm10_finetune.pt \
    --input_length 20480 --output_length 4096   # stored in the checkpoint

Score variants

Given a variant TSV with columns chrom, pos, ref, alt, strand:

promoterai-torch score \
    --model_checkpoint models/promoterAI_v1_hg38_mm10_finetune.pt \
    --var_file variants.tsv \
    --fasta_file hg38.fa \
    --input_length 20480

Scores in [−1, 1] are written to variants.{model_name}.tsv (or --output). Thresholds: ±0.1 (weak), ±0.2 (moderate), ±0.5 (strong). Substitutions are scored incrementally by default: each site's reference runs once and each alt recomputes only what its edit can reach, exactly (4-5x faster on TERT promoter SNVs, ~3x faster than the TensorFlow package). Indels use full passes; --no-incremental forces full passes for all.

Like the original TensorFlow package, score, train and finetune allow TF32 matmuls and convolutions on Ampere and newer GPUs. Pass --no-tf32 for strict float32: slower, and about 1 in 10 scores moves by one 4-decimal step (1e-4). See docs/numerical-equivalence.md for timings.

Predict tracks and extract embeddings

import torch
from promoterai_torch.dataset import onehot_encode
from promoterai_torch.utils import load_pretrained

model, args = load_pretrained("models/promoterAI_v1_hg38_mm10_finetune.pt")
model.eval()

seq = "ACGT" * (args["input_length"] // 4)   # your 20,480-bp sequence
x = torch.from_numpy(onehot_encode(seq)).unsqueeze(0)   # (1, L, 4)

with torch.no_grad():
    tracks = model(x)             # one (1, output_length, n_tracks) tensor per species head
    embeddings = model.encode(x)  # (1, L, model_dim), the final block's output

Tracks are arcsinh-scale signal: 498 for the human head (histone marks, TF ChIP-seq, ATAC-seq, RNA-seq) and 472 for the mouse head.

Unlike the CLI, the Python API leaves PyTorch's precision flags alone (TF32 convolutions only), since they're process-wide. To match TensorFlow, which also runs matmuls in TF32 on Ampere and newer GPUs, call this once first:

from promoterai_torch.utils import set_tf32
set_tf32(True)   # set_tf32(False) for strict float32

DeepLIFT/SHAP attribution

With the interpret extra, deep_lift_shap gives the same attributions as tangermeme's, but the full model fits on a 10 GB GPU (tangermeme needs ~65 GB):

from promoterai_torch.attribution import deep_lift_shap

# X: (N, 4, input_length) one-hot, channels-first
attributions = deep_lift_shap(model.to("cuda"), X, n_shuffles=20, random_state=0)

See docs/attribution.md for the mouse head, custom targets (windows, track weights, contrasts), compile=True, precision on Ampere+ GPUs, and benchmarks.

SFSWAP DeepLIFTSHAP

Numerical equivalence

This port produces near-identical scores and regulatory track predictions to the original TensorFlow/Keras implementation, matching the published AUROCs. See docs/numerical-equivalence.md for benchmark reproduction steps, per-variant concordance results, and full-track comparison scripts.

SFSWAP scatter

Training models

Fine-tuning or training from scratch using the built-in scripts requires the train extra described in Install (with an optional wandb extra for wandb.ai integration. See docs/training.md for data preprocessing, training from scratch, fine-tuning on variants, and multi-GPU usage.

Development

See CONTRIBUTING.md for setting up a local development environment and running the test suite.

Reference

Jaganathan, Ersaro, Novakovsky et al. Science (2025) Predicting expression-altering promoter mutations with deep learning. doi:10.1126/science.ads7373

He, Kundaje. Genomics x AI Blog (2026) promoterai-torch: a PyTorch port of Illumina's PromoterAI. doi:10.5281/zenodo.23038831

Original TF implementation: Illumina/PromoterAI

Citation metadata for this software is available in CITATION.cff.

Metadata

Release files for promoterai-torch 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for promoterai-torch 0.6.0
File Size Uploaded Provenance Actions
promoterai_torch-0.6.0.tar.gz 173.3 kB With provenance Details for promoterai_torch-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for promoterai-torch 0.6.0
File Interpreter ABI Platform Actions
promoterai_torch-0.6.0-py3-none-any.whl Python 3 none any Details for promoterai_torch-0.6.0-py3-none-any.whl

Total release size: 243.2 kB

Release files / promoterai_torch-0.6.0.tar.gz

Download URL promoterai_torch-0.6.0.tar.gz
Size 173.3 kB
Tags Source
SHA-256 checksum
How to use checksums
860745fa714cacb0cbfe6a3bbf6c15d12f34bcdb4071081d58093d4392daf6be
BLAKE2b-256 checksum
How to use checksums
cf8e929b5f04d41e8b50b982be74c3a95ddb3b8ee30d31d681538a7293d9a791
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / promoterai_torch-0.6.0-py3-none-any.whl

Download URL promoterai_torch-0.6.0-py3-none-any.whl
Size 69.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0670ea39bcc21451adecaf6f77cb63251a153997b38f3b2f0218feea41aa67d4
BLAKE2b-256 checksum
How to use checksums
28fbe12f6109f5c37fd9faca98efeb279e9655d1c90f8054b3d44af76c0bcc99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for promoterai-torch 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for promoterai_torch-0.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page