Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Evo2 API Wrapper

A lightweight Python wrapper around the NVIDIA hosted Evo2-40b API that extracts intermediate embeddings and sequence probabilities for DNA sequences provided in FASTA format.

What it does

For every sequence in a FASTA file, the wrapper:

  1. Extracts 8,000+ dimensional embeddings from the 15th transformer block (blocks.14.mlp.l3) via the /forward endpoint.

    The Evo 2 paper (Brixi et al., Nature 2026) shows that intermediate MLP layers yield more informative, context-dependent representations than the raw embedding layer or final norm layer.

  2. Computes a final probability value from the unembed logits (softmax confidence) reflecting how probable the input sequence is under the model's distribution.

Requirements

pip install requests numpy

Usage

Interactive mode (prompts for API key and FASTA path)

Get free API key

python evo2_wrapper.py

Command-line mode

python evo2_wrapper.py \
    --api-key "nvapi-XXXXXXXX" \
    --fasta example.fasta \
    --out-dir evo2_results

You can also set the API key via environment variable:

export EVO2_API_KEY="nvapi-XXXXXXXX"
python evo2_wrapper.py --fasta example.fasta

Output

For each sequence the script creates two text files in --out-dir (default: evo2_results/):

File Description
{seq_id}_embeddings.txt Mean-pooled embedding vector from block 14 (~8,192 values, one per line)
{seq_id}_probabilities.txt mean_confidence, mean_entropy, and per-position max probabilities

Example

$ python evo2_wrapper.py --fasta example.fasta --out-dir evo2_results
[->] Processing example_seq_1 (length=16)
    Saved mean-pooled embedding (8192 dims) -> evo2_results\example_seq_1_embeddings.txt
    Saved probability summary (mean_confidence=0.4615) -> evo2_results\example_seq_1_probabilities.txt
Done. Processed 1 sequence(s).

References

About

Helps in retriving sequence specific embeddings and probabilities from DNA LLM i.e., EVO2

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages