diff --git a/.github/workflows/trufflehog.yaml b/.github/workflows/trufflehog.yaml index 72c0e36..feeca3a 100644 --- a/.github/workflows/trufflehog.yaml +++ b/.github/workflows/trufflehog.yaml @@ -15,4 +15,4 @@ jobs: - name: Secret Scanning uses: trufflesecurity/trufflehog@main with: - extra_args: --exclude-globs='test_data/.*' + extra_args: --exclude-globs='test_data/.*' --results=verified,unknown --exclude-detectors=postgres diff --git a/Cargo.toml b/Cargo.toml index 27a1662..82e9a17 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "inference-benchmarker" -version = "1.0.0" +version = "1.1.0" edition = "2021" authors = ["Hugo Larcher "] repository = "https://github.com/huggingface/inference-benchmarker" @@ -16,26 +16,24 @@ serde_json = "1.0.127" serde = { version = "1.0.209", features = ["derive"] } tokio = { version = "1.40.0", features = ["rt", "rt-multi-thread", "macros", "signal"] } anyhow = "1.0.86" -tokenizers = { version = "0.20.2", features = ["http"] } -rand_distr = "0.4.3" -rand = "0.8.5" +tokenizers = { version = "0.21.1", features = ["http"] } +rand_distr = "0.5.1" +rand = "0.9.0" futures-util = "0.3.30" env_logger = "0.11.5" -trait-variant = "0.1.2" async-trait = "0.1.82" reqwest = { version = "0.12.7", features = ["json"] } -tokio-stream = "0.1.16" -strum_macros = "0.26.4" +strum_macros = "0.27.1" clap = { version = "4.5.17", features = ["derive", "env"] } humantime = "2.1.0" -ratatui = { version = "0.28.1", features = ["all-widgets"] } +ratatui = { version = "0.29.0", features = ["all-widgets"] } crossterm = "0.28.1" chrono = "0.4.38" -hf-hub = { version = "0.3.2", features = ["tokio"] } +hf-hub = { version = "0.4.2", features = ["tokio"] } indicatif = "0.17.8" rayon = "1.10.0" serde_with = "3.9.0" -sysinfo = "0.31.4" +sysinfo = "0.33.1" mockito = "1.5.0" tabled = "=0.14" uuid = { version = "1.11.0", features = ["v4", "fast-rng"] } diff --git a/src/app.rs b/src/app.rs index 7f6b5aa..88203e4 100644 --- a/src/app.rs +++ b/src/app.rs @@ -15,7 +15,7 @@ use ratatui::{ symbols, symbols::border, text::{Line, Text}, - widgets::{block::Title, Block, Paragraph, Widget}, + widgets::{Block, Paragraph, Widget}, DefaultTerminal, Frame, }; use std::collections::HashMap; @@ -107,9 +107,9 @@ pub async fn run_console( timestamp: event.timestamp, })); } - BenchmarkEvent::BenchmarkReportEnd => { + BenchmarkEvent::BenchmarkReportEnd(path) => { dispatcher.lock().expect("lock").dispatch(Action::LogMessage(LogMessageUI { - message: "Benchmark report saved.".to_string(), + message: format!("Benchmark report saved to {}", path), level: LogLevel::Info, timestamp: chrono::Utc::now(), })); @@ -286,9 +286,9 @@ impl Widget for &App { .constraints([Constraint::Percentage(35), Constraint::Percentage(65)]) .split(bottom_layout[0]); // LOGS - let logs_title = Title::from("Logs".bold()); + let logs_title = Line::from("Logs".bold()).centered(); let logs_block = Block::bordered() - .title(logs_title.alignment(Alignment::Center)) + .title_top(logs_title) .border_set(border::THICK); List::new( state @@ -339,7 +339,7 @@ impl Widget for &App { Paragraph::new(config_text.clone()).render(main_layout[0], buf); // STEPS - let steps_block_title = Title::from("Benchmark steps".bold()); + let steps_block_title = Line::from("Benchmark steps".bold()).centered(); let steps_block = Block::bordered() .title(steps_block_title.alignment(Alignment::Center)) .border_set(border::THICK); @@ -389,7 +389,7 @@ impl Widget for &App { .render(steps_graph_layout[0], buf); // CHARTS - let graphs_block_title = Title::from("Token throughput rate".bold()); + let graphs_block_title = Line::from("Token throughput rate".bold()).centered(); let graphs_block = Block::bordered() .title(graphs_block_title.alignment(Alignment::Center)) .border_set(border::THICK); diff --git a/src/benchmark.rs b/src/benchmark.rs index 6826c8e..0f1a57f 100644 --- a/src/benchmark.rs +++ b/src/benchmark.rs @@ -40,7 +40,7 @@ pub enum Event { BenchmarkProgress(BenchmarkEvent), BenchmarkEnd(BenchmarkEvent), Message(MessageEvent), - BenchmarkReportEnd, + BenchmarkReportEnd(String), BenchmarkError(String), } diff --git a/src/lib.rs b/src/lib.rs index 68fb410..fd087c6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -192,6 +192,7 @@ pub async fn run(mut run_config: RunConfiguration, stop_sender: Sender<()>) -> a let writer=BenchmarkReportWriter::try_new(config.clone(), report)?; writer.json(path).await?; info!("Report saved to {:?}",path); + let _ = tx.send(Event::BenchmarkReportEnd(format!("{:?}", path))); }, Err(e) => { error!("Error running benchmark: {:?}", e.to_string()); @@ -203,7 +204,6 @@ pub async fn run(mut run_config: RunConfiguration, stop_sender: Sender<()>) -> a debug!("Received stop signal, stopping benchmark"); } } - let _ = tx.send(Event::BenchmarkReportEnd); info!("Benchmark finished"); if !run_config.interactive { // quit app if not interactive diff --git a/src/requests.rs b/src/requests.rs index 39ada82..90982db 100644 --- a/src/requests.rs +++ b/src/requests.rs @@ -423,7 +423,7 @@ impl ConversationTextRequestGenerator { Arc::from(Mutex::from(HashMap::new())); info!( "Generating requests from {filepath}", - filepath = filepath.display().to_string() + filepath = filepath.display() ); let bar = ProgressBar::new(data.len() as u64); bar.set_style(ProgressStyle::with_template( @@ -556,7 +556,7 @@ impl ConversationTextRequestGenerator { fn sample_num_tokens(num_tokens: u64, min_tokens: u64, max_tokens: u64, variance: u64) -> u64 { let normal = rand_distr::Normal::new(num_tokens as f64, variance as f64).unwrap(); - let mut num_tokens = normal.sample(&mut rand::thread_rng()) as u64; + let mut num_tokens = normal.sample(&mut rand::rng()) as u64; if num_tokens < min_tokens { num_tokens = min_tokens; } diff --git a/src/writers.rs b/src/writers.rs index de86622..74d675c 100644 --- a/src/writers.rs +++ b/src/writers.rs @@ -96,7 +96,7 @@ pub struct SystemInfo { impl SystemInfo { pub fn new() -> SystemInfo { let s = System::new_with_specifics( - sysinfo::RefreshKind::new() + sysinfo::RefreshKind::nothing() .with_memory(MemoryRefreshKind::everything()) .with_cpu(CpuRefreshKind::everything()), );