How arcinstitute/evo2 works
Project Type & Purpose
• Evo 2 is a specialized machine learning project: a DNA language model designed for long-context genetic sequence modeling and design. It is built for state‑of‑the‑art capabilities in genome modeling using architectures like StripedHyena 2 and is designed to operate in GPU-accelerated environments (leveraging Transformer Engine FP8 on H100 GPUs).
• The system is intended for tasks such as scoring, embedding extraction, and sequence generation across DNA sequences. It even supports integration with NVIDIA technologies (like NIM) and external model repositories (HuggingFace).
Analysis of the File Structure
• The main package resides in the "evo2" directory. This folder includes:
• __init__.py – the package initializer.
• configs/ – YAML files defining different model configurations (e.g., evo2_40b_8k, evo2_7b_1m, etc.).
• models.py, scoring.py, utils.py, and version.py – which likely hold the core model classes, forward pass, scoring utilities, and version handling.
• There is a "notebooks" directory containing examples (e.g., a BRCA1 variant effect prediction notebook), showcasing how to use the model.
• The "test" directory contains test scripts to validate functionality.
• Configuration/installation and external dependency files (e.g., setup.py, requirements.txt, .gitmodules) indicate integration with submodules like Vortex (which is referenced in the README and essential for model device placement and handling long sequence performance).
Key Architectural Components
a. Core Model Component:
• Evo 2’s main functionality is encapsulated in the Evo2 class (found in the "evo2" package). This includes:
• Tokenization (transforming DNA sequences to token IDs)
• Forward pass scoring.
• Embedding extraction.
• Sequence generation.
b. Configuration & Variant Selection:
• The multiple YAML configuration files in evo2/configs indicate support for different model variants (e.g., 7b and 40b sizes, with various context lengths). These files should be shown as dedicated components for “Model Configurations.”
c. External Dependencies & Infrastructure:
• GPU Hardware & Accelerator Layer: The project uses NVIDIA’s Transformer Engine, which requires H100 GPUs or similar. Include the GPU accelerator as a component.
• Vortex: Provides device placement and multi-GPU support.
• NVIDIA NIM: For hosting the instance and providing a unified API.
• Savanna: The training framework used for training Evo 2.
• HuggingFace: Hosting model checkpoints.
d. Supporting Utilities & Testing:
• Utility functions (in utils.py) and helper modules for scoring and versioning which should be depicted as ancillary components that support core model operations.
e. Example & Client Interfaces:
• Notebooks act as client-side interfaces showing how to use prediction, embedding, and generation functionalities.
• Command-line tools and API endpoints (e.g., via the NVIDIA hosted API or self-hosted instances in NIM) are also relevant.
• Break the system into clearly defined blocks/components:
• Input / Data Ingestion:
• DNA Sequence Input
• Tokenizer (part of the Evo2 class)
• Core Processing Block:
• Evo2 Model Core: Handles scoring, forward pass computations, and generation.
• Embeddings Extraction Module.
• Configuration Management:
• Model Configurations (YAML files) feeding into Evo2 for different model sizes and contexts.
• External Infrastructure & Dependencies:
• GPU Accelerator (NVIDIA H100, Transformer Engine FP8)
• Vortex for multi-GPU device placement.
• NVIDIA NIM (for API hosting and external accessibility).
• Savanna Training Module (if depicting the training pipeline).
• HuggingFace Model Checkpoints.
• Support & Utilities:
• Utils, Versioning, and Testing components.
• Client Interface:
• Notebooks demonstrating use cases (such as zero-shot BRCA1 variant effect prediction)
• Optional API endpoints showing interactions with hosted services.
• Data flow (e.g., Input Sequence -> Tokenizer -> Model Processing -> Generation/Embeddings).
• Employ visual elements: