evo2-flash 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- evo2_flash-0.1.0/LICENSE +202 -0
- evo2_flash-0.1.0/NOTICE +6 -0
- evo2_flash-0.1.0/PKG-INFO +225 -0
- evo2_flash-0.1.0/README.md +205 -0
- evo2_flash-0.1.0/evo2_flash/__init__.py +75 -0
- evo2_flash-0.1.0/evo2_flash/api.py +1210 -0
- evo2_flash-0.1.0/evo2_flash/attention.py +102 -0
- evo2_flash-0.1.0/evo2_flash/cfg.py +655 -0
- evo2_flash-0.1.0/evo2_flash/cfg_reference.py +158 -0
- evo2_flash-0.1.0/evo2_flash/cfg_sample.py +95 -0
- evo2_flash-0.1.0/evo2_flash/config.py +230 -0
- evo2_flash-0.1.0/evo2_flash/convert.py +780 -0
- evo2_flash-0.1.0/evo2_flash/evo2_configs/evo2-1b-8k.yml +64 -0
- evo2_flash-0.1.0/evo2_flash/evo2_configs/evo2-20b-1m.yml +66 -0
- evo2_flash-0.1.0/evo2_flash/evo2_configs/evo2-40b-1m.yml +66 -0
- evo2_flash-0.1.0/evo2_flash/evo2_configs/evo2-40b-8k.yml +63 -0
- evo2_flash-0.1.0/evo2_flash/evo2_configs/evo2-7b-1m.yml +65 -0
- evo2_flash-0.1.0/evo2_flash/evo2_configs/evo2-7b-262k.yml +65 -0
- evo2_flash-0.1.0/evo2_flash/evo2_configs/evo2-7b-8k.yml +63 -0
- evo2_flash-0.1.0/evo2_flash/fp8_emul.py +88 -0
- evo2_flash-0.1.0/evo2_flash/fp8_emul_triton.py +294 -0
- evo2_flash-0.1.0/evo2_flash/mixers.py +1423 -0
- evo2_flash-0.1.0/evo2_flash/model.py +379 -0
- evo2_flash-0.1.0/evo2_flash/mtp_draft.py +271 -0
- evo2_flash-0.1.0/evo2_flash/surgery.py +225 -0
- evo2_flash-0.1.0/evo2_flash/test/__init__.py +0 -0
- evo2_flash-0.1.0/evo2_flash/test/data/prompts.csv +5 -0
- evo2_flash-0.1.0/evo2_flash/test/test_evo2.py +111 -0
- evo2_flash-0.1.0/evo2_flash/triton_decode.py +211 -0
- evo2_flash-0.1.0/evo2_flash/triton_hcl.py +123 -0
- evo2_flash-0.1.0/evo2_flash/triton_norm.py +156 -0
- evo2_flash-0.1.0/evo2_flash/triton_prefill.py +501 -0
- evo2_flash-0.1.0/evo2_flash/triton_verifier.py +178 -0
- evo2_flash-0.1.0/evo2_flash.egg-info/PKG-INFO +225 -0
- evo2_flash-0.1.0/evo2_flash.egg-info/SOURCES.txt +39 -0
- evo2_flash-0.1.0/evo2_flash.egg-info/dependency_links.txt +1 -0
- evo2_flash-0.1.0/evo2_flash.egg-info/entry_points.txt +2 -0
- evo2_flash-0.1.0/evo2_flash.egg-info/requires.txt +7 -0
- evo2_flash-0.1.0/evo2_flash.egg-info/top_level.txt +1 -0
- evo2_flash-0.1.0/pyproject.toml +33 -0
- evo2_flash-0.1.0/setup.cfg +4 -0
evo2_flash-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
evo2_flash-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: evo2-flash
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Evo 2 / StripedHyena2 on vLLM: an out-of-tree plugin with a drop-in evo2.Evo2 API
|
|
5
|
+
Author: Garyk Brixi, Yukun Alex Hao
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Repository, https://github.com/evo-design/evo2_flash
|
|
8
|
+
Requires-Python: <3.13,>=3.11
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
License-File: NOTICE
|
|
12
|
+
Requires-Dist: torch
|
|
13
|
+
Requires-Dist: transformers
|
|
14
|
+
Requires-Dist: safetensors
|
|
15
|
+
Requires-Dist: numpy
|
|
16
|
+
Requires-Dist: pyyaml
|
|
17
|
+
Requires-Dist: huggingface_hub
|
|
18
|
+
Requires-Dist: filelock
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# evo2_flash
|
|
22
|
+
|
|
23
|
+
Evo 2 (StripedHyena2) on vLLM, with a drop-in replacement for `evo2.Evo2`. Evo2_flash supports more accessible genomic ICL across diverse biological systems.
|
|
24
|
+
|
|
25
|
+
## Requirements and install
|
|
26
|
+
|
|
27
|
+
- vLLM **0.26.0**, the `+cu129` wheel (the PyPI default is cu130), with torch 2.11 and
|
|
28
|
+
Python 3.12. vLLM is not a declared dependency, so install it first.
|
|
29
|
+
- One GPU; the numbers below are from H100/H200. The fp8 input projections that the 1B,
|
|
30
|
+
7B, 20B and 40B checkpoints ship with run as fp8 GEMMs on sm_89+ (L4, L40S, H100,
|
|
31
|
+
H200). Older GPUs (A100, RTX 3090, A40) need the fallback described under
|
|
32
|
+
[GPUs without FP8 tensor cores](#gpus-without-fp8-tensor-cores). 40B needs an H200,
|
|
33
|
+
or fp8 weights on an H100.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# vLLM 0.26.0, CUDA 12.9 build: runs on CUDA 12 and CUDA 13 drivers.
|
|
37
|
+
# (PyPI's default vllm build is CUDA 13 and cannot use the GPU on a CUDA 12 driver.)
|
|
38
|
+
pip install "https://github.com/vllm-project/vllm/releases/download/v0.26.0/vllm-0.26.0+cu129-cp38-abi3-manylinux_2_28_x86_64.whl" \
|
|
39
|
+
--extra-index-url https://download.pytorch.org/whl/cu129
|
|
40
|
+
pip install evo2-flash # registers the plugin via the vllm.general_plugins entry point
|
|
41
|
+
export VLLM_ENABLE_V1_MULTIPROCESSING=0 # Evo2 sets this itself; the API needs the engine in-process
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`dtype="bfloat16"` is mandatory: Evo 2's residual stream reaches ~1e12, and fp16 gives NaN.
|
|
45
|
+
|
|
46
|
+
### Check the install
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
python -m evo2_flash.test.test_evo2 --model_name evo2_7b
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This is Evo 2's own correctness test (`python -m evo2.test.test_evo2`), run through
|
|
53
|
+
evo2_flash. It scores four sequences and passes, with exit code 0, when the mean loss is
|
|
54
|
+
within 1e-3 of the value the Evo 2 authors published. On one H100 the delta is 2.92e-4
|
|
55
|
+
for `evo2_7b` and 4.96e-4 for `evo2_1b_base`. Each run takes about a minute once the
|
|
56
|
+
checkpoint is converted. `--local_path` points it at a converted directory, and
|
|
57
|
+
`--kv_cache_dtype fp8` checks the fp8 KV cache, with a tolerance of 5e-3 (H100,
|
|
58
|
+
`evo2_7b`: 9.31e-4).
|
|
59
|
+
|
|
60
|
+
## Quick start
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
# from evo2 import Evo2
|
|
64
|
+
from evo2_flash import Evo2
|
|
65
|
+
|
|
66
|
+
model = Evo2("evo2_7b")
|
|
67
|
+
scores = model.score_sequences(seqs) # mean log-likelihood per sequence
|
|
68
|
+
out = model.generate(prompts, n_tokens=500, temperature=1.0, top_k=4)
|
|
69
|
+
out.sequences, out.logprobs_mean
|
|
70
|
+
logits, emb = model(input_ids, return_embeddings=True, layer_names=["blocks.28.mlp.l3"])
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Pass a whole prompt list in one call. vLLM batches ragged lengths continuously, and a
|
|
74
|
+
repeated prompt's prefill is shared through the prefix cache.
|
|
75
|
+
|
|
76
|
+
Lower level, with plain `vllm.LLM`. The tokenizer is byte-level, so token ids are UTF-8
|
|
77
|
+
bytes:
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
import evo2_flash; evo2_flash.register() # not needed once pip-installed
|
|
81
|
+
from vllm import LLM, SamplingParams
|
|
82
|
+
from vllm.inputs import TokensPrompt
|
|
83
|
+
|
|
84
|
+
llm = LLM(model="/path/to/evo2_7b_hf", skip_tokenizer_init=True, dtype="bfloat16",
|
|
85
|
+
enable_prefix_caching=True, max_num_seqs=128)
|
|
86
|
+
outs = llm.generate([TokensPrompt(prompt_token_ids=list(b"ACGT..."))],
|
|
87
|
+
SamplingParams(max_tokens=500, temperature=1.0, top_k=4,
|
|
88
|
+
ignore_eos=True, detokenize=False)) # EOD is id 0
|
|
89
|
+
bytes(outs[0].outputs[0].token_ids).decode("ascii", "replace")
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`evo2_flash.api.engine_kwargs(ckpt)` returns the validated engine configuration that
|
|
93
|
+
`Evo2` uses. On a GPU without FP8 tensor cores, pass the checkpoint through
|
|
94
|
+
`evo2_flash.api.checkpoint_for_this_gpu(path)` first. `Evo2` does this itself, but a
|
|
95
|
+
plain `LLM` does not.
|
|
96
|
+
|
|
97
|
+
## Drop-in replacement for evo2.Evo2
|
|
98
|
+
|
|
99
|
+
| evo2 | evo2_flash | difference |
|
|
100
|
+
|---|---|---|
|
|
101
|
+
| `Evo2(name, local_path=None, use_kernels=False)` | same | `local_path` may also be a converted dir; `use_kernels` ignored |
|
|
102
|
+
| `model.tokenizer` (`CharLevelTokenizer(512)`) | same semantics | `tokenize` returns `int`s, not `np.uint8` |
|
|
103
|
+
| `score_sequences(seqs, batch_size, prepend_bos, reduce_method, average_reverse_complement)` | same | one vLLM call; log-softmax in fp32 (evo2: bf16) |
|
|
104
|
+
| `generate(prompt_seqs, n_tokens, temperature, top_k, top_p, batched, cached_generation, verbose, force_prompt_threshold)` | same, + `seed=`, `prime_prefix_cache=`, CFG arguments | one vLLM call; `temperature=0` is greedy; `logits` lazy |
|
|
105
|
+
| `forward(input_ids, return_embeddings, layer_names)` / `model(...)` | same | vortex names mapped (table below); outputs on the GPU |
|
|
106
|
+
| `model.model` (vortex `StripedHyena`) | `model.model` (`StripedHyena2ForCausalLM`) | plugin module names; use `layer_names` for vortex names |
|
|
107
|
+
|
|
108
|
+
Semantic differences, all deliberate or unavoidable:
|
|
109
|
+
|
|
110
|
+
- **Scoring.** All sequences go into one vLLM call, so `batch_size` has no effect. Scores
|
|
111
|
+
match evo2's `batch_size=1`. evo2 with `batch_size>1`, ragged lengths and
|
|
112
|
+
`prepend_bos=False` also scores one spurious pad position for each shorter sequence.
|
|
113
|
+
`score_sequences` requests prompt logprobs, which turns off the prefix-cache read.
|
|
114
|
+
- **Sampling.** Matches vortex `sample()`, and `top_k=1` is argmax at any temperature.
|
|
115
|
+
`top_k<=0` means the whole vocabulary, and `top_p<=0` or `>=1` turns top-p off.
|
|
116
|
+
`temperature=0` with `top_k!=1` is greedy here, whereas vortex divides by zero. With
|
|
117
|
+
`seed=s`, request i uses seed `s+i` and reproduces exactly.
|
|
118
|
+
- **Length / EOS.** Every prompt gets exactly `n_tokens`, and EOD does not stop
|
|
119
|
+
generation, as in evo2. `logprobs_mean` is the mean log-probability of the sampled
|
|
120
|
+
tokens under the raw, untempered distribution. `batched`, `cached_generation` and
|
|
121
|
+
`force_prompt_threshold` are accepted but do nothing.
|
|
122
|
+
- **`GenerationOutput.logits`** has vortex's layout. It is computed on first access by
|
|
123
|
+
one extra prefill over prompt + completion, so the values are prefill logits. They
|
|
124
|
+
agree with decode-time logits to bf16 precision. Extra fields: `token_ids` and
|
|
125
|
+
`num_cached_tokens`.
|
|
126
|
+
- **forward().** Each row of `input_ids` is an independent causal sequence, and pad ids
|
|
127
|
+
are ordinary tokens. Logits come back bf16 `(B, L, 512)`. CUDA graphs are switched off
|
|
128
|
+
for these steps only, because a replayed graph does not run Python hooks.
|
|
129
|
+
|
|
130
|
+
`layer_names` takes vortex module names (native names such as `model.layers.3.mixer` are
|
|
131
|
+
also accepted):
|
|
132
|
+
|
|
133
|
+
| vortex name | plugin module (hooked tensor) |
|
|
134
|
+
|---|---|
|
|
135
|
+
| `embedding_layer` | `model.embed_tokens` |
|
|
136
|
+
| `blocks.N` | `model.layers.N` (residual stream after block N) |
|
|
137
|
+
| `blocks.N.pre_norm`, `blocks.N.post_norm` | `model.layers.N.{pre,post}_norm` |
|
|
138
|
+
| `blocks.N.mlp`, `blocks.N.mlp.l3` | `model.layers.N.mlp` / `.mlp.l3` (MLP output, before the residual add) |
|
|
139
|
+
| `blocks.N.mlp.l1`, `blocks.N.mlp.l2` | `model.layers.N.mlp.l1` / `.l2` (before the gate) |
|
|
140
|
+
| `blocks.N.projections` (Hyena) | `model.layers.N.mixer.in_proj` (3H, fp8 GEMM output) |
|
|
141
|
+
| `blocks.N.filter` (Hyena) | **input** of `model.layers.N.mixer.out_proj` (gated Hyena output) |
|
|
142
|
+
| `blocks.N.out_filter_dense` (Hyena) | `model.layers.N.mixer.out_proj` (mixer output, before the residual add) |
|
|
143
|
+
| `blocks.N.inner_mha_cls`, `.inner_mha_cls.out_proj` (attention) | `model.layers.N.mixer` / `.mixer.o_proj` |
|
|
144
|
+
| `norm` | `model.norm` |
|
|
145
|
+
| `unembed` | the returned logits |
|
|
146
|
+
|
|
147
|
+
The following names raise `ValueError`:
|
|
148
|
+
- `inner_mha_cls.Wqkv`, because the converter permutes its rows
|
|
149
|
+
- rotary, inner-attention and HyenaCascade internals
|
|
150
|
+
- a Hyena name used on an attention block, and the reverse
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
## Options
|
|
154
|
+
|
|
155
|
+
| `Evo2(...)` argument | effect |
|
|
156
|
+
|---|---|
|
|
157
|
+
| `kv_cache_dtype="fp8"` | 2x KV capacity. Lossy: moves the upstream gate by 1.2-1.8e-3 (7B/20B/40B) |
|
|
158
|
+
| `quantization="fp8"` (engine override) | fp8 weights: 2.2e-3 (40B) / 2.95e-3 (7B) on the gate; fits 40B on one 80 GB GPU |
|
|
159
|
+
| `speculative=<head dir>` | a trained EAGLE/EAGLE-3 draft head, K=3, probabilistic drafting: 1.3-1.7x at 7B, 1.3-2.0x at 20B |
|
|
160
|
+
| `cfg=True` | installs the classifier-free-guidance logits processor, enabling `generate(..., guidance=w)` |
|
|
161
|
+
| `max_model_len`, `gpu_memory_utilization` (0.85), `cache_dir` | engine sizing and the checkpoint cache |
|
|
162
|
+
|
|
163
|
+
Classifier-free guidance computes `guided = l_cond + w * (l_cond - l_base)`. The baseline
|
|
164
|
+
is `baseline_prompt` (`cfg_type="uncond"`) or `negative_prompts[i]` (`cfg_type="negative"`),
|
|
165
|
+
and `dna_only=True` restricts sampling to A/C/G/T. CFG and speculative decoding are mutually
|
|
166
|
+
exclusive, because vLLM rejects custom logits processors under speculation.
|
|
167
|
+
|
|
168
|
+
fp8-surgery checkpoints run without fp8 GEMMs. In these checkpoints block 0 is served
|
|
169
|
+
from an exact token table, and optionally some Hyena layers emulate Hopper fp8
|
|
170
|
+
accumulation (`hyena_token_table_layers`, `hyena_fp8_emulated_layers`,
|
|
171
|
+
`hyena_fp8_emulated_channels` in the config). They load like any other converted
|
|
172
|
+
checkpoint. The 1B's table variant is built by
|
|
173
|
+
`evo2_flash.convert.build_token_table_checkpoint`; the others come from
|
|
174
|
+
`scripts/fp8_surgery.py` in the source repository.
|
|
175
|
+
|
|
176
|
+
Other `vllm.LLM` arguments pass through with a warning. `dtype`, `tokenizer`,
|
|
177
|
+
`skip_tokenizer_init` and `model` cannot be overridden.
|
|
178
|
+
|
|
179
|
+
## Checkpoints
|
|
180
|
+
|
|
181
|
+
`Evo2("evo2_7b")` looks for `$EVO2_VLLM_CACHE/evo2_7b_hf`, defaulting to
|
|
182
|
+
`$HF_HOME/evo2_vllm`. If that directory is missing, it finds the vortex `.pt` the way evo2
|
|
183
|
+
does, downloading the HF snapshot if absent, and converts it once with
|
|
184
|
+
`evo2_flash.convert.convert_checkpoint`. The vortex configs ship in
|
|
185
|
+
`evo2_flash/evo2_configs/`, so evo2 and vortex need not be installed. 40B's `.pt.part0/.part1`
|
|
186
|
+
shards are read in place.
|
|
187
|
+
|
|
188
|
+
You can also pass a converted directory, `Evo2("/path/to/evo2_7b_hf")`, or a finetuned
|
|
189
|
+
vortex `.pt`, `Evo2("evo2_7b", local_path="ft.pt")`. Checkpoints converted by
|
|
190
|
+
`vllm_evo2` load unchanged.
|
|
191
|
+
|
|
192
|
+
Names: `evo2_7b`, `evo2_7b_262k`, `evo2_7b_base`, `evo2_7b_microviridae`, `evo2_1b_base`,
|
|
193
|
+
`evo2_20b`, `evo2_40b`, `evo2_40b_base` (`evo2_flash.MODEL_NAMES`).
|
|
194
|
+
|
|
195
|
+
## GPUs without FP8 tensor cores
|
|
196
|
+
|
|
197
|
+
On sm < 8.9 (A100, RTX 3090, A40), vLLM serves the fp8 in_proj as weight-only Marlin.
|
|
198
|
+
That works for the 7B, which scores 2.5-3.8e-4 on the gate on an A100 and an RTX 3090.
|
|
199
|
+
The stock 1B, however, depends on Hopper's FP8 rounding in block 0 and loses all signal
|
|
200
|
+
there: gate loss 0.805 against the authors' 0.502. `Evo2(...)` handles this through
|
|
201
|
+
`checkpoint_for_this_gpu`:
|
|
202
|
+
|
|
203
|
+
- **1B and 20B:** the published checkpoints carry a `surgery/` sidecar. On these GPUs
|
|
204
|
+
`Evo2(...)` builds the FP8-free form from it once into the checkpoint cache, and it
|
|
205
|
+
passes the strict gate. `fp8_mode="surgery"` forces that form on any GPU.
|
|
206
|
+
- **A 1B converted locally** (no sidecar): swapped for its token-table variant, built
|
|
207
|
+
once (about 20 s).
|
|
208
|
+
- **A 20B without a sidecar, and the 40B:** raise with instructions.
|
|
209
|
+
- **every 7B, and any surgery checkpoint:** used unchanged, as on sm_89+.
|
|
210
|
+
|
|
211
|
+
`EVO2_FP8_FALLBACK=off` keeps the stock checkpoint (diagnostics). On 24 GB cards such
|
|
212
|
+
as the L4, CFG sizes its admission waves to what the KV cache holds.
|
|
213
|
+
|
|
214
|
+
## Limitations
|
|
215
|
+
|
|
216
|
+
- One GPU per model. Tensor parallelism is not supported, because Hyena channels are
|
|
217
|
+
interleaved per triple, and pipeline parallelism is not supported either.
|
|
218
|
+
- Trained draft heads exist for 7B and 20B only.
|
|
219
|
+
|
|
220
|
+
## Third-party code
|
|
221
|
+
|
|
222
|
+
- `evo2_flash/triton_hcl.py`: the fused modal-filter kernel, vendored from
|
|
223
|
+
[Zymrael/vortex](https://github.com/Zymrael/vortex) (Apache-2.0).
|
|
224
|
+
- `evo2_flash/evo2_configs/*.yml`: the model configs from evo2 0.6.0 (Apache-2.0).
|
|
225
|
+
- `evo2_flash/test/data/prompts.csv`: evo2's test sequences (Apache-2.0).
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# evo2_flash
|
|
2
|
+
|
|
3
|
+
Evo 2 (StripedHyena2) on vLLM, with a drop-in replacement for `evo2.Evo2`. Evo2_flash supports more accessible genomic ICL across diverse biological systems.
|
|
4
|
+
|
|
5
|
+
## Requirements and install
|
|
6
|
+
|
|
7
|
+
- vLLM **0.26.0**, the `+cu129` wheel (the PyPI default is cu130), with torch 2.11 and
|
|
8
|
+
Python 3.12. vLLM is not a declared dependency, so install it first.
|
|
9
|
+
- One GPU; the numbers below are from H100/H200. The fp8 input projections that the 1B,
|
|
10
|
+
7B, 20B and 40B checkpoints ship with run as fp8 GEMMs on sm_89+ (L4, L40S, H100,
|
|
11
|
+
H200). Older GPUs (A100, RTX 3090, A40) need the fallback described under
|
|
12
|
+
[GPUs without FP8 tensor cores](#gpus-without-fp8-tensor-cores). 40B needs an H200,
|
|
13
|
+
or fp8 weights on an H100.
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# vLLM 0.26.0, CUDA 12.9 build: runs on CUDA 12 and CUDA 13 drivers.
|
|
17
|
+
# (PyPI's default vllm build is CUDA 13 and cannot use the GPU on a CUDA 12 driver.)
|
|
18
|
+
pip install "https://github.com/vllm-project/vllm/releases/download/v0.26.0/vllm-0.26.0+cu129-cp38-abi3-manylinux_2_28_x86_64.whl" \
|
|
19
|
+
--extra-index-url https://download.pytorch.org/whl/cu129
|
|
20
|
+
pip install evo2-flash # registers the plugin via the vllm.general_plugins entry point
|
|
21
|
+
export VLLM_ENABLE_V1_MULTIPROCESSING=0 # Evo2 sets this itself; the API needs the engine in-process
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`dtype="bfloat16"` is mandatory: Evo 2's residual stream reaches ~1e12, and fp16 gives NaN.
|
|
25
|
+
|
|
26
|
+
### Check the install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
python -m evo2_flash.test.test_evo2 --model_name evo2_7b
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
This is Evo 2's own correctness test (`python -m evo2.test.test_evo2`), run through
|
|
33
|
+
evo2_flash. It scores four sequences and passes, with exit code 0, when the mean loss is
|
|
34
|
+
within 1e-3 of the value the Evo 2 authors published. On one H100 the delta is 2.92e-4
|
|
35
|
+
for `evo2_7b` and 4.96e-4 for `evo2_1b_base`. Each run takes about a minute once the
|
|
36
|
+
checkpoint is converted. `--local_path` points it at a converted directory, and
|
|
37
|
+
`--kv_cache_dtype fp8` checks the fp8 KV cache, with a tolerance of 5e-3 (H100,
|
|
38
|
+
`evo2_7b`: 9.31e-4).
|
|
39
|
+
|
|
40
|
+
## Quick start
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
# from evo2 import Evo2
|
|
44
|
+
from evo2_flash import Evo2
|
|
45
|
+
|
|
46
|
+
model = Evo2("evo2_7b")
|
|
47
|
+
scores = model.score_sequences(seqs) # mean log-likelihood per sequence
|
|
48
|
+
out = model.generate(prompts, n_tokens=500, temperature=1.0, top_k=4)
|
|
49
|
+
out.sequences, out.logprobs_mean
|
|
50
|
+
logits, emb = model(input_ids, return_embeddings=True, layer_names=["blocks.28.mlp.l3"])
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Pass a whole prompt list in one call. vLLM batches ragged lengths continuously, and a
|
|
54
|
+
repeated prompt's prefill is shared through the prefix cache.
|
|
55
|
+
|
|
56
|
+
Lower level, with plain `vllm.LLM`. The tokenizer is byte-level, so token ids are UTF-8
|
|
57
|
+
bytes:
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
import evo2_flash; evo2_flash.register() # not needed once pip-installed
|
|
61
|
+
from vllm import LLM, SamplingParams
|
|
62
|
+
from vllm.inputs import TokensPrompt
|
|
63
|
+
|
|
64
|
+
llm = LLM(model="/path/to/evo2_7b_hf", skip_tokenizer_init=True, dtype="bfloat16",
|
|
65
|
+
enable_prefix_caching=True, max_num_seqs=128)
|
|
66
|
+
outs = llm.generate([TokensPrompt(prompt_token_ids=list(b"ACGT..."))],
|
|
67
|
+
SamplingParams(max_tokens=500, temperature=1.0, top_k=4,
|
|
68
|
+
ignore_eos=True, detokenize=False)) # EOD is id 0
|
|
69
|
+
bytes(outs[0].outputs[0].token_ids).decode("ascii", "replace")
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`evo2_flash.api.engine_kwargs(ckpt)` returns the validated engine configuration that
|
|
73
|
+
`Evo2` uses. On a GPU without FP8 tensor cores, pass the checkpoint through
|
|
74
|
+
`evo2_flash.api.checkpoint_for_this_gpu(path)` first. `Evo2` does this itself, but a
|
|
75
|
+
plain `LLM` does not.
|
|
76
|
+
|
|
77
|
+
## Drop-in replacement for evo2.Evo2
|
|
78
|
+
|
|
79
|
+
| evo2 | evo2_flash | difference |
|
|
80
|
+
|---|---|---|
|
|
81
|
+
| `Evo2(name, local_path=None, use_kernels=False)` | same | `local_path` may also be a converted dir; `use_kernels` ignored |
|
|
82
|
+
| `model.tokenizer` (`CharLevelTokenizer(512)`) | same semantics | `tokenize` returns `int`s, not `np.uint8` |
|
|
83
|
+
| `score_sequences(seqs, batch_size, prepend_bos, reduce_method, average_reverse_complement)` | same | one vLLM call; log-softmax in fp32 (evo2: bf16) |
|
|
84
|
+
| `generate(prompt_seqs, n_tokens, temperature, top_k, top_p, batched, cached_generation, verbose, force_prompt_threshold)` | same, + `seed=`, `prime_prefix_cache=`, CFG arguments | one vLLM call; `temperature=0` is greedy; `logits` lazy |
|
|
85
|
+
| `forward(input_ids, return_embeddings, layer_names)` / `model(...)` | same | vortex names mapped (table below); outputs on the GPU |
|
|
86
|
+
| `model.model` (vortex `StripedHyena`) | `model.model` (`StripedHyena2ForCausalLM`) | plugin module names; use `layer_names` for vortex names |
|
|
87
|
+
|
|
88
|
+
Semantic differences, all deliberate or unavoidable:
|
|
89
|
+
|
|
90
|
+
- **Scoring.** All sequences go into one vLLM call, so `batch_size` has no effect. Scores
|
|
91
|
+
match evo2's `batch_size=1`. evo2 with `batch_size>1`, ragged lengths and
|
|
92
|
+
`prepend_bos=False` also scores one spurious pad position for each shorter sequence.
|
|
93
|
+
`score_sequences` requests prompt logprobs, which turns off the prefix-cache read.
|
|
94
|
+
- **Sampling.** Matches vortex `sample()`, and `top_k=1` is argmax at any temperature.
|
|
95
|
+
`top_k<=0` means the whole vocabulary, and `top_p<=0` or `>=1` turns top-p off.
|
|
96
|
+
`temperature=0` with `top_k!=1` is greedy here, whereas vortex divides by zero. With
|
|
97
|
+
`seed=s`, request i uses seed `s+i` and reproduces exactly.
|
|
98
|
+
- **Length / EOS.** Every prompt gets exactly `n_tokens`, and EOD does not stop
|
|
99
|
+
generation, as in evo2. `logprobs_mean` is the mean log-probability of the sampled
|
|
100
|
+
tokens under the raw, untempered distribution. `batched`, `cached_generation` and
|
|
101
|
+
`force_prompt_threshold` are accepted but do nothing.
|
|
102
|
+
- **`GenerationOutput.logits`** has vortex's layout. It is computed on first access by
|
|
103
|
+
one extra prefill over prompt + completion, so the values are prefill logits. They
|
|
104
|
+
agree with decode-time logits to bf16 precision. Extra fields: `token_ids` and
|
|
105
|
+
`num_cached_tokens`.
|
|
106
|
+
- **forward().** Each row of `input_ids` is an independent causal sequence, and pad ids
|
|
107
|
+
are ordinary tokens. Logits come back bf16 `(B, L, 512)`. CUDA graphs are switched off
|
|
108
|
+
for these steps only, because a replayed graph does not run Python hooks.
|
|
109
|
+
|
|
110
|
+
`layer_names` takes vortex module names (native names such as `model.layers.3.mixer` are
|
|
111
|
+
also accepted):
|
|
112
|
+
|
|
113
|
+
| vortex name | plugin module (hooked tensor) |
|
|
114
|
+
|---|---|
|
|
115
|
+
| `embedding_layer` | `model.embed_tokens` |
|
|
116
|
+
| `blocks.N` | `model.layers.N` (residual stream after block N) |
|
|
117
|
+
| `blocks.N.pre_norm`, `blocks.N.post_norm` | `model.layers.N.{pre,post}_norm` |
|
|
118
|
+
| `blocks.N.mlp`, `blocks.N.mlp.l3` | `model.layers.N.mlp` / `.mlp.l3` (MLP output, before the residual add) |
|
|
119
|
+
| `blocks.N.mlp.l1`, `blocks.N.mlp.l2` | `model.layers.N.mlp.l1` / `.l2` (before the gate) |
|
|
120
|
+
| `blocks.N.projections` (Hyena) | `model.layers.N.mixer.in_proj` (3H, fp8 GEMM output) |
|
|
121
|
+
| `blocks.N.filter` (Hyena) | **input** of `model.layers.N.mixer.out_proj` (gated Hyena output) |
|
|
122
|
+
| `blocks.N.out_filter_dense` (Hyena) | `model.layers.N.mixer.out_proj` (mixer output, before the residual add) |
|
|
123
|
+
| `blocks.N.inner_mha_cls`, `.inner_mha_cls.out_proj` (attention) | `model.layers.N.mixer` / `.mixer.o_proj` |
|
|
124
|
+
| `norm` | `model.norm` |
|
|
125
|
+
| `unembed` | the returned logits |
|
|
126
|
+
|
|
127
|
+
The following names raise `ValueError`:
|
|
128
|
+
- `inner_mha_cls.Wqkv`, because the converter permutes its rows
|
|
129
|
+
- rotary, inner-attention and HyenaCascade internals
|
|
130
|
+
- a Hyena name used on an attention block, and the reverse
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
## Options
|
|
134
|
+
|
|
135
|
+
| `Evo2(...)` argument | effect |
|
|
136
|
+
|---|---|
|
|
137
|
+
| `kv_cache_dtype="fp8"` | 2x KV capacity. Lossy: moves the upstream gate by 1.2-1.8e-3 (7B/20B/40B) |
|
|
138
|
+
| `quantization="fp8"` (engine override) | fp8 weights: 2.2e-3 (40B) / 2.95e-3 (7B) on the gate; fits 40B on one 80 GB GPU |
|
|
139
|
+
| `speculative=<head dir>` | a trained EAGLE/EAGLE-3 draft head, K=3, probabilistic drafting: 1.3-1.7x at 7B, 1.3-2.0x at 20B |
|
|
140
|
+
| `cfg=True` | installs the classifier-free-guidance logits processor, enabling `generate(..., guidance=w)` |
|
|
141
|
+
| `max_model_len`, `gpu_memory_utilization` (0.85), `cache_dir` | engine sizing and the checkpoint cache |
|
|
142
|
+
|
|
143
|
+
Classifier-free guidance computes `guided = l_cond + w * (l_cond - l_base)`. The baseline
|
|
144
|
+
is `baseline_prompt` (`cfg_type="uncond"`) or `negative_prompts[i]` (`cfg_type="negative"`),
|
|
145
|
+
and `dna_only=True` restricts sampling to A/C/G/T. CFG and speculative decoding are mutually
|
|
146
|
+
exclusive, because vLLM rejects custom logits processors under speculation.
|
|
147
|
+
|
|
148
|
+
fp8-surgery checkpoints run without fp8 GEMMs. In these checkpoints block 0 is served
|
|
149
|
+
from an exact token table, and optionally some Hyena layers emulate Hopper fp8
|
|
150
|
+
accumulation (`hyena_token_table_layers`, `hyena_fp8_emulated_layers`,
|
|
151
|
+
`hyena_fp8_emulated_channels` in the config). They load like any other converted
|
|
152
|
+
checkpoint. The 1B's table variant is built by
|
|
153
|
+
`evo2_flash.convert.build_token_table_checkpoint`; the others come from
|
|
154
|
+
`scripts/fp8_surgery.py` in the source repository.
|
|
155
|
+
|
|
156
|
+
Other `vllm.LLM` arguments pass through with a warning. `dtype`, `tokenizer`,
|
|
157
|
+
`skip_tokenizer_init` and `model` cannot be overridden.
|
|
158
|
+
|
|
159
|
+
## Checkpoints
|
|
160
|
+
|
|
161
|
+
`Evo2("evo2_7b")` looks for `$EVO2_VLLM_CACHE/evo2_7b_hf`, defaulting to
|
|
162
|
+
`$HF_HOME/evo2_vllm`. If that directory is missing, it finds the vortex `.pt` the way evo2
|
|
163
|
+
does, downloading the HF snapshot if absent, and converts it once with
|
|
164
|
+
`evo2_flash.convert.convert_checkpoint`. The vortex configs ship in
|
|
165
|
+
`evo2_flash/evo2_configs/`, so evo2 and vortex need not be installed. 40B's `.pt.part0/.part1`
|
|
166
|
+
shards are read in place.
|
|
167
|
+
|
|
168
|
+
You can also pass a converted directory, `Evo2("/path/to/evo2_7b_hf")`, or a finetuned
|
|
169
|
+
vortex `.pt`, `Evo2("evo2_7b", local_path="ft.pt")`. Checkpoints converted by
|
|
170
|
+
`vllm_evo2` load unchanged.
|
|
171
|
+
|
|
172
|
+
Names: `evo2_7b`, `evo2_7b_262k`, `evo2_7b_base`, `evo2_7b_microviridae`, `evo2_1b_base`,
|
|
173
|
+
`evo2_20b`, `evo2_40b`, `evo2_40b_base` (`evo2_flash.MODEL_NAMES`).
|
|
174
|
+
|
|
175
|
+
## GPUs without FP8 tensor cores
|
|
176
|
+
|
|
177
|
+
On sm < 8.9 (A100, RTX 3090, A40), vLLM serves the fp8 in_proj as weight-only Marlin.
|
|
178
|
+
That works for the 7B, which scores 2.5-3.8e-4 on the gate on an A100 and an RTX 3090.
|
|
179
|
+
The stock 1B, however, depends on Hopper's FP8 rounding in block 0 and loses all signal
|
|
180
|
+
there: gate loss 0.805 against the authors' 0.502. `Evo2(...)` handles this through
|
|
181
|
+
`checkpoint_for_this_gpu`:
|
|
182
|
+
|
|
183
|
+
- **1B and 20B:** the published checkpoints carry a `surgery/` sidecar. On these GPUs
|
|
184
|
+
`Evo2(...)` builds the FP8-free form from it once into the checkpoint cache, and it
|
|
185
|
+
passes the strict gate. `fp8_mode="surgery"` forces that form on any GPU.
|
|
186
|
+
- **A 1B converted locally** (no sidecar): swapped for its token-table variant, built
|
|
187
|
+
once (about 20 s).
|
|
188
|
+
- **A 20B without a sidecar, and the 40B:** raise with instructions.
|
|
189
|
+
- **every 7B, and any surgery checkpoint:** used unchanged, as on sm_89+.
|
|
190
|
+
|
|
191
|
+
`EVO2_FP8_FALLBACK=off` keeps the stock checkpoint (diagnostics). On 24 GB cards such
|
|
192
|
+
as the L4, CFG sizes its admission waves to what the KV cache holds.
|
|
193
|
+
|
|
194
|
+
## Limitations
|
|
195
|
+
|
|
196
|
+
- One GPU per model. Tensor parallelism is not supported, because Hyena channels are
|
|
197
|
+
interleaved per triple, and pipeline parallelism is not supported either.
|
|
198
|
+
- Trained draft heads exist for 7B and 20B only.
|
|
199
|
+
|
|
200
|
+
## Third-party code
|
|
201
|
+
|
|
202
|
+
- `evo2_flash/triton_hcl.py`: the fused modal-filter kernel, vendored from
|
|
203
|
+
[Zymrael/vortex](https://github.com/Zymrael/vortex) (Apache-2.0).
|
|
204
|
+
- `evo2_flash/evo2_configs/*.yml`: the model configs from evo2 0.6.0 (Apache-2.0).
|
|
205
|
+
- `evo2_flash/test/data/prompts.csv`: evo2's test sequences (Apache-2.0).
|