Skip to content

Commit

Permalink
Correct input_length since habana extend input_length to max_input_le…
Browse files Browse the repository at this point in the history
…ngth (#103)

Signed-off-by: Wang, Yi A <[email protected]>
  • Loading branch information
sywangyi authored Mar 18, 2024
1 parent b45f648 commit d752317
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions router/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ impl Validation {
// Unwrap is safe here
let (inputs, input_length) = response_receiver.await.unwrap()?;

let input_length = if self.skip_tokenizer_in_tgi {
inputs.chars().filter(|&c| c == ',').count() + 1
} else {
truncate.unwrap_or(self.max_input_length)
};

// Get total tokens
let max_new_tokens: u32 = if let Some(max_new_tokens) = max_new_tokens {
max_new_tokens
Expand Down

0 comments on commit d752317

Please sign in to comment.