Skip to content

Commit 34625ab

Browse files
authored
Handle case with gemma4 without safetensors index (huggingface#3457)
1 parent c42e1fe commit 34625ab

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • candle-examples/examples/gemma4

candle-examples/examples/gemma4/main.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,12 @@ fn main() -> Result<()> {
258258
.split(',')
259259
.map(std::path::PathBuf::from)
260260
.collect::<Vec<_>>(),
261-
None => candle_examples::hub_load_safetensors(&repo, "model.safetensors.index.json")?,
261+
None => {
262+
match candle_examples::hub_load_safetensors(&repo, "model.safetensors.index.json") {
263+
Ok(files) => files,
264+
Err(_) => vec![repo.get("model.safetensors")?],
265+
}
266+
}
262267
};
263268
println!("retrieved the files in {:?}", start.elapsed());
264269
let tokenizer = Tokenizer::from_file(tokenizer_filename).map_err(E::msg)?;

0 commit comments

Comments
 (0)