mirror of
https://github.com/huggingface/candle.git
synced 2025-06-17 11:08:52 +00:00
Pin the revision used by moondream. (#2340)
This commit is contained in:
@ -188,8 +188,8 @@ struct Args {
|
|||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
model_id: Option<String>,
|
model_id: Option<String>,
|
||||||
|
|
||||||
#[arg(long, default_value = "main")]
|
#[arg(long)]
|
||||||
revision: String,
|
revision: Option<String>,
|
||||||
|
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
quantized: bool,
|
quantized: bool,
|
||||||
@ -252,20 +252,28 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
|
|
||||||
let start = std::time::Instant::now();
|
let start = std::time::Instant::now();
|
||||||
let api = hf_hub::api::tokio::Api::new()?;
|
let api = hf_hub::api::tokio::Api::new()?;
|
||||||
let model_id = match args.model_id {
|
let (model_id, revision) = match args.model_id {
|
||||||
Some(model_id) => model_id.to_string(),
|
Some(model_id) => (model_id.to_string(), None),
|
||||||
None => {
|
None => {
|
||||||
if args.quantized {
|
if args.quantized {
|
||||||
"santiagomed/candle-moondream".to_string()
|
("santiagomed/candle-moondream".to_string(), None)
|
||||||
} else {
|
} else {
|
||||||
"vikhyatk/moondream2".to_string()
|
(
|
||||||
|
"vikhyatk/moondream2".to_string(),
|
||||||
|
Some("30c7cdf3fa6914f50bee3956694374143f5cc884"),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
let revision = match (args.revision, revision) {
|
||||||
|
(Some(r), _) => r,
|
||||||
|
(None, Some(r)) => r.to_string(),
|
||||||
|
(None, None) => "main".to_string(),
|
||||||
|
};
|
||||||
let repo = api.repo(hf_hub::Repo::with_revision(
|
let repo = api.repo(hf_hub::Repo::with_revision(
|
||||||
model_id,
|
model_id,
|
||||||
hf_hub::RepoType::Model,
|
hf_hub::RepoType::Model,
|
||||||
args.revision,
|
revision,
|
||||||
));
|
));
|
||||||
let model_file = match args.model_file {
|
let model_file = match args.model_file {
|
||||||
Some(m) => m.into(),
|
Some(m) => m.into(),
|
||||||
|
Reference in New Issue
Block a user