



"""simple docstring"""






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






class 	__snake_case	(     __lowerCAmelCase):
  snake_case__    :       Dict        =						['''image_processor''', '''tokenizer''']
  snake_case__    :       Dict        =						'''AutoImageProcessor'''
  snake_case__    :       int        =						'''AutoTokenizer'''




  def __init__(			self					:						int						, __lowerCAmelCase					:						str						, __lowerCAmelCase					:						Tuple		):






         """simple docstring"""






         super().__init__(lowerCAmelCase_						, lowerCAmelCase_		)
         _lowerCamelCase						:    Dict         =			self.image_processor




  def __call__(			self					:						int						, __lowerCAmelCase					:						Dict=None						, __lowerCAmelCase					:						Union[str, Any]=None						, __lowerCAmelCase					:						List[Any]=None						, **__lowerCAmelCase					:						Union[str, 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:
                _lowerCamelCase						:    int         =			self.tokenizer(lowerCAmelCase_						, return_tensors=lowerCAmelCase_						, **lowerCAmelCase_		)

         if images is not None:
                _lowerCamelCase						:    Union[str, Any]         =			self.image_processor(lowerCAmelCase_						, return_tensors=lowerCAmelCase_						, **lowerCAmelCase_		)

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




  def 						SCREAMING_SNAKE_CASE    (			self					:						Dict						, *__lowerCAmelCase					:						List[str]						, **__lowerCAmelCase					:						Dict		):






         """simple docstring"""






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




  def 						SCREAMING_SNAKE_CASE    (			self					:						List[Any]						, *__lowerCAmelCase					:						Optional[int]						, **__lowerCAmelCase					:						Union[str, Any]		):






         """simple docstring"""






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




  @property
  def 						SCREAMING_SNAKE_CASE    (			self					:						Optional[int]		):






         """simple docstring"""






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







"""simple docstring"""






from torch import nn






class 	__snake_case	(     nn.Module):




  def __init__(			self					:						Optional[Any]						, __lowerCAmelCase					:						Dict						, __lowerCAmelCase					:						str		):






         """simple docstring"""






         super().__init__()
         _lowerCamelCase						:    List[str]         =			class_size
         _lowerCamelCase						:    List[str]         =			embed_size
         # self.mlp1 = nn.Linear(embed_size, embed_size)
         # self.mlp2 = (nn.Linear(embed_size, class_size))
         _lowerCamelCase						:    Optional[int]         =			nn.Linear(__lowerCAmelCase						, __lowerCAmelCase		)




  def 						SCREAMING_SNAKE_CASE    (			self					:						List[Any]						, __lowerCAmelCase					:						Tuple		):






         """simple docstring"""






         _lowerCamelCase						:    Optional[Any]         =			self.mlp(__lowerCAmelCase		)
         return logits


