mirror of
https://github.com/huggingface/candle.git
synced 2025-06-16 02:38:10 +00:00
Creating new sync Api for candle-hub
.
- `api::Api` -> `api::tokio::api` (And created new `api::sync::Api`). - Remove `tokio` from all our examples. - Using similar codebase for now instead of ureq (for simplicity).
This commit is contained in:
@ -19,7 +19,7 @@ use clap::Parser;
|
||||
use rand::{distributions::Distribution, SeedableRng};
|
||||
|
||||
use candle::{DType, Device, Tensor, D};
|
||||
use candle_hub::{api::Api, Repo, RepoType};
|
||||
use candle_hub::{api::sync::Api, Repo, RepoType};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
@ -465,8 +465,7 @@ struct Args {
|
||||
prompt: Option<String>,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
fn main() -> Result<()> {
|
||||
use tokenizers::Tokenizer;
|
||||
|
||||
let args = Args::parse();
|
||||
@ -489,13 +488,13 @@ async fn main() -> Result<()> {
|
||||
let api = Api::new()?;
|
||||
let repo = Repo::new("Narsil/amall-7b".to_string(), RepoType::Model);
|
||||
println!("building the model");
|
||||
let tokenizer_filename = api.get(&repo, "tokenizer.json").await?;
|
||||
let tokenizer_filename = api.get(&repo, "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).await?;
|
||||
let filename = api.get(&repo, rfilename)?;
|
||||
filenames.push(filename);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user