Views
No views yet
trust_remote_code HF implementation but it has four gaps that force every downstream user to monkey-patch the model:output_hidden_states=True is hardcoded to None (intermediate embeddings require forward hooks).output_attentions=True is unsupported (flash-attn discards the (B, H, T, T) matrix; users must patch the attention module).attn_implementation cannot be switched at load time - flash_attn is mandatory at every attention layer.AutoModel.from_pretrained; only the LM-head wrapper exists.max_abs_diff = 0.000e+00 at every layer; see Parity Verification).| Parameter | Value |
|---|---|
| Total parameters | ~7B |
| Layers | 32 |
| Attention heads | 32 |
| Embedding dimension | 4096 |
| FFN hidden dimension | 10 928 (gated GELU) |
| Vocabulary size | 512 (UTF-8 byte-level) |
| Attention layer indices | [8, 16, 24] |
| Hyena layer indices | all others |
| Hyena state size | 8 |
| Positional encoding | RoPE (base = 10000) |
| Normalization | RMSNorm (eps = 1e-6) |
| Architecture | StripedHyena (29 Hyena blocks + 3 causal MHA blocks) |
| Max sequence length | 8 192 (training context) |
| Training dtype | bfloat16 (Hyena modal-form poles / residues kept in fp32) |
Evo1-1-7B-8K; only the trained weights differ (Evo 1.5 = Evo 1 (8k) + ~50% more pretraining tokens).evo-1-8k-base at 8 192-token context (i.e. Evo 1.5 is not trained from scratch; the additional ~150 B tokens are appended to Evo 1's 300 B-token training run).evo-design/evo-1.5-8k-base@main.max_abs_diff = 0.000e+00) to the evo-design reference at all 34 representation levels (token embedding + each of the 32 hybrid blocks + final RMSNorm), using attn_implementation="flash_attention_2" in bf16 (matches the reference's backend choice and the trained dtype). Logits from Evo1ForCausalLM were also verified bit-exact (top-1 agreement: 128/128 positions). Verified on H100 with PyTorch 2.7.1 / CUDA 12.9.flash_attention_2 is bit-exact with the original togethercomputer / evo-design implementations (same CUDA kernel). The sdpa and eager backends use different kernels (PyTorch's bundled flash kernel and pure-PyTorch matmul, respectively); these compute mathematically equivalent attention but accumulate floating-point operations in slightly different orders, producing per-block diffs at the bf16 noise floor (relative error roughly 1e-4 to 1e-2).flash_attention_2 if you need to match the reference's activations bit-for-bit.| Model | Context | Notes |
|---|---|---|
| Taykhoom/Evo1-1-7B-8K | 8 192 | Original Evo 1 base model (8k context). |
| Taykhoom/Evo1-1-7B-131K | 131 072 | Long-context Evo 1 with linearly-scaled RoPE (131k context). |
| Taykhoom/Evo1-1.5-7B-8K | 8 192 | Evo 1.5: Evo 1 (8k) further trained on ~50% more pretraining tokens. |
Note on dtype. Evo1 was trained in bfloat16, with the Hyenapoles/residues(modal-form filter parameters) and rotaryinv_freqkept in fp32 for numerical stability.from_pretraineddefaults to bf16 and the bundled remote model code automatically restores these fp32 invariants after checkpoint loading and after later.to(...),.half(), or.bfloat16()calls; no manual repair call is needed.
Note on attention backend. By default,from_pretrainedselectsattn_implementation="sdpa"(PyTorch's bundled scaled-dot-product-attention) - this works out of the box withoutflash_attninstalled. The original togethercomputer / evo-design implementations useflash_attnunconditionally; for bit-exact reproduction of reference outputs, explicitly passattn_implementation="flash_attention_2"(andpip install flash-attn). See Numerical equivalence across attention backends for the magnitude of the difference.
1import torch
2from transformers import AutoTokenizer, AutoModel
3
4tokenizer = AutoTokenizer.from_pretrained("Taykhoom/Evo1-1.5-7B-8K", trust_remote_code=True)
5model = AutoModel.from_pretrained(
6 "Taykhoom/Evo1-1.5-7B-8K",
7 trust_remote_code=True,
8 attn_implementation="flash_attention_2", # bit-exact with reference; or omit to default to "sdpa"
9).cuda().eval()
10
11seqs = ["ACGTACGTACGT", "GGGTTTAAACCC"]
12inputs = tokenizer(seqs, return_tensors="pt", padding=True).to(model.device)
13
14with torch.no_grad():
15 out = model(**inputs, output_hidden_states=True)
16
17last_hidden = out.last_hidden_state # (B, T, 4096)
18all_layers = out.hidden_states # tuple of (B, T, 4096), len = 34 (embed + 32 blocks + post-norm)
19layer_12_emb = all_layers[12] # often used as a "middle" representation1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3
4tokenizer = AutoTokenizer.from_pretrained("Taykhoom/Evo1-1.5-7B-8K", trust_remote_code=True)
5model = AutoModelForCausalLM.from_pretrained(
6 "Taykhoom/Evo1-1.5-7B-8K",
7 trust_remote_code=True,
8 attn_implementation="flash_attention_2",
9).cuda().eval()
10
11inputs = tokenizer(["ACGT"], return_tensors="pt").to(model.device)
12with torch.no_grad():
13 logits = model(**inputs).logits # (1, T, 512)attn_implementation to use PyTorch SDPA, pass "eager" for
materialized attention probabilities, or pass "flash_attention_2" (with
flash-attn installed) for bit-exact parity with the upstream implementation.1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3
4tokenizer = AutoTokenizer.from_pretrained("Taykhoom/Evo1-1.5-7B-8K", trust_remote_code=True)
5model = AutoModelForCausalLM.from_pretrained(
6 "Taykhoom/Evo1-1.5-7B-8K",
7 trust_remote_code=True,
8 attn_implementation="flash_attention_2",
9).cuda().eval()
10
11inputs = tokenizer(["ACGT"], return_tensors="pt").to(model.device)
12out = model.generate(**inputs, max_new_tokens=128, do_sample=True, top_k=4, temperature=1.0)
13print(tokenizer.decode(out[0]))generation_config.json ships with eos_token_id = 0 (the EOD byte) and pad_token_id = 1 so model.generate() stops naturally at the trained end-of-document token without needing extra kwargs. Note that the tokenizer itself does not add an EOS at encoding time - this matches the original Evo1 inference pipeline (only generation stops on EOS; embedding/scoring uses raw byte input).Cache limitation: cached generation is reliable for one prompt or an equal-length batch. Variable-length padded batches are not cache-safe; run those prompts separately. Start each new generation withpast_key_values=Nonerather than reusing or resetting anEvo1Cache.
1import torch
2from transformers import AutoTokenizer, AutoModel
3
4tokenizer = AutoTokenizer.from_pretrained("Taykhoom/Evo1-1.5-7B-8K", trust_remote_code=True)
5model = AutoModel.from_pretrained(
6 "Taykhoom/Evo1-1.5-7B-8K",
7 trust_remote_code=True,
8 attn_implementation="eager", # avoids the automatic eager fallback
9).cuda().eval()
10
11inputs = tokenizer(["ACGTACGT"], return_tensors="pt").to(model.device)
12with torch.no_grad():
13 out = model(**inputs, output_attentions=True)
14
15# out.attentions is a tuple of length 32. Entries at indices not in [8, 16, 24]
16# are None (Hyena blocks have no attention matrix). Entries at [8, 16, 24] are
17# (B, num_heads, T, T) tensors.
18attn_block_8 = out.attentions[8]accelerate's device_map is supported (_no_split_modules is set so each AttentionBlock / ParallelGatedConvBlock stays atomic on one device, with hidden state automatically transferred across device boundaries):1import torch
2from transformers import AutoTokenizer, AutoModel
3
4tokenizer = AutoTokenizer.from_pretrained("Taykhoom/Evo1-1.5-7B-8K", trust_remote_code=True)
5model = AutoModel.from_pretrained(
6 "Taykhoom/Evo1-1.5-7B-8K",
7 trust_remote_code=True,
8 attn_implementation="flash_attention_2",
9 device_map="auto", # auto-shard across all visible GPUs; falls back to single GPU if only one is present
10).eval()pip install accelerate.last_hidden_state (or any intermediate hidden_states[i]) and feed it into a downstream head.base_model_prefix = "backbone" exposes the raw StripedHyena module through .base_model. Its public forward accepts standard HF arguments (input_ids, attention_mask, past_key_values, use_cache, output_hidden_states, output_attentions, return_dict) and returns BaseModelOutputWithPast; AutoModel delegates to this same path.attention.py). Replaces flash_attn.modules.mha.MHA with a small in-repo MHA class that supports attn_implementation="eager" / "sdpa" / "flash_attention_2". Learned parameter names (Wqkv, out_proj) are preserved so existing checkpoints load unchanged. When output_attentions=True, the sdpa and flash paths automatically fall back to eager so the attention matrix is materialized.rotary.py). inv_freq is treated as non-persistent runtime state and reconstructed from base and dim in fp32 after checkpoint loading and whenever the RoPE cache is rebuilt. When flash_attn is installed we delegate application to its Triton kernel; the pure-PyTorch fallback likewise performs the rotary multiply in fp32 before casting back. This avoids the per-layer error caused by bf16 frequency or multiplication rounding.engine.py). Ported from the togethercomputer reference (FFT-based long convolution, modal-form prefill).cache.py). Evo1Cache(transformers.cache_utils.Cache) wraps the two block-type-specific inference param dataclasses (InferenceParams for attention KV cache, RecurrentInferenceParams for Hyena FIR window + IIR modal state). Exposes get_seq_length() / get_max_cache_shape() so HF's model.generate() can introspect cache state; falls through to cache["mha"] / cache["hyena"] for the model internals.tokenization_evo1.py). Byte-level UTF-8 with vocab_size = 512. Pad token is byte \x01. No CLS, no EOS appended at encoding time (matches original Evo1 inference). The _decode method is numpy-2.x compatible (the original np.uint8.clip(min=32, max=512) was an overflow on numpy 2).torch, transformers, numpy, safetensors, huggingface_hub (only for from_pretrained downloads). flash_attn is only required if you pass attn_implementation="flash_attention_2".1@article{merchant2025_evo_1_5,
2 title = {Semantic design of functional de novo genes from a genomic language model},
3 author = {Merchant, Aditi T. and King, Samuel H. and Nguyen, Eric and Hie, Brian L.},
4 journal = {Nature},
5 volume = {649},
6 number = {8097},
7 pages = {749--758},
8 year = {2025},
9 doi = {10.1038/s41586-025-09749-7}
10}
11
12@article{nguyen2024_evo,
13 title = {Sequence modeling and design from molecular to genome scale with {Evo}},
14 author = {Nguyen, Eric and Poli, Michael and Durrant, Matthew G. and Kang, Brian and Katrekar, Dhruva and Li, David B. and Bartie, Liam J. and Thomas, Armin W. and King, Samuel H. and Brixi, Garyk and Sullivan, Jeremy and Ng, Madelena Y. and Lewis, Ashley and Lou, Aaron and Ermon, Stefano and Baccus, Stephen A. and Hernandez-Boussard, Tina and {R{\'e}}, Christopher and Hsu, Patrick D. and Hie, Brian L.},
15 journal = {Science},
16 volume = {386},
17 number = {6723},
18 pages = {eado9336},
19 year = {2024},
20 doi = {10.1126/science.ado9336}
21}