Skip to content

Commit

Permalink
Merge branch 'main' into add-depth-anything
Browse files Browse the repository at this point in the history
  • Loading branch information
xenova committed Jan 25, 2024
2 parents 84ddd85 + 4a6adda commit 87b6ba2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/tokenizers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2744,6 +2744,12 @@ export class PreTrainedTokenizer extends Callable {
x = this.normalizer(x);
}

// If, after normalization, this section is empty (e.g., trimming whitespace),
// we return an empty array
if (x.length === 0) {
return [];
}

const sectionTokens = (this.pre_tokenizer !== null) ? this.pre_tokenizer(x, {
section_index,
}) : [x];
Expand Down

0 comments on commit 87b6ba2

Please sign in to comment.