import torch

from transformers import PreTrainedModel

from .custom_configuration import CustomConfig, NoSuperInitConfig



class 						snake_case_ (	__A ):
   __A			:	Optional[int]        =       CustomConfig






   def __init__(   self       :  str			,		lowercase_       :  List[Any]						)      ->		Any:
       super().__init__(lowercase_						)
       lowercase__				:     int					      =       torch.nn.Linear(config.hidden_size			,		config.hidden_size						)






   def    __UpperCamelCase  (   self       :  str			,		lowercase_       :  List[str]						)      ->		str:
       return self.linear(lowercase_						)







   def    __UpperCamelCase  (   self       :  Union[str, Any]			,		lowercase_       :  Optional[Any]						)      ->		Optional[Any]:
       pass



class 						snake_case_ (	__A ):
   __A			:	Any        =       NoSuperInitConfig






   def __init__(   self       :  Optional[Any]			,		lowercase_       :  List[str]						)      ->		List[Any]:
       super().__init__(lowercase_						)
       lowercase__				:     Dict					      =       torch.nn.Linear(config.attribute			,		config.attribute						)






   def    __UpperCamelCase  (   self       :  List[Any]			,		lowercase_       :  List[str]						)      ->		Optional[Any]:
       return self.linear(lowercase_						)







   def    __UpperCamelCase  (   self       :  List[str]			,		lowercase_       :  Dict						)      ->		Union[str, Any]:
       pass




import unittest

from datasets import load_dataset

from transformers import load_tool

from .test_tools_common import ToolTesterMixin



class 						snake_case_ (	unittest.TestCase						,__A ):






   def    __UpperCamelCase  (   self       :  Optional[int]						)      ->		List[Any]:
       lowercase__				:     List[Any]					      =       load_tool("document-question-answering"						)
       self.tool.setup()
       lowercase__				:     Optional[int]					      =       load_tool("document-question-answering"			,		remote=lowercase_						)






   def    __UpperCamelCase  (   self       :  int						)      ->		Optional[int]:
       lowercase__				:     List[Any]					      =       load_dataset("hf-internal-testing/example-documents"			,		split="test"						)
       lowercase__				:     List[Any]					      =       dataset[0]["image"]

       lowercase__				:     int					      =       self.tool(lowercase_			,		"When is the coffee break?"						)
       self.assertEqual(lowercase_			,		"11-14 to 11:39 a.m."						)






   def    __UpperCamelCase  (   self       :  Optional[Any]						)      ->		List[Any]:
       lowercase__				:     str					      =       load_dataset("hf-internal-testing/example-documents"			,		split="test"						)
       lowercase__				:     str					      =       dataset[0]["image"]

       lowercase__				:     List[str]					      =       self.remote_tool(lowercase_			,		"When is the coffee break?"						)
       self.assertEqual(lowercase_			,		"11-14 to 11:39 a.m."						)






   def    __UpperCamelCase  (   self       :  List[Any]						)      ->		Dict:
       lowercase__				:     List[str]					      =       load_dataset("hf-internal-testing/example-documents"			,		split="test"						)
       lowercase__				:     List[str]					      =       dataset[0]["image"]

       self.tool(document=lowercase_			,		question="When is the coffee break?"						)







   def    __UpperCamelCase  (   self       :  str						)      ->		Optional[Any]:
       lowercase__				:     Optional[Any]					      =       load_dataset("hf-internal-testing/example-documents"			,		split="test"						)
       lowercase__				:     int					      =       dataset[0]["image"]

       lowercase__				:     Tuple					      =       self.remote_tool(document=lowercase_			,		question="When is the coffee break?"						)
       self.assertEqual(lowercase_			,		"11-14 to 11:39 a.m."						)



