from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding
class     lowerCAmelCase_     (       __lowercase ):
							UpperCAmelCase				   =     ["image_processor", "tokenizer"]
							UpperCAmelCase				   =     "AutoImageProcessor"
							UpperCAmelCase				   =     "AutoTokenizer"







							def __init__(   self      :     Union[str, Any] ,			_A      :     Dict ,			_A      :     Union[str, Any]		):
												super().__init__(_A ,			_A		)
												_UpperCamelCase			     =     self.image_processor







							def __call__(   self      :     int ,			_A      :     Tuple=None ,			_A      :     Tuple=None ,			_A      :     List[Any]=None ,			**_A      :     Dict		):

												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(_A ,			return_tensors=_A ,			**_A		)

												if images is not None:
																	_UpperCamelCase			     =     self.image_processor(_A ,			return_tensors=_A ,			**_A		)

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







							def  UpperCamelCase_						(   self      :     Any ,			*_A      :     List[Any] ,			**_A      :     str		):
												return self.tokenizer.batch_decode(*_A ,			**_A		)







							def  UpperCamelCase_						(   self      :     Any ,			*_A      :     int ,			**_A      :     Dict		):
												return self.tokenizer.decode(*_A ,			**_A		)







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






from typing import TYPE_CHECKING

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


UpperCamelCase__ :   Optional[int]						=							{
    '''configuration_bloom''': ['''BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BloomConfig''', '''BloomOnnxConfig'''],
}
try:
						if not is_tokenizers_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						UpperCamelCase__ :   Tuple						=							['''BloomTokenizerFast''']

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						UpperCamelCase__ :   Any						=							[
						    '''BLOOM_PRETRAINED_MODEL_ARCHIVE_LIST''',
						    '''BloomForCausalLM''',
						    '''BloomModel''',
						    '''BloomPreTrainedModel''',
						    '''BloomForSequenceClassification''',
						    '''BloomForTokenClassification''',
						    '''BloomForQuestionAnswering''',
						]

if TYPE_CHECKING:
						from .configuration_bloom import BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP, BloomConfig, BloomOnnxConfig

						try:
												if not is_tokenizers_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .tokenization_bloom_fast import BloomTokenizerFast

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_bloom import (
												    BLOOM_PRETRAINED_MODEL_ARCHIVE_LIST,
												    BloomForCausalLM,
												    BloomForQuestionAnswering,
												    BloomForSequenceClassification,
												    BloomForTokenClassification,
												    BloomModel,
												    BloomPreTrainedModel,
												)

else:
						import sys

						UpperCamelCase__ :   Tuple						=							_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)



