MCPcopy Index your code
hub / github.com/abetlen/llama-cpp-python / _read_entry_payload

Method _read_entry_payload

examples/server/server.py:12427–12450  ·  view source on GitHub ↗
(
        self,
        entry: "SequenceDiskCache.Entry",
    )

Source from the content-addressed store, hash-verified

12425 )
12426
12427 def _read_entry_payload(
12428 self,
12429 entry: "SequenceDiskCache.Entry",
12430 ) -> "SequenceDiskCache.Payload":
12431 with self._safe_open(entry.path) as tensors:
12432 tokens = [
12433 int(token)
12434 for token in tensors.get_tensor(self.TENSOR_TOKENS).tolist()
12435 ]
12436 state_bytes = np.ascontiguousarray(
12437 tensors.get_tensor(self.TENSOR_STATE),
12438 dtype=np.uint8,
12439 ).copy()
12440 prompt_logits = (
12441 tensors.get_tensor(self.TENSOR_PROMPT_LOGITS)
12442 if entry.has_prompt_logits
12443 and self.TENSOR_PROMPT_LOGITS in tensors.keys()
12444 else None
12445 )
12446 return SequenceDiskCache.Payload(
12447 tokens=tokens,
12448 state_bytes=state_bytes,
12449 prompt_logits=prompt_logits,
12450 )
12451
12452 def _write_entry(
12453 self,

Callers 1

loadMethod · 0.95

Calls 3

_safe_openMethod · 0.95
get_tensorMethod · 0.80
copyMethod · 0.45

Tested by

no test coverage detected