Make compaction transitions recoverable
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user