#[non_exhaustive]pub struct Provenance {Show 13 fields
pub format: String,
pub kind: ProvenanceKind,
pub id: String,
pub files: Vec<ArtifactFile>,
pub revision: String,
pub origin: String,
pub license: Option<String>,
pub base: Option<ProvenanceBase>,
pub dataset: Option<ProvenanceDataset>,
pub trainer: Option<ProvenanceTrainer>,
pub uploaded_by: Option<String>,
pub uploaded_ms: Option<u64>,
pub extra: BTreeMap<String, Value>,
}Expand description
Where a model, adapter or projector came from, kept next to its files
(PROVENANCE_FILE). It is what the uploader said, checked against the bytes where it
can be (files, hashes and revision are set from them on import); it is signed by nobody and
is not a trust anchor. Unknown fields (an app’s own) are kept in Provenance::extra and
written back.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.format: StringPROVENANCE_FORMAT, or an app’s own name.
kind: ProvenanceKind§id: String§files: Vec<ArtifactFile>§revision: StringSee revision.
origin: StringORIGIN_UPLOAD, ORIGIN_TRAIN, ORIGIN_HUB or an app’s own.
license: Option<String>An SPDX id, or unknown when the uploader said so explicitly.
base: Option<ProvenanceBase>§dataset: Option<ProvenanceDataset>§trainer: Option<ProvenanceTrainer>§uploaded_by: Option<String>The uploading device’s label.
uploaded_ms: Option<u64>Unix time in milliseconds.
extra: BTreeMap<String, Value>Any other fields.
Implementations§
Source§impl Provenance
impl Provenance
Sourcepub fn new(origin: impl Into<String>) -> Self
pub fn new(origin: impl Into<String>) -> Self
A record with this origin (ORIGIN_UPLOAD and so on).
Sourcepub fn for_artifact(
artifact: &Artifact,
id: impl Into<String>,
origin: impl Into<String>,
) -> Self
pub fn for_artifact( artifact: &Artifact, id: impl Into<String>, origin: impl Into<String>, ) -> Self
A record for artifact stored as id: its kind, files and revision, and its base
model’s Hub id when the files name one.
pub fn with_license(self, license: impl Into<String>) -> Self
Sourcepub fn read(dir: &Path) -> Option<Provenance>
pub fn read(dir: &Path) -> Option<Provenance>
The record in dir (PROVENANCE_FILE), if there is a readable one.