-
Notifications
You must be signed in to change notification settings - Fork 368
llama-cli: Could not load model: InvalidMagic { path: ... } #59
Comments
ggerganov/llama.cpp#252 changed the model format, and we're not compatible with it yet. Thanks for spotting this - we'll need to expedite the fix. In the meantime, you can re-quantize the model with a version of |
Humm... thanks i will try to re-quantize the model to a previous version! |
Got it! Tried with the previous alpaca version that i had! |
Great! We'll leave this issue open as a reminder that we'll need to update to handle the new format. |
Changing the code a bit is sufficient for running the new versioned file formats. #[error("file is pre-versioned, generate another please! at {path:?}")]
PreVersioned { path: PathBuf },
#[error("invalid magic number for {path:?}")]
InvalidMagic { path: PathBuf },
#[error("invalid version number for {path:?}")]
InvalidVersion { path: PathBuf }, ... // Verify magic
{
let magic = read_i32(&mut reader)?;
if magic == 0x67676d6c {
return Err(LoadError::PreVersioned {
path: main_path.to_owned(),
});
}
if magic != 0x67676d66 {
return Err(LoadError::InvalidMagic {
path: main_path.to_owned(),
});
}
}
// Verify the version
{
let format_version = read_i32(&mut reader)?;
if format_version != 1 {
return Err(LoadError::InvalidVersion {
path: main_path.to_owned(),
});
}
} ... // Load vocabulary
let mut vocab = Vocabulary::default();
for i in 0..hparams.n_vocab {
let len = read_i32(&mut reader)?;
if let Ok(word) = read_string(&mut reader, len as usize) {
vocab.mapping.push(word);
} else {
load_progress_callback(LoadProgress::BadToken {
index: i.try_into()?,
});
vocab.mapping.push("�".to_string());
}
let score: f32 = read_i32(&mut reader)? as f32;
vocab.score.push(score);
} It works without issues. |
I think that the change in the binary format was just the inclusion of the |
After fixing this bug, and adding |
Related pull request: #61 |
@mguinhos thanks for referencing. Hadn't even seen the issue. Feel free to modify the PR. Was just running |
Can probably close this issue now? |
I'm using current
llama.cpp works with the same model:
EDIT: I managed to get it to work reconverting and requantizing the model with llama.cpp commit 5cb63e2 before change of format. I'm using current main of llama-rs so it should work with the newer format but I'm getting the above error with InvalidMagic |
Model sucessfully runs on
llama.cpp
but not inllama-rs
Command:
The text was updated successfully, but these errors were encountered: