pub struct ResumeState {
pub names: Vec<String>,
pub marks: Vec<String>,
}Expand description
Writes a CMF file in a single pass, payloads first.
CmfModel::write_ref needs every payload addressable at once, so a
converter has to hold the whole encoded model — RAM, or a spill file it
then copies into the output. For a 300B-class MoE that is ~120 GB written
twice. This writer instead reserves a gap at the head of the file, appends
each payload the moment it is encoded, and patches the envelope, header and
directory into that gap at the end. The bytes are written once and peak
disk cost is the finished file.
The gap is the one thing that can go wrong: the directory is not sized
until the last tensor arrives. CmfStreamWriter::finish therefore
refuses loudly if the head does not fit rather than truncating it, and
CmfStreamWriter::head_reserve_for gives callers a safe estimate.
What a resumed writer recovers from its manifest: the tensors already on
disk and any milestones the producer noted.
Fields§
§names: Vec<String>§marks: Vec<String>