feat: checkpoint distributed gguf runtime stories

This commit is contained in:
Dobromir Popov
2026-07-15 23:42:58 +03:00
parent eaf00f6add
commit 1fe31ef38d
60 changed files with 8478 additions and 105 deletions

View File

@@ -323,6 +323,10 @@ class TorchModelShard:
)
self.is_head = shard_start == 0
self.is_tail = shard_end >= self.total_layers - 1
self.loaded_shard_start = shard_start
self.loaded_shard_end = shard_end
self.owns_embedding = self.is_head
self.owns_final_head = self.is_tail
self.hidden_size = int(
getattr(self.model.config, "hidden_size", 0)
or getattr(self.model.config, "n_embd", 0)
@@ -344,6 +348,17 @@ class TorchModelShard:
ttl_seconds=float(os.environ.get("MESHNET_KV_TTL_SECONDS", "600")),
)
@property
def loaded_range(self) -> tuple[int, int]:
return self.loaded_shard_start, self.loaded_shard_end
@property
def endpoint_ownership(self) -> dict[str, bool]:
return {
"owns_embedding": self.owns_embedding,
"owns_final_head": self.owns_final_head,
}
def encode_prompt(self, prompt: str, session_id: str | None = None) -> TensorPayload:
if not self.is_head or self._embed_tokens is None:
raise ModelBackendError("text prompts can only be accepted by the head shard")