relay working with qwen2.5;

relay anounced on node ready
This commit is contained in:
Dobromir Popov
2026-07-09 10:48:32 +02:00
parent 4c6e1ed8b6
commit 1d3fb060ae
6 changed files with 100 additions and 7 deletions

View File

@@ -18,6 +18,7 @@ from meshnet_node.model_backend import (
SessionCacheStore,
TailTokenResult,
TensorPayload,
TorchModelShard,
)
from meshnet_node.torch_server import TorchNodeServer
@@ -98,6 +99,40 @@ def test_drop_removes_session():
store.lookup("s1")
def test_prefill_cache_triton_cpu_failure_disables_cache_and_retries_stateless():
"""CPU shards must recover when hybrid model cache path dispatches Triton."""
shard = object.__new__(TorchModelShard)
shard.model_id = "fake-hybrid"
shard.supports_kv_cache = True
shard._effective_start = lambda start_layer=None: 22
shard._new_session_cache = lambda: object()
calls = []
def fake_run_layers(hidden_states, attention_mask, position_ids, *, start_layer=None, cache=None, past_len=0):
calls.append({"cache": cache, "past_len": past_len})
if cache is not None:
raise RuntimeError("Pointer argument cannot be accessed from Triton (cpu tensor?)")
return "stateless-ok"
shard._run_layers = fake_run_layers
result = TorchModelShard._run_layers_session(
shard,
hidden_states=object(),
attention_mask=None,
position_ids=None,
session_id="session-1",
cache_mode="prefill",
)
assert result == "stateless-ok"
assert shard.supports_kv_cache is False
assert len(calls) == 2
assert calls[0]["cache"] is not None
assert calls[1]["cache"] is None
# ---------------------------------------------------------------------------
# HTTP session protocol with fake cached backends
# ---------------------------------------------------------------------------