


"""simple docstring"""






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


class 			lowerCamelCase_		(			lowercase   ):





				"""simple docstring"""







				_lowerCAmelCase      :      int      							=					["image_processor", "tokenizer"]
				_lowerCAmelCase      :      List[Any]      							=					"AutoImageProcessor"
				_lowerCAmelCase      :      List[str]      							=					"AutoTokenizer"



				def __init__(						self       ,		UpperCAmelCase__       ,		UpperCAmelCase__     ):
								super().__init__(UpperCAmelCase__       ,		UpperCAmelCase__     )
								SCREAMING_SNAKE_CASE__     							=				self.image_processor



				def __call__(						self       ,		UpperCAmelCase__=None       ,		UpperCAmelCase__=None       ,		UpperCAmelCase__=None       ,		**UpperCAmelCase__     ):

								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:
												SCREAMING_SNAKE_CASE__     							=				self.tokenizer(UpperCAmelCase__       ,		return_tensors=UpperCAmelCase__       ,		**UpperCAmelCase__     )

								if images is not None:
												SCREAMING_SNAKE_CASE__     							=				self.image_processor(UpperCAmelCase__       ,		return_tensors=UpperCAmelCase__       ,		**UpperCAmelCase__     )

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



				def   lowerCAmelCase__		(						self       ,		*UpperCAmelCase__       ,		**UpperCAmelCase__     ):
								return self.tokenizer.batch_decode(*UpperCAmelCase__       ,		**UpperCAmelCase__     )



				def   lowerCAmelCase__		(						self       ,		*UpperCAmelCase__       ,		**UpperCAmelCase__     ):
								return self.tokenizer.decode(*UpperCAmelCase__       ,		**UpperCAmelCase__     )






				@property
				def   lowerCAmelCase__		(						self     ):
								return ["input_ids", "attention_mask", "pixel_values"]




"""simple docstring"""






from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


_lowerCamelCase     =  {
    'configuration_autoformer': [
        'AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'AutoformerConfig',
    ],
}

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_lowerCamelCase     =  [
	    'AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST',
	    'AutoformerForPrediction',
	    'AutoformerModel',
	    'AutoformerPreTrainedModel',
	]


if TYPE_CHECKING:
	from .configuration_autoformer import (
	    AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
	    AutoformerConfig,
	)

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_autoformer import (
		    AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
		    AutoformerForPrediction,
		    AutoformerModel,
		    AutoformerPreTrainedModel,
		)

else:
	import sys

	_lowerCamelCase     =  _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)
