mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-05 07:48:45 +00:00
draft-cost table: on by default on Metal only; CUDA and HIP keep live costs
The taken-over table measured below live costs on CUDA (RTX PRO 5000, IQ3_S + MTP: code -1.5 %, chat -1.5 %, JSON +1.9 %, long -0.2 %, agent -0.5 %) and above them on Metal (M5 Max). serve/server.py now passes --draft-costs by default only on darwin; on other platforms the engine runs live costs exactly as without the flag. "draft_costs": true in a config turns the table on anywhere, false turns it off. Two tests in serve/test_server.py (DraftCosts).
This commit is contained in:
1 parent
9448501635
commit
1b11a76e8c
2 files changed
+30
-1
No files matched your search
+11
-1
@@ -4061,7 +4061,17 @@ def learned_profile_args(cfg: dict, args: list[str]) -> list[str]:
|
||||
return args
|
||||
|
||||
|
||||
DRAFT_COSTS_DEFAULT = True # repeatable output: on by default (owner decision); "draft_costs": false in a config turns it off
|
||||
DRAFT_COSTS_DEFAULT_PLATFORMS = ("darwin",) # Metal: the taken-over table measured above live costs there (M5 Max: Q2_0 code +2.6 %, chat +2.4 %, JSON +0.2 %; IQ3_S +0.2 / +0.6 / +0.7 %)
|
||||
|
||||
|
||||
def draft_costs_default(platform: str | None = None) -> bool:
|
||||
"""Repeatable output (owner decision) is the default only where the table was measured at or above live costs: Metal. On CUDA (RTX PRO 5000, IQ3_S: code
|
||||
-1.5 %, chat -1.5 %, JSON +1.9 % against live costs) and HIP the engine keeps live costs, as an engine started without --draft-costs does. `"draft_costs": true`
|
||||
in a config turns the table on anywhere (tests and A/Bs), `"draft_costs": false` turns it off."""
|
||||
return (platform or sys.platform) in DRAFT_COSTS_DEFAULT_PLATFORMS
|
||||
|
||||
|
||||
DRAFT_COSTS_DEFAULT = draft_costs_default() # "draft_costs": true / false in a config overrides it
|
||||
_engine_texts: dict = {}
|
||||
|
||||
|
||||
|
||||
@@ -2564,6 +2564,25 @@ class DraftCosts(unittest.TestCase):
|
||||
self.assertEqual(server.draft_costs_args({"model_name": "m"}, list(args)), args)
|
||||
self.assertEqual(server.draft_costs_args({"model_name": "m"}, list(args), str(self.tmp / "missing")), args)
|
||||
|
||||
def test_default_is_on_only_on_metal(self):
|
||||
# the taken-over table measured above live costs on Metal and below them on CUDA (l620, 11-13): live costs stay the default there and on HIP
|
||||
self.assertTrue(server.draft_costs_default("darwin"))
|
||||
for platform in ("linux", "win32", "cygwin", "freebsd14", "android"):
|
||||
self.assertFalse(server.draft_costs_default(platform), platform)
|
||||
self.assertEqual(server.DRAFT_COSTS_DEFAULT, sys.platform == "darwin")
|
||||
|
||||
def test_table_off_by_default_gives_no_flag_unless_the_config_asks(self):
|
||||
args = ["--native", "x", "--spec", "6"]
|
||||
new = self.tmp / "new-engine"
|
||||
new.write_bytes(b"\x7fELF strata --spec --serve --draft-costs --draft-costs-key")
|
||||
with mock.patch.object(server, "DRAFT_COSTS_DEFAULT", False): # CUDA / HIP class
|
||||
self.assertEqual(server.draft_costs_args({"model_name": "m"}, list(args), str(new)), args)
|
||||
self.assertIn("--draft-costs", server.draft_costs_args({"model_name": "m", "draft_costs": True}, list(args), str(new))) # the test switch
|
||||
self.assertEqual(server.draft_costs_args({"model_name": "m", "draft_costs": False}, list(args), str(new)), args)
|
||||
with mock.patch.object(server, "DRAFT_COSTS_DEFAULT", True): # Metal class
|
||||
self.assertIn("--draft-costs", server.draft_costs_args({"model_name": "m"}, list(args), str(new)))
|
||||
self.assertEqual(server.draft_costs_args({"model_name": "m", "draft_costs": False}, list(args), str(new)), args)
|
||||
|
||||
def test_on_gives_a_file_in_the_redirected_folder(self):
|
||||
args = ["--native", "x", "--spec", "6"]
|
||||
got = server.draft_costs_args({"model_name": "qwen3.8-flash-next-iq3_s", "draft_costs": True}, list(args))
|
||||
|
||||
Reference in new issue
Block a user