Skip to content

Commit

Permalink
Fix the quantized mistral example. (#1478)
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentMazare authored Dec 25, 2023
1 parent 88589d8 commit 7135791
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion candle-core/src/quantized/gguf_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl VersionedMagic {
(Magic::Gguf, 1) => Self::GgufV1,
(Magic::Gguf, 2) => Self::GgufV2,
(Magic::Gguf, 3) => Self::GgufV3,
_ => crate::bail!("ggml: unsupported magic/version {magic:?}/{version}"),
_ => crate::bail!("gguf: unsupported magic/version {magic:?}/{version}"),
};
Ok(versioned_magic)
}
Expand Down
16 changes: 13 additions & 3 deletions candle-examples/examples/mistral/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ struct Args {
#[arg(long, short = 'n', default_value_t = 100)]
sample_len: usize,

#[arg(long, default_value = "mistralai/Mistral-7B-v0.1")]
model_id: String,
#[arg(long)]
model_id: Option<String>,

#[arg(long, default_value = "main")]
revision: String,
Expand Down Expand Up @@ -207,8 +207,18 @@ fn main() -> Result<()> {

let start = std::time::Instant::now();
let api = Api::new()?;
let model_id = match args.model_id {
Some(model_id) => model_id,
None => {
if args.quantized {
"lmz/candle-mistral".to_string()
} else {
"mistralai/Mistral-7B-v0.1".to_string()
}
}
};
let repo = api.repo(Repo::with_revision(
args.model_id,
model_id,
RepoType::Model,
args.revision,
));
Expand Down

0 comments on commit 7135791

Please sign in to comment.