Mila
Deep Neural Network Library
Loading...
Searching...
No Matches
ModelPackage.ixx File Reference

A package directory: the manifest, the files it declares, and whether they agree. More...

#include <cstdint>
#include <filesystem>
#include <format>
#include <fstream>
#include <ios>
#include <stdexcept>
#include <string>
#include <string_view>
#include <system_error>
#include <utility>
#include <vector>
import Distribution.ModelManifest;
import Distribution.Sha256;

Classes

class  Mila::Distribution::ModelPackage
 Everything a published or installable model is, as a directory. More...
struct  Mila::Distribution::PackageRequest
 One model's files, as a caller hands them to the packager. More...
struct  Mila::Distribution::PackageValidation
 What validation found. More...

Namespaces

namespace  Mila
 Mila main API namespace.

Functions

ModelPackage Mila::Distribution::buildPackage (const PackageRequest &request)
 Assemble a package.
std::string Mila::Distribution::sha256OfFile (const std::filesystem::path &path)
 Digest a file on disk.

Variables

constexpr std::string_view Mila::Distribution::kManifestFileName = "mila.json"
 The manifest's name at a package root and at a hub repository root. One name, both places.

Detailed Description

A package directory: the manifest, the files it declares, and whether they agree.

The same directory installs locally and uploads to a hub, so a package that is not self-consistent must never be emitted. See Specifications/ModelDistribution.md.

Function Documentation

◆ buildPackage()

ModelPackage Mila::Distribution::buildPackage ( const PackageRequest & request)
export

Assemble a package.

The manifest is rewritten rather than merged: one package is one model at one precision, so a re-export replaces what was there instead of leaving stale digests beside fresh ones. The digests are computed here and never authored – a manifest edited by hand after a re-export is a repository that fails verification on every download.

Exceptions
std::runtime_errorif a required input is missing.

◆ sha256OfFile()

std::string Mila::Distribution::sha256OfFile ( const std::filesystem::path & path)
export

Digest a file on disk.

Exposed because everything that produces a manifest entry needs it, and a digest computed two different ways is a digest that disagrees with itself eventually.