embed_sequence
Extract intermediate Evo 2 embeddings from a DNA sequence for downstream analysis using layer-specific feature representations.
Instructions
Return intermediate Evo 2 embeddings for DNA sequence.
Extracts feature representations from a specified layer of the Evo 2 model for a given DNA sequence. The embeddings capture the model's learned representations and can be used for downstream analysis or as features for other tasks.
Args:
sequence: DNA sequence to embed. Should contain standard IUPAC nucleotides (A, C, G, T).
checkpoint: Model checkpoint identifier. If None, uses the default checkpoint.
See list_available_checkpoints() for available options.
layer_name: Name of the model layer from which to extract embeddings.
Common choices include intermediate MLP layers and attention blocks.
Returns: Dictionary containing: - checkpoint: The checkpoint identifier used - sequence: The normalized input sequence - layer_name: The layer from which embeddings were extracted - embedding: 2D list of embedding vectors (shape: [sequence_length, embedding_dim])
Raises: AssertionError: If sequence or layer_name are empty strings.
Example: >>> embeddings = embed_sequence("ATCGATCG") >>> embedding_matrix = embeddings["embedding"] >>> print(f"Embedding shape: {len(embedding_matrix)} tokens")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sequence | Yes | ||
| checkpoint | No | ||
| layer_name | No | blocks.2.mlp.l3 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||