TensorsContainer
A checkpoint's tensors, materialized on demand: get(name) reads one entry onto the load policy's device, load_all() reads every entry, prefetch() starts reads ahead of use, evict() drops a materialized entry back to disk. names(), len() and in read the header only.
__init__
__init__(self, /, *args, **kwargs)
Initialize self. See help(type(self)) for accurate signature.
contains
containscontains(self, name: str) -> bool
contains(self, name: str) -> bool
contains(name) -> bool
Whether name is an entry.
entry
entryentry(self, name: str) -> clika_runtime._core.io.ContainerEntry | None
entry(self, name: str) -> clika_runtime._core.io.ContainerEntry | None
entry(name) -> ContainerEntry | None
The parsed metadata of one entry with no payload IO; None for an unknown or a composed name.
entry_bytes
entry_bytesentry_bytes(self, name: str) -> int
entry_bytes(self, name: str) -> int
entry_bytes(name) -> int
The on-disk payload bytes of one entry.
evict
evictevict(self, name: str) -> None
evict(self, name: str) -> None
evict(name) -> None
Drop a materialized entry back to disk; the next get() reads it again.
evict_all
evict_allevict_all(self) -> None
evict_all(self) -> None
evict_all() -> None
Drop every materialized entry back to disk.
get
getget(self, name: str) -> clika_runtime._core.Tensor
get(self, name: str) -> clika_runtime._core.Tensor
get(name) -> Tensor
The entry materialized on the load policy's device (read from disk on first use, then cached until evicted).
keys
keyskeys(self) -> list[str]
keys(self) -> list[str]
keys() -> list[str]
Every entry name (the dict spelling of names()).
load_all
load_allload_all(self) -> dict
load_all(self) -> dict
load_all() -> dict[str, Tensor]
Every entry materialized, as a dict.
load_into
load_intoload_into(self, name: str, dst: clika_runtime._core.Tensor, where: object | None = None) -> None
load_into(self, name: str, dst: clika_runtime._core.Tensor, where: object | None = None) -> None
load_into(name, dst, where=None) -> None
Read the entry into an existing tensor of the same shape and dtype.
names
namesnames(self) -> list[str]
names(self) -> list[str]
names() -> list[str]
Every entry name, header order.
open
open(*args, **kwargs)
open(path: str, *, device: object | None = None, sticky: bool = False) -> clika_runtime._core.io.TensorsContainer
open(path, *, device=None, sticky=False) -> TensorsContainer
Open a checkpoint by its suffix: .safetensors, a torch checkpoint (.pt / .pth / .bin / .ckpt) or .gguf. Entries materialize on device (a Device, a device string or a Stream; None = the CPU); sticky keeps their lineage on disk so derived tensors can be evicted and re-read.
prefetch
prefetchprefetch(self, names: collections.abc.Sequence[str], where: object | None = None) -> None
prefetch(self, names: collections.abc.Sequence[str], where: object | None = None) -> None
prefetch(names, where=None) -> None
Start reading the named entries ahead of use, onto where (a Device, a device string or a Stream; None = the load policy's device).
release
releaserelease(self, name: str) -> None
release(self, name: str) -> None
release(name) -> None
Drop the container's own handle to a materialized entry; tensors already handed out stay valid.
size
sizesize(self) -> int
size(self) -> int
size() -> int
The entry count.
total_bytes
total_bytestotal_bytes(self) -> int
total_bytes(self) -> int
total_bytes() -> int
The payload bytes of every entry, summed.