evo2-flash 0.1.0__py3-none-any.whl
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/__init__.py +75 -0
- evo2_flash/api.py +1210 -0
- evo2_flash/attention.py +102 -0
- evo2_flash/cfg.py +655 -0
- evo2_flash/cfg_reference.py +158 -0
- evo2_flash/cfg_sample.py +95 -0
- evo2_flash/config.py +230 -0
- evo2_flash/convert.py +780 -0
- evo2_flash/evo2_configs/evo2-1b-8k.yml +64 -0
- evo2_flash/evo2_configs/evo2-20b-1m.yml +66 -0
- evo2_flash/evo2_configs/evo2-40b-1m.yml +66 -0
- evo2_flash/evo2_configs/evo2-40b-8k.yml +63 -0
- evo2_flash/evo2_configs/evo2-7b-1m.yml +65 -0
- evo2_flash/evo2_configs/evo2-7b-262k.yml +65 -0
- evo2_flash/evo2_configs/evo2-7b-8k.yml +63 -0
- evo2_flash/fp8_emul.py +88 -0
- evo2_flash/fp8_emul_triton.py +294 -0
- evo2_flash/mixers.py +1423 -0
- evo2_flash/model.py +379 -0
- evo2_flash/mtp_draft.py +271 -0
- evo2_flash/surgery.py +225 -0
- evo2_flash/test/__init__.py +0 -0
- evo2_flash/test/data/prompts.csv +5 -0
- evo2_flash/test/test_evo2.py +111 -0
- evo2_flash/triton_decode.py +211 -0
- evo2_flash/triton_hcl.py +123 -0
- evo2_flash/triton_norm.py +156 -0
- evo2_flash/triton_prefill.py +501 -0
- evo2_flash/triton_verifier.py +178 -0
- evo2_flash-0.1.0.dist-info/METADATA +225 -0
- evo2_flash-0.1.0.dist-info/RECORD +36 -0
- evo2_flash-0.1.0.dist-info/WHEEL +5 -0
- evo2_flash-0.1.0.dist-info/entry_points.txt +2 -0
- evo2_flash-0.1.0.dist-info/licenses/LICENSE +202 -0
- evo2_flash-0.1.0.dist-info/licenses/NOTICE +6 -0
- evo2_flash-0.1.0.dist-info/top_level.txt +1 -0
evo2_flash/__init__.py
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""Out-of-tree vLLM plugin for Evo 2 / StripedHyena2.
|
|
2
|
+
|
|
3
|
+
Drop-in replacement for `evo2.Evo2` (see evo2_flash/api.py and README.md):
|
|
4
|
+
|
|
5
|
+
from evo2_flash import Evo2
|
|
6
|
+
model = Evo2("evo2_7b")
|
|
7
|
+
|
|
8
|
+
Lower level:
|
|
9
|
+
|
|
10
|
+
import evo2_flash; evo2_flash.register()
|
|
11
|
+
from vllm import LLM
|
|
12
|
+
llm = LLM(model="ckpt/evo2_7b_hf", skip_tokenizer_init=True, ...)
|
|
13
|
+
|
|
14
|
+
If installed as a package, the same thing happens automatically via the
|
|
15
|
+
`vllm.general_plugins` entry point declared in pyproject.toml.
|
|
16
|
+
|
|
17
|
+
Ported from github.com/AlexYkHao/evo2-vllm at 5d6396e. Comments that cite
|
|
18
|
+
`tests/`, `scripts/`, `evo2_layers/`, `PLAN.md`, `MTP_DRAFTER.md`, `FP8_SURGERY.md`
|
|
19
|
+
or `docs/` refer to that repository.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from .config import StripedHyena2Config
|
|
23
|
+
|
|
24
|
+
__all__ = ["StripedHyena2Config", "register", "Evo2", "CharLevelTokenizer",
|
|
25
|
+
"GenerationOutput", "MODEL_NAMES"]
|
|
26
|
+
|
|
27
|
+
_API = {"Evo2", "CharLevelTokenizer", "GenerationOutput", "MODEL_NAMES",
|
|
28
|
+
"reverse_complement", "layer_name_table"}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def __getattr__(name):
|
|
32
|
+
# Lazy, so `import evo2_flash` (e.g. by the converter, in an env without
|
|
33
|
+
# vLLM) does not import vLLM.
|
|
34
|
+
if name in _API:
|
|
35
|
+
from . import api
|
|
36
|
+
|
|
37
|
+
return getattr(api, name)
|
|
38
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
39
|
+
|
|
40
|
+
_REGISTERED = False
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def register() -> None:
|
|
44
|
+
"""Register the config with transformers and the model with vLLM."""
|
|
45
|
+
global _REGISTERED
|
|
46
|
+
if _REGISTERED:
|
|
47
|
+
return
|
|
48
|
+
|
|
49
|
+
from transformers import AutoConfig
|
|
50
|
+
|
|
51
|
+
from .config import Evo2MTPConfig
|
|
52
|
+
|
|
53
|
+
for name, cls in (("striped_hyena2", StripedHyena2Config), ("evo2_mtp", Evo2MTPConfig)):
|
|
54
|
+
try:
|
|
55
|
+
AutoConfig.register(name, cls)
|
|
56
|
+
except ValueError:
|
|
57
|
+
pass # already registered
|
|
58
|
+
|
|
59
|
+
from vllm import ModelRegistry
|
|
60
|
+
|
|
61
|
+
ModelRegistry.register_model(
|
|
62
|
+
"StripedHyena2ForCausalLM",
|
|
63
|
+
"evo2_flash.model:StripedHyena2ForCausalLM",
|
|
64
|
+
)
|
|
65
|
+
# MTP draft head, run by vLLM's EAGLE proposer (speculative method "eagle").
|
|
66
|
+
ModelRegistry.register_model(
|
|
67
|
+
"EagleEvo2MTPModel",
|
|
68
|
+
"evo2_flash.mtp_draft:EagleEvo2MTPModel",
|
|
69
|
+
)
|
|
70
|
+
# ... and its EAGLE-3 form (multi-layer target features; method "eagle3").
|
|
71
|
+
ModelRegistry.register_model(
|
|
72
|
+
"Eagle3Evo2MTPModel",
|
|
73
|
+
"evo2_flash.mtp_draft:Eagle3Evo2MTPModel",
|
|
74
|
+
)
|
|
75
|
+
_REGISTERED = True
|