






'''simple docstring'''
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding


class 							_UpperCAmelCase    (		snake_case      ):
    __lowerCamelCase: List[Any]									=     ['image_processor', 'tokenizer']
    __lowerCamelCase: Optional[Any]									=     'AutoImageProcessor'
    __lowerCamelCase: Dict									=     'AutoTokenizer'




    def __init__(      self	:							str	,  a	:							Tuple	,  a	:							List[str]      ):






       '''simple docstring'''






       super().__init__(a	,  a      )
       lowercase_						:     List[str]							     =  self.image_processor




    def __call__(      self	:							Any	,  a	:							Optional[Any]=None	,  a	:							str=None	,  a	:							Union[str, Any]=None	,  **a	:							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:
          lowercase_						:     int							     =  self.tokenizer(a	,  return_tensors=a	,  **a      )

       if images is not None:
          lowercase_						:     Tuple							     =  self.image_processor(a	,  return_tensors=a	,  **a      )

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




    def 					lowerCAmelCase__					(      self	:							List[Any]	,  *a	:							Optional[int]	,  **a	:							Dict      ):






       '''simple docstring'''






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




    def 					lowerCAmelCase__					(      self	:							Any	,  *a	:							Optional[int]	,  **a	:							str      ):






       '''simple docstring'''






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





    @property
    def 					lowerCAmelCase__					(      self	:							Any      ):






       '''simple docstring'''






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












'''simple docstring'''
UpperCamelCase__			=      {
    "joule": 1.0,
    "kilojoule": 1000,
    "megajoule": 1000000,
    "gigajoule": 1000000000,
    "wattsecond": 1.0,
    "watthour": 3600,
    "kilowatthour": 3600000,
    "newtonmeter": 1.0,
    "calorie_nutr": 4186.8,
    "kilocalorie_nutr": 4186800.00,
    "electronvolt": 1.602176634e-19,
    "britishthermalunit_it": 1055.05585,
    "footpound": 1.35_58_18,
}




def 		__SCREAMING_SNAKE_CASE       (	_UpperCamelCase    ,		_UpperCamelCase    ,		_UpperCamelCase				):


   """simple docstring"""




   if to_type not in ENERGY_CONVERSION or from_type not in ENERGY_CONVERSION:
      lowercase_						:     Union[str, Any]							     =  (
          F"""Incorrect 'from_type' or 'to_type' value: {from_type!r}, {to_type!r}\n"""
          F"""Valid values are: {", ".join(_UpperCamelCase				)}"""
      )
      raise ValueError(_UpperCamelCase				)
   return value * ENERGY_CONVERSION[from_type] / ENERGY_CONVERSION[to_type]


if __name__ == "__main__":
 import doctest

 doctest.testmod()




