mirror of
https://github.com/mii443/tokenizers.git
synced 2025-08-23 16:49:27 +00:00
Fix BertProcessing overflowing usize
This commit is contained in:
@ -38,8 +38,11 @@ impl PostProcessor for BertProcessing {
|
|||||||
.unwrap_or(0)
|
.unwrap_or(0)
|
||||||
+ special_token_len;
|
+ special_token_len;
|
||||||
|
|
||||||
let need_trunc = total_len - self.max_len;
|
let need_trunc = if total_len > self.max_len {
|
||||||
println!("Need to trunc {}", need_trunc);
|
total_len - self.max_len
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
};
|
||||||
let (mut encoding, pair_encoding) = truncate_encodings(
|
let (mut encoding, pair_encoding) = truncate_encodings(
|
||||||
encoding,
|
encoding,
|
||||||
pair_encoding,
|
pair_encoding,
|
||||||
|
Reference in New Issue
Block a user