Preserve desktop VRAM reserve and portable CPU compression setup

This commit is contained in:
admin committed 2026-10-12 12:36:11 +02:00
1 parent e8512b56f5
commit eb456b37ea
15 files changed
+255 -25

No files matched your search

+27 -3
View File
@@ -13,9 +13,10 @@ RUNNER = ROOT / "libexec/hermes-stack-llama-run"
PROFILE = ROOT / "libexec/hermes-stack-llama-profile"
RESTART = ROOT / "libexec/hermes-stack-llama-restart"
OPTIONS = """--model --hf-repo --mmproj --alias --host --port --ctx-size --parallel
--jinja --reasoning --reasoning-budget --reasoning-preserve --flash-attn --threads
--jinja --reasoning --reasoning-budget --reasoning-preserve --no-reasoning-preserve --flash-attn --threads
--threads-batch --n-gpu-layers --fit --fit-target --cache-type-k --cache-type-v
--sleep-idle-seconds --image-min-tokens --cors-origins --no-ui"""
--sleep-idle-seconds --image-min-tokens --cors-origins --no-ui --rope-scaling --rope-scale --yarn-orig-ctx
--device --no-op-offload --no-kv-offload"""
class LlamaTests(unittest.TestCase):
@@ -72,7 +73,8 @@ class LlamaTests(unittest.TestCase):
return result
def test_profile_values(self):
for name, ctx, margin in [("baseline", "65536", "1536"),
for name, ctx, margin in [("desktop-64k", "65536", "4096"),
("baseline", "65536", "1536"),
("vram-64k", "65536", "1280"),
("balanced", "49152", "1536"),
("vram-plus", "49152", "1280"),
@@ -85,6 +87,28 @@ class LlamaTests(unittest.TestCase):
self.assertEqual(args.count("--ctx-size"), 1)
self.assertIn("qwen38-27b-local", args)
def test_cpu_compression_template_uses_separate_config(self):
model = self.root / "compression model.gguf"
model.touch()
template = (ROOT / "config/compression.env.example").read_text()
template = template.replace('LLAMA_SERVER_BIN=""',
f'LLAMA_SERVER_BIN={shlex.quote(str(self.server))}')
template = template.replace(
'LLAMA_MODEL="$HOME/.local/share/hermes-stack/models/qwen3-1.7b-compression/Qwen3-1.7B-Q4_K_M.gguf"',
f'LLAMA_MODEL={shlex.quote(str(model))}')
config = self.config / "compression.env"
config.write_text(template)
self.env["HERMES_LLAMA_CONFIG"] = str(config)
self.run_tool(RUNNER)
args = self.record.read_text().splitlines()
self.assertEqual(args[args.index("--port") + 1], "8081")
self.assertEqual(args[args.index("--device") + 1], "none")
self.assertIn("--no-op-offload", args)
self.assertIn("--no-kv-offload", args)
self.assertIn(str(model), args)
self.assertNotIn("qwen38-27b-local", args)
self.assertNotIn("--fit-target", args)
def test_check_does_not_run_inference(self):
self.run_tool(RUNNER, "--check")
self.assertFalse(self.record.exists())