mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
rename DocumentQuestionAnsweringTool parameter input to match docstring (#23939)
rename encode input to match docstring
This commit is contained in:
parent
9193188276
commit
857d4e1c87
@ -46,13 +46,13 @@ class DocumentQuestionAnsweringTool(PipelineTool):
|
||||
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def encode(self, image: "Image", question: str):
|
||||
def encode(self, document: "Image", question: str):
|
||||
task_prompt = "<s_docvqa><s_question>{user_input}</s_question><s_answer>"
|
||||
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}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user