Skip to content

Commit

Permalink
use truncate flag in huggingface tokenizer
Browse files Browse the repository at this point in the history
Signed-off-by: HenryL27 <[email protected]>
  • Loading branch information
HenryL27 committed Dec 7, 2023
1 parent 2761d7d commit 9024a4c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ public Batchifier getBatchifier() {
@Override
public void prepare(TranslatorContext ctx) throws IOException {
Path path = ctx.getModel().getModelPath();
tokenizer = HuggingFaceTokenizer.builder().optPadding(true).optTokenizerPath(path.resolve("tokenizer.json")).build();
tokenizer = HuggingFaceTokenizer
.builder()
.optPadding(true)
.optTruncation(true)
.optTokenizerPath(path.resolve("tokenizer.json"))
.build();
}

@Override
Expand Down

0 comments on commit 9024a4c

Please sign in to comment.