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
|
/// Get input length and optionally truncate it
|
||||||
fn prepare_input(
|
fn prepare_input(
|
||||||
inputs: String,
|
mut inputs: String,
|
||||||
truncate: Option<usize>,
|
truncate: Option<usize>,
|
||||||
tokenizer: &Tokenizer,
|
tokenizer: &Tokenizer,
|
||||||
) -> Result<(tokenizers::Encoding, String), ValidationError> {
|
) -> Result<(tokenizers::Encoding, String), ValidationError> {
|
||||||
@ -372,9 +372,9 @@ fn prepare_input(
|
|||||||
if let Some(truncate) = truncate {
|
if let Some(truncate) = truncate {
|
||||||
if truncate < encoding.len() {
|
if truncate < encoding.len() {
|
||||||
encoding.truncate(truncate, 0, TruncationDirection::Left);
|
encoding.truncate(truncate, 0, TruncationDirection::Left);
|
||||||
// inputs = tokenizer
|
inputs = tokenizer
|
||||||
// .decode(encoding.get_ids(), false)
|
.decode(encoding.get_ids(), false)
|
||||||
// .map_err(|err| ValidationError::Tokenizer(err.to_string()))?;
|
.map_err(|err| ValidationError::Tokenizer(err.to_string()))?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user