Track Kimi model metadata and cache path

This commit is contained in:
Dobromir Popov
2026-07-01 12:38:31 +02:00
parent 78834e5045
commit bc760c1694
7 changed files with 231 additions and 10 deletions

View File

@@ -197,6 +197,65 @@ def test_benchmark_throughput_is_registered_in_payload(monkeypatch, tmp_path):
assert captured["hardware_profile"]["benchmark_ok"] is True
def test_real_model_startup_passes_download_dir_and_kimi_metadata(monkeypatch, tmp_path):
import meshnet_node.startup as startup_mod
captured_registration: dict = {}
captured_torch_kwargs: dict = {}
class FakeBackend:
total_layers = 61
class FakeNode:
backend = FakeBackend()
def __init__(self, **kwargs):
captured_torch_kwargs.update(kwargs)
def start(self):
return 7099
def stop(self):
pass
def apply_tracker_directives(self, directives):
return None
monkeypatch.setattr(
startup_mod,
"detect_hardware",
lambda: {"device": "cpu", "gpu_name": None, "vram_mb": 0, "ram_mb": 16384},
)
monkeypatch.setattr(startup_mod, "benchmark_throughput_checked", lambda _device: (42.5, True, None))
monkeypatch.setattr(startup_mod, "TorchNodeServer", FakeNode)
monkeypatch.setattr(startup_mod, "load_or_create_wallet", lambda **_kw: (b"", b"", "wallet-kimi"))
monkeypatch.setattr(startup_mod, "_get_json", lambda _url, timeout=10.0: {"relay_url": None, "nodes": []})
monkeypatch.setattr(
startup_mod,
"_post_json",
lambda _url, payload, timeout=10.0: (
captured_registration.update(payload) or {"node_id": "node-kimi"}
),
)
monkeypatch.setattr(startup_mod, "_start_heartbeat", lambda *a, **kw: None)
cache_dir = tmp_path / "models"
node = run_startup(
tracker_url="http://localhost:8080",
model_id="unsloth/Kimi-K2.7-Code",
shard_start=0,
shard_end=60,
wallet_path=tmp_path / "wallet.json",
cache_dir=cache_dir,
)
node.stop()
assert captured_torch_kwargs["cache_dir"] == cache_dir
assert captured_registration["model_metadata"]["total_parameters"] == "1T"
assert captured_registration["model_metadata"]["activated_parameters"] == "32B"
assert captured_registration["model_metadata"]["context_length"] == 256000
def test_cuda_benchmark_failure_is_registered_for_inventory_only_gpu(monkeypatch, tmp_path, capsys):
import meshnet_node.startup as startup_mod