|
Mila
Deep Neural Network Library
|
Everything a published or installable model is, as a directory. More...
Public Member Functions | |
| const std::filesystem::path & | directory () const noexcept |
| const ModelManifest & | manifest () const noexcept |
| std::filesystem::path | pathOf (const ModelFile &file) const |
| Where a declared file lives in this package. | |
| PackageValidation | validate () const |
| Check the package against its own manifest, reading every declared byte. | |
Static Public Member Functions | |
| static ModelPackage | open (const std::filesystem::path &directory) |
| Read a package's manifest. | |
Everything a published or installable model is, as a directory.
|
inlinestatic |
Read a package's manifest.
Hashes nothing – that is validate()'s job.
| std::runtime_error | if the directory holds no manifest, or a malformed one. |
|
inline |
Where a declared file lives in this package.
| std::runtime_error | if the declared path would leave the package directory. A manifest can arrive from a hub, so a path is untrusted input and a .. in one is an attempt to write or read outside the package. |
|
inline |
Check the package against its own manifest, reading every declared byte.
The byte count is checked before the digest so a truncated file reports its length rather than an opaque mismatch, which is the difference between "the transfer stopped" and "the bytes are wrong".