-
Notifications
You must be signed in to change notification settings - Fork 137
Expand file tree
/
Copy pathall.py
More file actions
58 lines (45 loc) · 1.22 KB
/
all.py
File metadata and controls
58 lines (45 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"""
Run all linear attention examples (test + benchmark).
Usage::
python -m examples.linear.all
HELION_USE_DEFAULT_CONFIG=1 python -m examples.linear.all
"""
from __future__ import annotations
import importlib
import sys
import traceback
EXAMPLES = [
"example_simple_gla",
"example_full_gla",
"example_delta_rule",
"example_gated_delta_rule",
"example_vanilla_linear_attn",
"example_retention",
"example_mamba2_ssd",
"example_rwkv6",
"example_kda",
]
def main() -> None:
results: list[tuple[str, str]] = []
for name in EXAMPLES:
print(f"\n{'=' * 70}")
print(f" {name}")
print(f"{'=' * 70}")
try:
mod = importlib.import_module(f"examples.linear.{name}")
mod.main()
results.append((name, "OK"))
except Exception:
traceback.print_exc()
results.append((name, "FAIL"))
print(f"\n{'=' * 70}")
print(" Summary")
print(f"{'=' * 70}")
for name, status in results:
print(f" {name:<40} {status}")
ok = sum(1 for _, s in results if s == "OK")
print(f"\n{ok}/{len(results)} passed")
if ok < len(results):
sys.exit(1)
if __name__ == "__main__":
main()