Storage Interface

class ffp.storage.Storage[source]

Common interface to finalfusion storage types.

abstract property shape

The storage shape

Returns

(rows, cols) – Tuple with storage dimensions

Return type

Tuple[int, int]

abstract classmethod load(file: BinaryIO, mmap=False) → ffp.storage.storage.Storage[source]

Load Storage from the given finalfusion file.

Parameters
  • file (BinaryIO) – File at the beginning of a finalfusion storage

  • mmap (bool) – Toggles memory mapping the buffer.

Returns

storage – The storage from the file.

Return type

Storage

abstract static mmap_storage(file: BinaryIO) → ffp.storage.storage.Storage[source]

Memory map the storage.

Parallel method to ffp.io.Chunk.read_chunk(). Instead of storing the Storage in-memory, it memory maps the embeddings.

Parameters

file (BinaryIO) – File at the beginning of a finalfusion storage

Returns

storage – The memory mapped storage.

Return type

Storage