Skip to content

Kyojin: open-source engine that runs 100 GB-class open models (GLM-5.3, Qwen3.8, DeepSeek V4.1) on one desktop machine. AMD Strix Halo, NVIDIA RTX and Apple Mac. OpenAI API, built on ExLlamaV3.

Serve tests: the fake engines answer prompt_ids, as the real ones do

YanissAmz90fb3bb77c7e
diff --git a/tools/glm/test_serve.py b/tools/glm/test_serve.py
index 7e8cb17..829fb95 100644
--- a/tools/glm/test_serve.py
+++ b/tools/glm/test_serve.py
@@ -33,6 +33,13 @@ class FakeEngine:
def count_tokens(self, text: str) -> int:
return len(text.split())
+ def prompt_ids(self, prompt: str):
+ """The ids the routes count prompt tokens with (the real engines read them from an encode cache).
+
+ Placeholders of count_tokens() length: the routes only ask for numel()."""
+ import torch
+ return torch.zeros(self.count_tokens(prompt), dtype=torch.long)
+
async def generate(self, prompt: str, **kwargs):
self.prompts.append(prompt)
self.last_stats = {"cached_tokens": 8, "new_tokens": 4, "prompt_tokens": 20,
diff --git a/tools/qwen/test_serve.py b/tools/qwen/test_serve.py
index 51be01b..1687736 100644
--- a/tools/qwen/test_serve.py
+++ b/tools/qwen/test_serve.py
@@ -57,6 +57,13 @@ class FakeEngine:
def count_tokens(self, text: str) -> int:
return len(text.split())
+ def prompt_ids(self, prompt: str):
+ """The ids the routes count prompt tokens with (the real engines read them from an encode cache).
+
+ Placeholders of count_tokens() length: the routes only ask for numel()."""
+ import torch
+ return torch.zeros(self.count_tokens(prompt), dtype=torch.long)
+
def spec_stats(self):
return {"speculative": True}