Skip to content

Commit

Permalink
v0.1.7 add time spent
Browse files Browse the repository at this point in the history
  • Loading branch information
Mon-ius committed May 6, 2024
1 parent de50d89 commit 36e8fdd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
8 changes: 6 additions & 2 deletions example/dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ use tokio_stream::StreamExt;

#[tokio::main]
async fn main() {
let start_time = std::time::Instant::now();

let nums: Vec<Vec<u32>> = (0..204)
.collect::<Vec<_>>()
.chunks(10)
Expand All @@ -12,8 +14,8 @@ async fn main() {
for chunk in nums{
let mut tasks: Vec<_> = chunk.into_iter()
.map(|i| tokio::spawn(async move {
let _build = libhfd::api::tokio::ApiBuilder::new();
let api = _build.with_endpoint("https://hf-mirror.com")
let api = libhfd::api::tokio::ApiBuilder::new()
.with_endpoint("https://hf-mirror.com")
.with_token("hf_xxxxxxxx")
.build()
.unwrap();
Expand All @@ -28,4 +30,6 @@ async fn main() {
task.await.unwrap();
}
}

println!("Processing time: {:?}", start_time.elapsed());
}
2 changes: 1 addition & 1 deletion hfd-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hfd-cli"
version = "0.1.6"
version = "0.1.7"
edition = "2021"

[dependencies]
Expand Down
3 changes: 3 additions & 0 deletions hfd-cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ use tokio;

#[tokio::main]
async fn main() {
let start_time = std::time::Instant::now();

let api = libhfd::api::tokio::Api::new().unwrap();

let _filename = api
.model("ByteDance/Hyper-SD".to_string())
.get("Hyper-SDXL-8steps-lora.safetensors")
.await
.unwrap();
println!("Processing time: {:?}", start_time.elapsed());
}

0 comments on commit 36e8fdd

Please sign in to comment.