From 2b8599b2df6a09f83bd8b19086f691a648af74cb Mon Sep 17 00:00:00 2001 From: Zhen Wang Date: Mon, 14 Feb 2022 20:18:40 +0800 Subject: [PATCH] Fix a bug that ignores max_seq_len in preprocess (#15238) --- src/transformers/pipelines/question_answering.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/transformers/pipelines/question_answering.py b/src/transformers/pipelines/question_answering.py index 61edb8b3004404..efab83b92f9821 100644 --- a/src/transformers/pipelines/question_answering.py +++ b/src/transformers/pipelines/question_answering.py @@ -182,6 +182,8 @@ def _sanitize_parameters( preprocess_params["doc_stride"] = doc_stride if max_question_len is not None: preprocess_params["max_question_len"] = max_question_len + if max_seq_len is not None: + preprocess_params["max_seq_len"] = max_seq_len postprocess_params = {} if topk is not None and top_k is None: