


'''simple docstring'''





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




class 				UpperCAmelCase			(			_snake_case						):
 UpperCAmelCase				=					["image_processor", "tokenizer"]
 UpperCAmelCase				=					"AutoImageProcessor"
 UpperCAmelCase				=					"AutoTokenizer"


 def __init__(      self							:	str			,       __lowerCamelCase							:	List[Any]			,       __lowerCamelCase							:	str ):
    super().__init__(__lowerCamelCase			,       __lowerCamelCase )
    UpperCAmelCase__	:List[str]      =      self.image_processor


 def __call__(      self							:	Tuple			,       __lowerCamelCase							:	Optional[int]=None			,       __lowerCamelCase							:	Union[str, Any]=None			,       __lowerCamelCase							:	Dict=None			,       **__lowerCamelCase							:	Union[str, Any] ):

    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__	:int      =      self.tokenizer(__lowerCamelCase			,       return_tensors=__lowerCamelCase			,       **__lowerCamelCase )

    if images is not None:
       UpperCAmelCase__	:List[str]      =      self.image_processor(__lowerCamelCase			,       return_tensors=__lowerCamelCase			,       **__lowerCamelCase )

    if text is not None and images is not None:
       UpperCAmelCase__	:Tuple      =      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							:	List[Any]			,       *__lowerCamelCase							:	str			,       **__lowerCamelCase							:	Optional[Any] ):
    return self.tokenizer.batch_decode(*__lowerCamelCase			,       **__lowerCamelCase )


 def        __SCREAMING_SNAKE_CASE					(      self							:	Tuple			,       *__lowerCamelCase							:	Optional[int]			,       **__lowerCamelCase							:	Dict ):
    return self.tokenizer.decode(*__lowerCamelCase			,       **__lowerCamelCase )





 @property
 def        __SCREAMING_SNAKE_CASE					(      self							:	Union[str, Any] ):
    return ["input_ids", "attention_mask", "pixel_values"]







'''simple docstring'''





from ..utils import DummyObject, requires_backends




class 				UpperCAmelCase			(			metaclass=_snake_case						):
 UpperCAmelCase				=					["speech"]


 def __init__(      self							:	List[Any]			,       *__lowerCamelCase							:	List[Any]			,       **__lowerCamelCase							:	List[str] ):
    requires_backends(self			,       ['''speech'''] )




class 				UpperCAmelCase			(			metaclass=_snake_case						):
 UpperCAmelCase				=					["speech"]


 def __init__(      self							:	int			,       *__lowerCamelCase							:	List[Any]			,       **__lowerCamelCase							:	List[str] ):
    requires_backends(self			,       ['''speech'''] )



