mirror of
https://github.com/huggingface/candle.git
synced 2025-06-16 02:38:10 +00:00
Use the new hub helper function. (#1484)
This commit is contained in:
@ -165,14 +165,7 @@ fn main() -> Result<()> {
|
|||||||
args.revision,
|
args.revision,
|
||||||
));
|
));
|
||||||
let tokenizer_filename = repo.get("tokenizer.json")?;
|
let tokenizer_filename = repo.get("tokenizer.json")?;
|
||||||
let mut filenames = vec![];
|
let filenames = candle_examples::hub_load_safetensors(&repo, "model.safetensors.index.json")?;
|
||||||
for rfilename in [
|
|
||||||
"model-00001-of-00002.safetensors",
|
|
||||||
"model-00002-of-00002.safetensors",
|
|
||||||
] {
|
|
||||||
let filename = repo.get(rfilename)?;
|
|
||||||
filenames.push(filename);
|
|
||||||
}
|
|
||||||
println!("retrieved the files in {:?}", start.elapsed());
|
println!("retrieved the files in {:?}", start.elapsed());
|
||||||
let tokenizer = Tokenizer::from_file(tokenizer_filename).map_err(E::msg)?;
|
let tokenizer = Tokenizer::from_file(tokenizer_filename).map_err(E::msg)?;
|
||||||
|
|
||||||
|
@ -143,14 +143,7 @@ fn main() -> Result<()> {
|
|||||||
let config_filename = api.get("config.json")?;
|
let config_filename = api.get("config.json")?;
|
||||||
let config: Config = serde_json::from_slice(&std::fs::read(config_filename)?)?;
|
let config: Config = serde_json::from_slice(&std::fs::read(config_filename)?)?;
|
||||||
let tokenizer_filename = api.get("tokenizer.json")?;
|
let tokenizer_filename = api.get("tokenizer.json")?;
|
||||||
let mut filenames = vec![];
|
let filenames = candle_examples::hub_load_safetensors(&api, "model.safetensors.index.json")?;
|
||||||
for rfilename in [
|
|
||||||
"model-00001-of-00002.safetensors",
|
|
||||||
"model-00002-of-00002.safetensors",
|
|
||||||
] {
|
|
||||||
let filename = api.get(rfilename)?;
|
|
||||||
filenames.push(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
if args.rank.is_none() {
|
if args.rank.is_none() {
|
||||||
let children: Vec<_> = (0..args.num_shards)
|
let children: Vec<_> = (0..args.num_shards)
|
||||||
|
Reference in New Issue
Block a user