|
Mila 0.13.48
Deep Neural Network Library
|
Classes | |
| class | ArchiveSerializer |
| Interface for hierarchical archive serializers. More... | |
| struct | ITensorBlob |
| Type-erased interface for a serialized tensor blob. More... | |
| class | ModelArchive |
| ModelArchive provides high-level helpers for component serialization. More... | |
| struct | PretrainedMetadata |
| Metadata for pretrained model. More... | |
| class | PretrainedModelReader |
| Reader for Mila pretrained binary format. More... | |
| class | SerializationMetadata |
| Type-safe metadata container for component serialization. More... | |
| class | Serializer |
| Minimal base interface for model serialization backends. More... | |
| struct | TensorBlob |
| Concrete tensor blob owning a TensorBuffer-backed raw byte buffer. More... | |
| struct | TensorBlobMetadata |
| Metadata for a tensor blob in pretrained model format. More... | |
| struct | TensorMetadata |
| Metadata describing a tensor in serialized form. More... | |
| class | ZipSerializer |
| ZIP archive serializer built on miniz. More... | |
Typedefs | |
| using | json = nlohmann::json |
| using | Mila::Dnn::Serialization::MetadataValue |
| Type-safe metadata value supporting common serialization types. | |
Enumerations | |
| enum class | DType : uint32_t { Float32 = 0 , Float16 = 1 , BFloat16 = 2 , Int32 = 3 } |
| enum class | Mila::Dnn::Serialization::OpenMode { Read , Write } |
| Mode indicating whether the archive is used for reading or writing. More... | |
| enum class | Mila::Dnn::Serialization::SerializationMode { Checkpoint , WeightsOnly , Architecture } |
| Modes for serialization and deserialization. More... | |
Functions | |
| constexpr std::string_view | Mila::Dnn::Serialization::archiveModeToString (OpenMode mode) |
| Convert ArchiveMode to string. | |
| TensorDataType | dtypeToTensorDataType (uint32_t dtype) |
| template<typename MR = Compute::CpuMemoryResource> requires isValidTensor<dtype_t::UINT8, MR> | |
| TensorBlob< MR > | Mila::Dnn::Serialization::readTensorBlob (const ModelArchive &archive, const std::string &prefix, int device_id=0) |
| Read tensor metadata and raw bytes from prefix into a typed blob. | |
| std::string | Mila::Dnn::Serialization::serializationModeToString (SerializationMode mode) |
| Convert a SerializationMode value to a human-readable string. | |
| void | Mila::Dnn::Serialization::writeTensorBlob (ModelArchive &archive, const std::string &prefix, const TensorMetadata &meta, const void *data, size_t size) |
| Write tensor metadata and raw bytes under the given prefix into archive. | |
| using Mila::Dnn::Serialization::json = nlohmann::json |
|
export |
Type-safe metadata value supporting common serialization types.
Encapsulates primitive types, strings, and structured data without exposing the underlying serialization format to user code.
|
strong |
|
exportstrong |
Mode indicating whether the archive is used for reading or writing.
Preconditions:
Semantics:
Example:
| Enumerator | |
|---|---|
| Read | |
| Write | |
|
exportstrong |
|
constexprexport |
Convert ArchiveMode to string.

|
inline |

|
export |
Read tensor metadata and raw bytes from prefix into a typed blob.
Allocates a TensorBuffer<UINT8, MR> sized to total_bytes and reads directly into it via readBlobInto — no intermediate vector copy. When MR is CudaPinnedMemoryResource the returned blob carries a pinned host pointer ready for direct DMA in copyFromBlob.
| MR | Memory resource for the blob data buffer. Defaults to CpuMemoryResource. |
| archive | ModelArchive to read from |
| prefix | Path prefix for tensor files (e.g., "tensors/weight") |
| device_id | Device index passed to the memory resource constructor. |
| std::runtime_error | if read operations fail or size mismatch detected |

|
export |
Convert a SerializationMode value to a human-readable string.
| mode | The serialization mode to convert. |

|
inlineexport |
Write tensor metadata and raw bytes under the given prefix into archive.
Writes: prefix + "/meta.json" — TensorMetadata as SerializationMetadata prefix + "/data.bin" — raw tensor bytes
| archive | ModelArchive to write to |
| prefix | Path prefix for tensor files (e.g., "tensors/weight") |
| meta | Tensor metadata |
| data | Pointer to raw tensor bytes |
| size | Number of bytes to write |
| std::runtime_error | if write operations fail |

