mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-09-11 04:14:52 +00:00
Original truncate behavior.
This commit is contained in:
parent
168ec6b145
commit
211b9681e6
@ -359,7 +359,7 @@ fn tokenizer_worker(tokenizer: Tokenizer, mut receiver: mpsc::UnboundedReceiver<
|
||||
|
||||
/// Get input length and optionally truncate it
|
||||
fn prepare_input(
|
||||
inputs: String,
|
||||
mut inputs: String,
|
||||
truncate: Option<usize>,
|
||||
tokenizer: &Tokenizer,
|
||||
) -> Result<(tokenizers::Encoding, String), ValidationError> {
|
||||
@ -372,9 +372,9 @@ fn prepare_input(
|
||||
if let Some(truncate) = truncate {
|
||||
if truncate < encoding.len() {
|
||||
encoding.truncate(truncate, 0, TruncationDirection::Left);
|
||||
// inputs = tokenizer
|
||||
// .decode(encoding.get_ids(), false)
|
||||
// .map_err(|err| ValidationError::Tokenizer(err.to_string()))?;
|
||||
inputs = tokenizer
|
||||
.decode(encoding.get_ids(), false)
|
||||
.map_err(|err| ValidationError::Tokenizer(err.to_string()))?;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user