evo2-metal
Run ARC Institute's Evo 2 DNA language model on Apple Silicon (Metal GPU) — no CUDA required.
Evo 2 is a 7B–40B parameter genomic foundation model trained on 9.3 trillion DNA tokens. This package makes the 7B models fully usable on a Mac with M-series chips.
How it works
Evo 2 depends on flash-attn, which requires NVIDIA CUDA and does not run on Mac. This package provides:
- A FlashAttention v2 kernel written in Metal Shading Language (Apple's GPU compute API), dispatched via PyObjC.
- A set of monkey-patches applied before importing
evo2that redirect all CUDA-dependent calls to CPU/Metal equivalents — without modifying the original Evo 2 source code.
import evo2_metal ← patches flash_attn, vortex, and evo2.scoring
from evo2 import Evo2
Installation
Requires: macOS with Apple Silicon (M1/M2/M3/M4/M5), Python 3.11 or 3.12.
# 1. Create a Python 3.12 environment (evo2 requires <3.13)
conda create -n evo2-mac python=3.12
conda activate evo2-mac
# 2. Install PyTorch (CPU build for Mac)
pip install torch --index-url https://download.pytorch.org/whl/cpu
# 3. Install evo2-metal (PyPI)
pip install evo2-metal
# Alternative: install directly from GitHub
# pip install git+https://github.com/lemonardo1/evo2-metal.git
Usage
Sequence scoring
import evo2_metal # must be first
from evo2 import Evo2
model = Evo2('evo2_7b_base')
scores = model.score_sequences([
"ATGAAAGCAATTTTCGTACTGAAAGGTTCAGGT", # wildtype
"ATGAAAGCAATTTTCGTACTGAAAGGTTCAGGA", # variant
])
print(scores) # [np.float32(-1.27), np.float32(-1.43)]
DNA sequence generation
import evo2_metal
from evo2 import Evo2
model = Evo2('evo2_7b_base')
output = model.generate(
prompt_seqs=["ATGAAAGCAATTTTCGTACTGAAAGGTTCAGGT"],
n_tokens=200,
temperature=1.0,
top_k=4,
)
print(output.sequences[0])
Supported models
| Model | Parameters | Context | Supported |
|---|---|---|---|
evo2_7b_base |
7B | 8K | ✅ |
evo2_7b |
7B | 1M | ✅ |
evo2_7b_262k |
7B | 262K | ✅ |
evo2_7b_microviridae |
7B | 8K | ✅ |
evo2_1b_base |
1B | 8K | ❌ (requires FP8/Transformer Engine) |
evo2_40b / evo2_20b |
40B / 20B | 1M | ❌ (requires multi-GPU) |
Patches applied
| Patch | Reason |
|---|---|
torch.cuda.device → no-op for cpu |
StripedHyena.__init__ calls torch.cuda.device("cpu") |
torch.cuda.memory_allocated → returns 0 |
Called in generation loop for logging |
flash_attn_2_cuda → mocked |
Not available on Mac |
FlashSelfAttention.forward → Metal backend |
assert qkv.is_cuda fails on CPU |
FlashCrossAttention.forward → Metal backend |
Same |
local_flash_attn_with_kvcache → PyTorch SDPA |
KV-cache path during token generation |
vortex.generation.generate → device='cpu' |
Default was 'cuda:0' |
evo2.scoring.prepare_batch → device='cpu' |
Default was 'cuda:0' |
Verified on
- Apple M5 Max, macOS 15 (Sequoia)
- Python 3.12, PyTorch 2.11, evo2 0.5.3
License
Apache 2.0 — see LICENSE.
Evo 2 model weights are released under their own license by ARC Institute. See the Evo 2 repository for details.
Metadata
Release files for evo2-metal 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| evo2_metal-0.1.0.tar.gz | 18.6 kB | Without provenance | Details for evo2_metal-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| evo2_metal-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for evo2_metal-0.1.0-py3-none-any.whl |
Total release size: 36.5 kB
Release files / evo2_metal-0.1.0.tar.gz
| Download URL | evo2_metal-0.1.0.tar.gz |
|---|---|
| Size | 18.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a6a54f23466400dd5b122c6374d2288cfd1a61616ce805034e34e1c3d1e7c52
|
|
BLAKE2b-256 checksum How to use checksums |
fc63888a85ed1a61a7dec785363e43de155a3638599918e03575bfa0fe179555
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Release files / evo2_metal-0.1.0-py3-none-any.whl
| Download URL | evo2_metal-0.1.0-py3-none-any.whl |
|---|---|
| Size | 17.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a329882b31efca523ef7fd59502f76da0f4817e1ecd70f27a7c7ef40d1f527f
|
|
BLAKE2b-256 checksum How to use checksums |
56947fcab44dbefb714739ae4b4ee9077d5149ad367e03467053e4a1d1dfa04a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Security for evo2-metal 0.1.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.