





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




class   _UpperCAmelCase	(   UpperCamelCase_					):
					__A          =   ["image_processor", "tokenizer"]
					__A          =   "EfficientNetImageProcessor"
					__A          =   ("BertTokenizer", "BertTokenizerFast")




					def __init__(						self    ,      __lowerCAmelCase    ,      __lowerCAmelCase       )						->  List[Any]:
							super().__init__(__UpperCamelCase    ,      __UpperCamelCase       )




					def __call__(						self    ,      __lowerCAmelCase=None    ,      __lowerCAmelCase=None    ,      __lowerCAmelCase="max_length"    ,      __lowerCAmelCase=64    ,      __lowerCAmelCase=None    ,      **__lowerCAmelCase       )						->  Optional[int]:


							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(
									    __UpperCamelCase    ,      padding=__UpperCamelCase    ,      max_length=__UpperCamelCase    ,      return_tensors=__UpperCamelCase    ,      **__UpperCamelCase       )

							if images is not None:
									UpperCamelCase__         =	self.image_processor(__UpperCamelCase    ,      return_tensors=__UpperCamelCase    ,      **__UpperCamelCase       )

							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(**__UpperCamelCase       )    ,      tensor_type=__UpperCamelCase       )




					def 	snake_case_		(						self    ,      *__lowerCAmelCase    ,      **__lowerCAmelCase       )						->  List[Any]:
							return self.tokenizer.batch_decode(*__UpperCamelCase    ,      **__UpperCamelCase       )




					def 	snake_case_		(						self    ,      *__lowerCAmelCase    ,      **__lowerCAmelCase       )						->  Union[str, Any]:
							return self.tokenizer.decode(*__UpperCamelCase    ,      **__UpperCamelCase       )




					@property
					def 	snake_case_		(						self       )						->  Dict:
							UpperCamelCase__         =	self.tokenizer.model_input_names
							UpperCamelCase__         =	self.image_processor.model_input_names
							return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names       )       )












import warnings

from .generation import FlaxGenerationMixin




class   _UpperCAmelCase	(   _lowercase					):
					# warning at import time
					warnings.warn(
					    "Importing `FlaxGenerationMixin` from `src/transformers/generation_flax_utils.py` is deprecated and will "
					    "be removed in Transformers v5. Import as `from transformers import FlaxGenerationMixin` instead." ,       _lowercase ,       )





