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§
Trait Implementations§
Source§impl Clone for ProvenancePatch
impl Clone for ProvenancePatch
Source§fn clone(&self) -> ProvenancePatch
fn clone(&self) -> ProvenancePatch
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more