class Monolith index.on(pool).save("index.safegraphs")
copy = DenseIndex.load_ram("index.safegraphs", executor=pool) # A new, mutable index in host memory
view = DenseIndex.view_ram("index.safegraphs") # Served in place, read-onlyLoading creates a handle rather than filling one, its geometry read from the checkpoint’s own headers, and a cancelled or failed load creates none.
The executor a load fans out over is its executor= keyword, and without one it reads on the calling thread.
A view maps the file instead of copying it, so opening costs the headers alone, and every mutating verb on it raises ReadOnlyError.
To learn a checkpoint’s shape without opening a shard, ask for its metadata, a DenseMetadata struct sequence whose fields are the geometry every empty constructor takes:
metadata = DenseIndex.metadata_read("index.safegraphs")
empty = DenseIndex.init_ram(
metadata.dimensions, metadata.metric, metadata.quantization, connectivity=metadata.connectivity
)Residency is never among those fields, because where the payload lives stays the caller’s choice.
save_buffer returns one monolith of every shard as a Monolith over the arena it is handed, and load_ram_buffer and metadata_read_buffer read one back from any buffer.
API
ClassMonolithThe bytes save_buffer wrote into an Arena, one (length,) run of 'B'.3
__buffer__Host memory only; device memory raises DeviceError, a rewound arena UninitializedError.
__len__Rows, or bytes of a Monolith.
__cuda_array_interface__Version 3 of the CUDA Array Interface, present only over device memory.
ClassDenseMetadataThe geometry and metric a checkpoint froze.4
class DenseMetadata(structseq[Any], tuple[int, DenseMetric, Scalar, int]) dimensionsScalars per stored vector.
dimensions: int metricThe DenseMetric the checkpoint scores with.
metric: DenseMetric quantizationThe Scalar its vectors are stored and quantized into.
quantization: Scalar connectivityConnections per node the graph was built with.
connectivity: int