Practical overview
When it fits
Use it when you need a self-hosted PyTorch implementation of Enformer and want direct control over sequence inputs, model outputs, embeddings, or downstream fine-tuning.
Who it is for
- Computational genomics researchers
- Machine-learning developers working with DNA sequences
- Teams building self-hosted gene-expression or regulatory-genomics workflows
Documented uses
- Predict gene-expression outputs from encoded DNA sequences.
- Extract embeddings for downstream genomic analysis.
- Fine-tune pretrained representations for new genomic tracks.
- Adapt the model to contextual or chromatin-accessibility prediction tasks.
Requirements & limits
The repository is public and specifies an MIT license. Installation is documented through pip; no hosted service account or subscription requirement is identified.
- It uses PyTorch and Python rather than the original TensorFlow/Sonnet implementation.
- The repository documents both direct prediction and fine-tuning interfaces.
- Inputs can be supplied as nucleotide indices or one-hot encodings.
- Pretrained weights are loaded through the documented Hugging Face model identifier.
- Fine-tuning requires suitable genomic targets and can involve substantial local compute; the examples use CUDA.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install the Enformer Pytorch package
Set up the Python package so a PyTorch Enformer model can be instantiated for genomic sequence analysis.
Before you start
- Python environment with pip
- PyTorch
- A supported local operating system: Linux, Windows, or macOS
Steps
Install the package with the command below.
pip install enformer-pytorchImport
Enformerfromenformer_pytorchand instantiate it with the documented hyperparameters, output heads, and target length.Prepare a DNA sequence as nucleotide indices in ACGTN order, using -1 for padding, or convert sequence indices to one-hot encodings.
Pass the encoded sequence to the model to obtain the documented human and mouse output heads.
Expected outcome
A locally instantiated PyTorch Enformer model can receive encoded DNA sequences and return prediction tensors for its configured output heads.
Guide limitations
- The example documents model invocation and outputs but does not establish performance on a user's data.
- The example configuration uses a 196,608-position sequence and specific human and mouse heads; other configurations require appropriate model and data choices.
- This is source-based setup guidance, not a compatibility or execution test.
Fine-tune pretrained Enformer weights for new genomic tracks
Configure the documented head-adapter workflow for adapting pretrained Enformer representations to task-specific genomic tracks.
Before you start
- The
enformer-pytorchpackage - Access to the pretrained model identifier
EleutherAI/enformer-official-roughthrough the documented loader - PyTorch tensors containing DNA sequences and task targets
- CUDA-capable execution is shown in the repository examples for the training workflow
Steps
Load the pretrained model with
from_pretrained('EleutherAI/enformer-official-rough').Wrap it with
HeadAdapterWrapper, specifying the number of target tracks and the documented embedding-position option if needed.Prepare encoded DNA sequences and target tensors with matching task dimensions.
Pass the sequence and target to the wrapper, calculate the returned loss, and call
loss.backward()as shown.
Expected outcome
A pretrained Enformer model is configured with an adapter for downstream genomic-track training.
Guide limitations
- The repository example shows the training path but does not provide a complete training loop, optimizer configuration, dataset, or finished model.
- The documented example uses CUDA and task-specific tensor dimensions; actual resource and shape requirements depend on the chosen data.
- This is source-based guidance, not a training result or audit.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 4 October 2026
- Original website title
- lucidrains/enformer-pytorch · Official homepage title · retained in its source language

