Fix padding and truncation in pipelines (#190)

This commit is contained in:
Joshua Lochner 2023-07-11 02:07:53 +02:00 committed by GitHub
parent 316d10e6ec
commit 13efa96122
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -261,9 +261,12 @@ export class QuestionAnsweringPipeline extends Pipeline {
topk = 1
} = {}) {
// Run tokenization
let inputs = this.tokenizer(question, {
text_pair: context
})
text_pair: context,
padding: true,
truncation: true
});
let output = await this.model(inputs);
@ -623,6 +626,8 @@ export class ZeroShotClassificationPipeline extends Pipeline {
for (let hypothesis of hypotheses) {
let inputs = this.tokenizer(premise, {
text_pair: hypothesis,
padding: true,
truncation: true,
})
let outputs = await this.model(inputs)