

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding






class   __lowercase				(  __snake_case  ):
      UpperCamelCase								=       ['''image_processor''', '''tokenizer''']
      UpperCamelCase								=       '''AutoImageProcessor'''
      UpperCamelCase								=       '''AutoTokenizer'''





      def __init__(		self						:					Optional[Any]					,       __lowerCamelCase						:					List[Any]					,       __lowerCamelCase						:					Optional[int]       )    ->   List[str]:






         """simple docstring"""







         super().__init__(__lowerCamelCase					,       __lowerCamelCase       )
         UpperCAmelCase							=     self.image_processor





      def __call__(		self						:					List[Any]					,       __lowerCamelCase						:					Any=None					,       __lowerCamelCase						:					Optional[Any]=None					,       __lowerCamelCase						:					Any=None					,       **__lowerCamelCase						:					int       )    ->   Any:






         """simple docstring"""







         if text is None and images is None:
            raise ValueError("""You have to specify either text or images. Both cannot be none."""       )

         if text is not None:
            UpperCAmelCase							=     self.tokenizer(__lowerCamelCase					,       return_tensors=__lowerCamelCase					,       **__lowerCamelCase       )

         if images is not None:
            UpperCAmelCase							=     self.image_processor(__lowerCamelCase					,       return_tensors=__lowerCamelCase					,       **__lowerCamelCase       )

         if text is not None and images is not None:
            UpperCAmelCase							=     image_features.pixel_values
            return encoding
         elif text is not None:
            return encoding
         else:
            return BatchEncoding(data=dict(**__lowerCamelCase       )					,       tensor_type=__lowerCamelCase       )





      def        _lowercase				(		self						:					Any					,       *__lowerCamelCase						:					List[Any]					,       **__lowerCamelCase						:					Tuple       )    ->   Tuple:






         """simple docstring"""







         return self.tokenizer.batch_decode(*__lowerCamelCase					,       **__lowerCamelCase       )





      def        _lowercase				(		self						:					int					,       *__lowerCamelCase						:					Union[str, Any]					,       **__lowerCamelCase						:					List[str]       )    ->   Any:






         """simple docstring"""







         return self.tokenizer.decode(*__lowerCamelCase					,       **__lowerCamelCase       )





      @property
      def        _lowercase				(		self						:					List[str]       )    ->   Dict:






         """simple docstring"""







         return ["input_ids", "attention_mask", "pixel_values"]







import argparse


__a     =			"""docs/source/_static/js/custom.js"""
def   _UpperCamelCase				(						lowerCAmelCase_   )						->Optional[Any]:
   with open(lowerCAmelCase_  ,						encoding="""utf-8"""  ,						newline="""\n"""   ) as f:
      UpperCAmelCase							=     f.readlines()
   UpperCAmelCase							=     0

   # First let's put the right version
   while not lines[index].startswith("""const stableVersion ="""   ):
      index += 1
   UpperCAmelCase							=     F"""const stableVersion = \"v{version}\"\n"""

   # Then update the dictionary
   while not lines[index].startswith("""const versionMapping = {"""   ):
      index += 1

   # We go until the end
   while not lines[index].startswith("""}"""   ):
      index += 1
   # We add the new version at the end
   lines[index - 1] += F"""    \"v{version}\": \"v{version}\",\n"""

   with open(lowerCAmelCase_  ,						"""w"""  ,						encoding="""utf-8"""  ,						newline="""\n"""   ) as f:
      f.writelines(lowerCAmelCase_   )


if __name__ == "__main__":
 __a     =			argparse.ArgumentParser()
 parser.add_argument("""--version""", help="""Release version.""")
 __a     =			parser.parse_args()
 update_custom_js(args.version)



