diff options
author | Nicolas Patry <patry.nicolas@protonmail.com> | 2023-07-28 07:03:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-28 07:03:30 +0100 |
commit | 0b97987b2113b4ccbacee942b9de746ded035feb (patch) | |
tree | 9eacde1a20b627cd468c22d10bce70593412a961 /candle-examples/examples/llama/main.rs | |
parent | f291065f6cac82827a47a736ebf78e4fc9c7c569 (diff) | |
parent | ca479a873eeebb21cdef1e2a95d11fea742390f4 (diff) | |
download | candle-0b97987b2113b4ccbacee942b9de746ded035feb.tar.gz candle-0b97987b2113b4ccbacee942b9de746ded035feb.tar.bz2 candle-0b97987b2113b4ccbacee942b9de746ded035feb.zip |
Merge pull request #261 from LaurentMazare/upgrade_hf_hub
Upgrading hf-hub to `0.2.0` (Modified API to not pass the Repo around all the time)
Diffstat (limited to 'candle-examples/examples/llama/main.rs')
-rw-r--r-- | candle-examples/examples/llama/main.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/candle-examples/examples/llama/main.rs b/candle-examples/examples/llama/main.rs index 582ac3f8..d9d1e21a 100644 --- a/candle-examples/examples/llama/main.rs +++ b/candle-examples/examples/llama/main.rs @@ -18,7 +18,7 @@ use clap::Parser; use candle::{DType, Tensor}; use candle_nn::VarBuilder; use candle_transformers::generation::LogitsProcessor; -use hf_hub::{api::sync::Api, Repo, RepoType}; +use hf_hub::api::sync::Api; mod model; use model::{Config, Llama}; @@ -146,14 +146,14 @@ fn main() -> Result<()> { } }); println!("loading the model weights from {model_id}"); - let repo = Repo::new(model_id, RepoType::Model); - let tokenizer_filename = api.get(&repo, "tokenizer.json")?; + let api = api.model(model_id); + let tokenizer_filename = api.get("tokenizer.json")?; let mut filenames = vec![]; for rfilename in [ "model-00001-of-00002.safetensors", "model-00002-of-00002.safetensors", ] { - let filename = api.get(&repo, rfilename)?; + let filename = api.get(rfilename)?; filenames.push(filename); } |