Skip to main content

ProvenancePatch

Struct ProvenancePatch 

Source
pub struct ProvenancePatch {
    pub license: Option<String>,
    pub data_source: Option<String>,
    pub data_license: Option<String>,
    pub hf_architecture: Option<String>,
    pub hf_model_type: Option<String>,
    pub architecture: Option<String>,
    pub tokenizer_vocab: Option<Vec<String>>,
    pub tokenizer_merges: Option<Vec<String>>,
    pub tokenizer_model_type: Option<String>,
}
Expand description

In-place field patches. None means “leave unchanged”; Some("") is a legitimate explicit clear (not currently contract-approved but kept distinct from None so callers can express intent).

PMAT-690 P0-K extension (2026-05-17): hf_architecture and hf_model_type were added so pre-P0-K APRs can be patched in place without re-import. The §86 SPEC amendment surfaced this: P2-E’s epoch-49 checkpoint (val_loss=4.62, the best MODEL-2 result on record) has architecture=“LlamaForCausalLM” (the P0-H fallback) and hf_architecture=null because its init APR pre-dates P0-K. Without in-place stamping, the 50 P2-E checkpoints (~125 GB) are unusable as --init for resume training because apr pretrain reads the (wrong) architecture stamp and rejects the load. Stamping the correct hf_architecture + a corrected architecture family slug salvages the entire run without a 53-min retrain.

Fields§

§license: Option<String>

SPDX license identifier to stamp into the metadata.

§data_source: Option<String>

Training-data source (dataset identifier or “teacher-only”).

§data_license: Option<String>

SPDX license for data_source.

§hf_architecture: Option<String>

HuggingFace class name from config.json::architectures[0] (e.g., “Qwen2ForCausalLM”). PMAT-690 P0-K extension.

§hf_model_type: Option<String>

HuggingFace config.json::model_type (e.g., “qwen2”). PMAT-690 P0-K extension.

§architecture: Option<String>

Lowercase architecture family slug (e.g., “qwen2”, “llama”). PMAT-690 P0-K extension. Distinct from hf_architecture (which is the HF class name like “Qwen2ForCausalLM”). This is the field that apr pretrain --init reads for arch dispatch, so patching this is what makes a pre-P0-K checkpoint resumable.

§tokenizer_vocab: Option<Vec<String>>

Tokenizer vocabulary (token strings indexed by token-id). When Some, the stamp embeds these strings into metadata.custom["tokenizer.vocabulary"] (as a JSON array) AND sets the HAS_VOCAB header flag — making the resulting APR self-contained for apr run inference (which rejects APRs without an embedded tokenizer per PMAT-172).

PMAT-690 P3-C-prep follow-up (2026-05-17, defect 1 from publish-readiness preflight on P2-E ep49): pre-P0-K APRs lack embedded tokenizers because the training init didn’t have one. Without this stamp extension, the §86 salvage produces a 6.0 GB HF-publish-ready directory that fails the headline apr run smoke test.

§tokenizer_merges: Option<Vec<String>>

BPE merge rules (e.g., ["Ä t", "i n", ...]). When Some, embedded into metadata.custom["tokenizer.merges"].

§tokenizer_model_type: Option<String>

Tokenizer model type (e.g., “BPE”, “Unigram”). Optional metadata for apr inspect to surface.

Implementations§

Source§

impl ProvenancePatch

Source

pub fn has_any(&self) -> bool

true iff at least one field would change. Guards against a no-op rewrite producing a pointless new file.

Trait Implementations§

Source§

impl Clone for ProvenancePatch

Source§

fn clone(&self) -> ProvenancePatch

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProvenancePatch

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ProvenancePatch

Source§

fn default() -> ProvenancePatch

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.