Make compaction transitions recoverable

This commit is contained in:
Georg Bauer
2026-07-26 10:56:19 +02:00
parent 6aa45b2cf0
commit 2a14b93335
13 changed files with 329 additions and 26 deletions

View File

@@ -81,6 +81,8 @@ impl Executor {
write_u64(file, self.model.main.len())?;
write_u64(file, self.model_modified.0)?;
write_u32(file, self.model_modified.1)?;
file.write_all(&self.model_identity)
.map_err(|error| error.to_string())?;
for weight in [self.weights.token_embedding, self.weights.output] {
write_u64(file, weight.offset)?;
write_u64(file, weight.bytes)?;
@@ -185,6 +187,12 @@ impl Executor {
if read_u64(file)? != self.model_modified.0 || read_u32(file)? != self.model_modified.1 {
return Err("KV checkpoint model file has changed".into());
}
let mut model_identity = [0; 32];
file.read_exact(&mut model_identity)
.map_err(|error| error.to_string())?;
if model_identity != self.model_identity {
return Err("KV checkpoint model identity or quantization changed".into());
}
for weight in [self.weights.token_embedding, self.weights.output] {
if read_u64(file)? != weight.offset
|| read_u64(file)? != weight.bytes