Skip to content

Commit

Permalink
fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
aneubeck committed Dec 6, 2024
1 parent 56214ef commit c0a3cb7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions crates/bpe-openai/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,11 @@ impl Tokenizer {
/// Otherwise, it returns none. This function can be faster than [`Self::count`]` when the
/// token limit is much smaller than the provided text. Applies pre-tokenization before counting.
pub fn count_till_limit(&self, text: &str, token_limit: usize) -> Option<usize> {
self.split(text)
.try_fold(0, |consumed, piece| {
self.bpe
.count_till_limit(piece.as_bytes(), token_limit - consumed)
.map(|piece_count| consumed + piece_count)
})
self.split(text).try_fold(0, |consumed, piece| {
self.bpe
.count_till_limit(piece.as_bytes(), token_limit - consumed)
.map(|piece_count| consumed + piece_count)
})
}

/// Returns the tokens for the encoding of the given text. Applies pre-tokenization before
Expand Down

0 comments on commit c0a3cb7

Please sign in to comment.