From 065e098271c095a1e50b578ae51446068b54f8cb Mon Sep 17 00:00:00 2001 From: Adam-D-Lewis <23342526+Adam-D-Lewis@users.noreply.github.com> Date: Thu, 1 Jun 2023 09:26:15 -0500 Subject: [PATCH] rename encode input to match docstring --- src/transformers/tools/document_question_answering.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/transformers/tools/document_question_answering.py b/src/transformers/tools/document_question_answering.py index 8a44a1a9511..7b5e8782bd7 100644 --- a/src/transformers/tools/document_question_answering.py +++ b/src/transformers/tools/document_question_answering.py @@ -46,13 +46,13 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - def encode(self, image: "Image", question: str): + def encode(self, document: "Image", question: str): task_prompt = "{user_input}" prompt = task_prompt.replace("{user_input}", question) decoder_input_ids = self.pre_processor.tokenizer( prompt, add_special_tokens=False, return_tensors="pt" ).input_ids - pixel_values = self.pre_processor(image, return_tensors="pt").pixel_values + pixel_values = self.pre_processor(document, return_tensors="pt").pixel_values return {"decoder_input_ids": decoder_input_ids, "pixel_values": pixel_values}