Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warmup pass for mistralrs-bench #270

Merged
merged 1 commit into from
May 8, 2024
Merged
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
43 changes: 43 additions & 0 deletions mistralrs-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,44 @@ fn print_usage(model: &str, device: &Device, results: Vec<BenchResult>) {
print_stdout(table).expect("print table");
}

fn warmup_run(mistralrs: Arc<MistralRs>) {
let sampling_params = SamplingParams {
temperature: Some(0.1),
top_k: Some(32),
top_p: Some(0.1),
top_n_logprobs: 0,
frequency_penalty: Some(0.1),
presence_penalty: Some(0.1),
max_len: Some(5),
stop_toks: None,
logits_bias: None,
n_choices: 1,
};
let sender = mistralrs.get_sender();
let (tx, mut rx) = channel(10_000);

let req = Request {
id: mistralrs.next_request_id(),
messages: RequestMessage::Completion {
text: "Hello!".to_string(),
echo_prompt: false,
best_of: 1,
},
sampling_params: sampling_params.clone(),
response: tx,
return_logprobs: false,
is_streaming: false,
constraint: Constraint::None,
suffix: None,
};

sender
.blocking_send(req.clone())
.expect("Expected receiver.");

let _ = rx.blocking_recv();
}

#[derive(Parser)]
#[command(version, about, long_about = None)]
struct Args {
Expand Down Expand Up @@ -311,6 +349,11 @@ fn main() -> anyhow::Result<()> {
.with_disable_eos_stop(true)
.build();

info!("Starting warmup run.");
warmup_run(mistralrs.clone());
info!("Finished warmup run.");
info!("Starting benchmarks.");

for concurrency in args.concurrency.as_ref().unwrap() {
let mut results = vec![];
if args.n_gen > 0 {
Expand Down
Loading