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





class       lowercase__		(     _UpperCAmelCase):
						UpperCamelCase_  =	['image_processor', 'tokenizer']
						UpperCamelCase_  =	'AutoImageProcessor'
						UpperCamelCase_  =	'AutoTokenizer'


						def __init__( self			:       Optional[int]					,	UpperCamelCase__			:       Any					,	UpperCamelCase__			:       Any		):





												'''simple docstring'''





												super().__init__(__UpperCamelCase					,	__UpperCamelCase		)
												SCREAMING_SNAKE_CASE							:					Tuple           =							self.image_processor


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





												'''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:
																		SCREAMING_SNAKE_CASE							:					Optional[int]           =							self.tokenizer(__UpperCamelCase					,	return_tensors=__UpperCamelCase					,	**__UpperCamelCase		)

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

												if text is not None and images is not None:
																		SCREAMING_SNAKE_CASE							:					Optional[int]           =							image_features.pixel_values
																		return encoding
												elif text is not None:
																		return encoding
												else:
																		return BatchEncoding(data=dict(**__UpperCamelCase		)					,	tensor_type=__UpperCamelCase		)


						def  __A ( self			:       Optional[Any]					,	*UpperCamelCase__			:       Optional[Any]					,	**UpperCamelCase__			:       Union[str, Any]		):





												'''simple docstring'''





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


						def  __A ( self			:       Optional[int]					,	*UpperCamelCase__			:       Dict					,	**UpperCamelCase__			:       Optional[Any]		):





												'''simple docstring'''





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



						@property
						def  __A ( self			:       Any		):





												'''simple docstring'''





												return ["input_ids", "attention_mask", "pixel_values"]
from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


__UpperCamelCase	: Tuple    		=  {
    'configuration_maskformer': ['MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MaskFormerConfig'],
    'configuration_maskformer_swin': ['MaskFormerSwinConfig'],
}

try:
					if not is_vision_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					__UpperCamelCase	: Optional[Any]    		=  ['MaskFormerFeatureExtractor']
					__UpperCamelCase	: List[Any]    		=  ['MaskFormerImageProcessor']


try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					__UpperCamelCase	: Optional[int]    		=  [
					    'MASKFORMER_PRETRAINED_MODEL_ARCHIVE_LIST',
					    'MaskFormerForInstanceSegmentation',
					    'MaskFormerModel',
					    'MaskFormerPreTrainedModel',
					]
					__UpperCamelCase	: Union[str, Any]    		=  [
					    'MaskFormerSwinBackbone',
					    'MaskFormerSwinModel',
					    'MaskFormerSwinPreTrainedModel',
					]

if TYPE_CHECKING:
					from .configuration_maskformer import MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, MaskFormerConfig
					from .configuration_maskformer_swin import MaskFormerSwinConfig

					try:
										if not is_vision_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .feature_extraction_maskformer import MaskFormerFeatureExtractor
										from .image_processing_maskformer import MaskFormerImageProcessor
					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_maskformer import (
										    MASKFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
										    MaskFormerForInstanceSegmentation,
										    MaskFormerModel,
										    MaskFormerPreTrainedModel,
										)
										from .modeling_maskformer_swin import (
										    MaskFormerSwinBackbone,
										    MaskFormerSwinModel,
										    MaskFormerSwinPreTrainedModel,
										)


else:
					import sys

					__UpperCamelCase	: List[str]    		=  _LazyModule(__name__, globals()['__file__'], _import_structure)





