Finish DS4 execution parity
This commit is contained in:
@@ -10,10 +10,15 @@ import sys
|
||||
ROOT = pathlib.Path(__file__).resolve().parent.parent
|
||||
HARDWARE_TESTS = (
|
||||
"flash_resident_and_ssd_streaming_choose_the_same_tokens",
|
||||
"resident_multi_session_switching_preserves_each_kv_frontier",
|
||||
"legacy_mtp_runs_a_target_owned_greedy_cycle",
|
||||
"dspark_runs_a_target_owned_greedy_cycle",
|
||||
"ssd_streaming_supports_legacy_mtp_and_dspark",
|
||||
"directional_steering_matches_the_ds4_token_oracle",
|
||||
"resident_and_streamed_glm_match_the_short_code_fixture",
|
||||
"streamed_glm_uses_ds4_indexed_prefill_for_long_prompts",
|
||||
"glm_mtp_preserves_target_tokens_and_drafts",
|
||||
"pro_resident_and_ssd_streaming_choose_the_same_tokens",
|
||||
)
|
||||
ENDPOINT_SCRIPTS = (
|
||||
"endpoint_parity.py",
|
||||
|
||||
40
scripts/import_hotlists.py
Executable file
40
scripts/import_hotlists.py
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Regenerate the Rust expert hotlists from a DS4 source checkout."""
|
||||
|
||||
import argparse
|
||||
import pathlib
|
||||
import re
|
||||
|
||||
|
||||
ARRAY = re.compile(
|
||||
r"static const uint16_t ds4_default_streaming_hotlist_(\w+)\[\]\[2\] = \{(.*?)\n\};",
|
||||
re.DOTALL,
|
||||
)
|
||||
PAIR = re.compile(r"\{(\d+),\s*(\d+)\}")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("source", type=pathlib.Path)
|
||||
parser.add_argument("output", type=pathlib.Path)
|
||||
args = parser.parse_args()
|
||||
texts = [
|
||||
(args.source / "ds4_streaming_hotlist.inc").read_text(),
|
||||
(args.source / "ds4_streaming_hotlist_glm52.inc").read_text(),
|
||||
]
|
||||
arrays = {
|
||||
name: PAIR.findall(body)
|
||||
for text in texts
|
||||
for name, body in ARRAY.findall(text)
|
||||
}
|
||||
names = (("PRO", "pro"), ("FLASH", "flash"), ("GLM52", "glm52"))
|
||||
lines = ["// Generated mechanically by scripts/import_hotlists.py.\n"]
|
||||
for constant, source_name in names:
|
||||
lines.append(f"pub(super) const {constant}: &[(u16, u16)] = &[\n")
|
||||
lines.extend(f" ({layer}, {expert}),\n" for layer, expert in arrays[source_name])
|
||||
lines.append("];\n")
|
||||
args.output.write_text("".join(lines))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user