Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/trufflehog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 8 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "inference-benchmarker"
version = "1.0.0"
version = "1.1.0"
edition = "2021"
authors = ["Hugo Larcher <hugo.larcher@huggingface.co>"]
repository = "https://github.com/huggingface/inference-benchmarker"
Expand All @@ -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"] }
Expand Down
14 changes: 7 additions & 7 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(),
}));
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub enum Event {
BenchmarkProgress(BenchmarkEvent),
BenchmarkEnd(BenchmarkEvent),
Message(MessageEvent),
BenchmarkReportEnd,
BenchmarkReportEnd(String),
BenchmarkError(String),
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/writers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
);
Expand Down