package kaun

  1. Overview
  2. Docs

Module Kaun.Checkpoint

module Snapshot : sig ... end

Generic tree structure capable of storing heterogeneous tensors and scalar metadata.

type artifact_kind =
  1. | Params
  2. | Optimizer
  3. | Rng
  4. | Payload of string
  5. | Custom of string
  6. | Unknown of string
type artifact
type artifact_descriptor = {
  1. kind : artifact_kind;
  2. label : string;
  3. slug : string;
}
type manifest = {
  1. version : int;
  2. step : int option;
  3. created_at : float;
  4. tags : string list;
  5. metadata : (string * string) list;
  6. artifacts : artifact_descriptor list;
}
type repository
type retention = {
  1. max_to_keep : int option;
  2. keep_every : int option;
}
type metadata = (string * string) list
type error =
  1. | Io of string
  2. | Json of string
  3. | Corrupt of string
  4. | Not_found of string
  5. | Duplicate_slug of string
  6. | Invalid of string
val error_to_string : error -> string
val artifact : ?label:string -> kind:artifact_kind -> snapshot:Snapshot.t -> unit -> artifact
val artifact_kind : artifact -> artifact_kind
val artifact_label : artifact -> string
val artifact_slug : artifact -> string
val artifact_snapshot : artifact -> Snapshot.t
val create_repository : directory:string -> ?retention:retention -> unit -> repository
val write : step:int -> ?tags:string list -> ?metadata:metadata -> artifacts:artifact list -> repository -> (manifest, error) result
val read : repository -> step:int -> (manifest * artifact list, error) result
val read_latest : repository -> (manifest * artifact list, error) result
val steps : repository -> int list
val latest_step : repository -> int option
val mem : repository -> step:int -> bool
val delete : repository -> step:int -> (unit, error) result
val filter_artifacts : ?kinds:artifact_kind list -> artifact list -> artifact list
val read_artifact_snapshot : repository -> step:int -> slug:string -> (Snapshot.t, error) result
val save_snapshot_file : path:string -> snapshot:Snapshot.t -> (unit, error) result
val load_snapshot_file : path:string -> (Snapshot.t, error) result
val write_snapshot_file_with : path:string -> encode:(unit -> Snapshot.t) -> (unit, error) result
val load_snapshot_file_with : path:string -> decode:(Snapshot.t -> ('a, string) result) -> ('a, error) result
val save_params_file : path:string -> params:Ptree.t -> (unit, error) result
val load_params_file : path:string -> (Ptree.t, error) result