






"""simple docstring"""
from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


_lowerCAmelCase         =							{
    "configuration_albert": ["ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "AlbertConfig", "AlbertOnnxConfig"],
}

try:
							if not is_sentencepiece_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							_lowerCAmelCase         =							["AlbertTokenizer"]

try:
							if not is_tokenizers_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							_lowerCAmelCase         =							["AlbertTokenizerFast"]

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							_lowerCAmelCase         =							[
							    "ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
							    "AlbertForMaskedLM",
							    "AlbertForMultipleChoice",
							    "AlbertForPreTraining",
							    "AlbertForQuestionAnswering",
							    "AlbertForSequenceClassification",
							    "AlbertForTokenClassification",
							    "AlbertModel",
							    "AlbertPreTrainedModel",
							    "load_tf_weights_in_albert",
							]

try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							_lowerCAmelCase         =							[
							    "TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
							    "TFAlbertForMaskedLM",
							    "TFAlbertForMultipleChoice",
							    "TFAlbertForPreTraining",
							    "TFAlbertForQuestionAnswering",
							    "TFAlbertForSequenceClassification",
							    "TFAlbertForTokenClassification",
							    "TFAlbertMainLayer",
							    "TFAlbertModel",
							    "TFAlbertPreTrainedModel",
							]

try:
							if not is_flax_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							_lowerCAmelCase         =							[
							    "FlaxAlbertForMaskedLM",
							    "FlaxAlbertForMultipleChoice",
							    "FlaxAlbertForPreTraining",
							    "FlaxAlbertForQuestionAnswering",
							    "FlaxAlbertForSequenceClassification",
							    "FlaxAlbertForTokenClassification",
							    "FlaxAlbertModel",
							    "FlaxAlbertPreTrainedModel",
							]

if TYPE_CHECKING:
							from .configuration_albert import ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, AlbertConfig, AlbertOnnxConfig

							try:
														if not is_sentencepiece_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .tokenization_albert import AlbertTokenizer

							try:
														if not is_tokenizers_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .tokenization_albert_fast import AlbertTokenizerFast

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_albert import (
														    ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
														    AlbertForMaskedLM,
														    AlbertForMultipleChoice,
														    AlbertForPreTraining,
														    AlbertForQuestionAnswering,
														    AlbertForSequenceClassification,
														    AlbertForTokenClassification,
														    AlbertModel,
														    AlbertPreTrainedModel,
														    load_tf_weights_in_albert,
														)

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_albert import (
														    TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
														    TFAlbertForMaskedLM,
														    TFAlbertForMultipleChoice,
														    TFAlbertForPreTraining,
														    TFAlbertForQuestionAnswering,
														    TFAlbertForSequenceClassification,
														    TFAlbertForTokenClassification,
														    TFAlbertMainLayer,
														    TFAlbertModel,
														    TFAlbertPreTrainedModel,
														)

							try:
														if not is_flax_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_flax_albert import (
														    FlaxAlbertForMaskedLM,
														    FlaxAlbertForMultipleChoice,
														    FlaxAlbertForPreTraining,
														    FlaxAlbertForQuestionAnswering,
														    FlaxAlbertForSequenceClassification,
														    FlaxAlbertForTokenClassification,
														    FlaxAlbertModel,
														    FlaxAlbertPreTrainedModel,
														)
else:
							import sys

							_lowerCAmelCase         =							_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)









"""simple docstring"""
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding



class      SCREAMING_SNAKE_CASE  (				_SCREAMING_SNAKE_CASE						):





	"""simple docstring"""




	_A       :				Optional[int]    =				["""image_processor""", """tokenizer"""]
	_A       :				str    =				"""AutoImageProcessor"""
	_A       :				Union[str, Any]    =				"""AutoTokenizer"""





	def __init__(self     ,     lowerCAmelCase_     ,     lowerCAmelCase_							):
		super().__init__(lowerCAmelCase_     ,     lowerCAmelCase_							)
		A_		:						Union[str, Any]	    =   self.image_processor





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

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

		if images is not None:
			A_		:						List[Any]	    =   self.image_processor(lowerCAmelCase_     ,     return_tensors=lowerCAmelCase_     ,     **lowerCAmelCase_							)

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





	def    lowerCamelCase(self     ,     *lowerCAmelCase_     ,     **lowerCAmelCase_							):
		return self.tokenizer.batch_decode(*lowerCAmelCase_     ,     **lowerCAmelCase_							)





	def    lowerCamelCase(self     ,     *lowerCAmelCase_     ,     **lowerCAmelCase_							):
		return self.tokenizer.decode(*lowerCAmelCase_     ,     **lowerCAmelCase_							)





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

