From a4fd6905d8d6814b235a8bd3d3bf40dacdf23f0e Mon Sep 17 00:00:00 2001 From: OlivierDehaene <23298448+OlivierDehaene@users.noreply.github.com> Date: Fri, 23 Jun 2023 15:01:05 +0200 Subject: [PATCH] fmt --- router/src/infer.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/router/src/infer.rs b/router/src/infer.rs index 048acfb2..11f65130 100644 --- a/router/src/infer.rs +++ b/router/src/infer.rs @@ -154,22 +154,24 @@ impl Infer { // Validation // logprobs, ids and texts must have the same lengths - if tokens.logprobs.len() != tokens_length || tokens.texts.len() != tokens_length { - return Err(InferError::GenerationError(format!("Prefill tokens do not have the correct lengths"))) + if tokens.logprobs.len() != tokens_length || tokens.texts.len() != tokens_length + { + return Err(InferError::GenerationError( + "Prefill tokens do not have the correct lengths".to_string(), + )); } result_prefill = Vec::with_capacity(tokens_length); // Create Token objects // We do that here instead of in the Python code as Rust for loops are faster - for ((id, logprob), text) in tokens.ids.into_iter().zip( - tokens.logprobs.into_iter() - ).zip(tokens.texts.into_iter()) { - result_prefill.push(PrefillToken{ - id, - text, - logprob, - }); + for ((id, logprob), text) in tokens + .ids + .into_iter() + .zip(tokens.logprobs.into_iter()) + .zip(tokens.texts.into_iter()) + { + result_prefill.push(PrefillToken { id, text, logprob }); } } // Push last token