


import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin







class 					__lowercase					(       SCREAMING_SNAKE_CASE__     ):



		"""simple docstring"""

		UpperCamelCase    :				int 					=		["image_processor", "tokenizer"]
		UpperCamelCase    :				Tuple 					=		"AutoImageProcessor"
		UpperCamelCase    :				Dict 					=		"AutoTokenizer"







		def __init__(   self		,			A=None		,			A=None		,			**A  )     ->   str:







					'''simple docstring'''







					lowerCamelCase								=     None
					if "feature_extractor" in kwargs:
								warnings.warn(
								    """The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`"""
								    """ instead."""		,			A		,			)
								lowerCamelCase								=     kwargs.pop("""feature_extractor"""  )

					lowerCamelCase								=     image_processor if image_processor is not None else feature_extractor
					if image_processor is None:
								raise ValueError("""You need to specify an `image_processor`."""  )
					if tokenizer is None:
								raise ValueError("""You need to specify a `tokenizer`."""  )

					super().__init__(A		,			A  )
					lowerCamelCase								=     self.image_processor
					lowerCamelCase								=     False







		def __call__(   self		,			*A		,			**A  )     ->   List[Any]:







					'''simple docstring'''







					if self._in_target_context_manager:
								return self.current_processor(*A		,			**A  )

					lowerCamelCase								=     kwargs.pop("""images"""		,			A  )
					lowerCamelCase								=     kwargs.pop("""text"""		,			A  )
					if len(A  ) > 0:
								lowerCamelCase								=     args[0]
								lowerCamelCase								=     args[1:]

					if images is None and text is None:
								raise ValueError("""You need to specify either an `images` or `text` input to process."""  )

					if images is not None:
								lowerCamelCase								=     self.image_processor(A		,			*A		,			**A  )
					if text is not None:
								lowerCamelCase								=     self.tokenizer(A		,			**A  )

					if text is None:
								return inputs
					elif images is None:
								return encodings
					else:
								lowerCamelCase								=     encodings["""input_ids"""]
								return inputs







		def 				__A      (   self		,			*A		,			**A  )     ->   Any:







					'''simple docstring'''







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







		def 				__A      (   self		,			*A		,			**A  )     ->   Optional[int]:







					'''simple docstring'''







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







		@contextmanager
		def 				__A      (   self  )     ->   List[str]:







					'''simple docstring'''







					warnings.warn(
					    """`as_target_processor` is deprecated and will be removed in v5 of Transformers. You can process your """
					    """labels by using the argument `text` of the regular `__call__` method (either in the same call as """
					    """your images inputs, or in a separate call."""  )
					lowerCamelCase								=     True
					lowerCamelCase								=     self.tokenizer
					yield
					lowerCamelCase								=     self.image_processor
					lowerCamelCase								=     False







		@property
		def 				__A      (   self  )     ->   Union[str, Any]:







					'''simple docstring'''







					warnings.warn(
					    """`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead."""		,			A		,			)
					return self.image_processor_class







		@property
		def 				__A      (   self  )     ->   Any:







					'''simple docstring'''







					warnings.warn(
					    """`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead."""		,			A		,			)
					return self.image_processor





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,
)


UpperCAmelCase      :						List[str]    =		{
    "configuration_big_bird": ["BIG_BIRD_PRETRAINED_CONFIG_ARCHIVE_MAP", "BigBirdConfig", "BigBirdOnnxConfig"],
}

try:
		if not is_sentencepiece_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		UpperCAmelCase      :						str    =		["BigBirdTokenizer"]

try:
		if not is_tokenizers_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		UpperCAmelCase      :						str    =		["BigBirdTokenizerFast"]

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		UpperCAmelCase      :						Dict    =		[
		    "BIG_BIRD_PRETRAINED_MODEL_ARCHIVE_LIST",
		    "BigBirdForCausalLM",
		    "BigBirdForMaskedLM",
		    "BigBirdForMultipleChoice",
		    "BigBirdForPreTraining",
		    "BigBirdForQuestionAnswering",
		    "BigBirdForSequenceClassification",
		    "BigBirdForTokenClassification",
		    "BigBirdLayer",
		    "BigBirdModel",
		    "BigBirdPreTrainedModel",
		    "load_tf_weights_in_big_bird",
		]

try:
		if not is_flax_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		UpperCAmelCase      :						Dict    =		[
		    "FlaxBigBirdForCausalLM",
		    "FlaxBigBirdForMaskedLM",
		    "FlaxBigBirdForMultipleChoice",
		    "FlaxBigBirdForPreTraining",
		    "FlaxBigBirdForQuestionAnswering",
		    "FlaxBigBirdForSequenceClassification",
		    "FlaxBigBirdForTokenClassification",
		    "FlaxBigBirdModel",
		    "FlaxBigBirdPreTrainedModel",
		]

if TYPE_CHECKING:
		from .configuration_big_bird import BIG_BIRD_PRETRAINED_CONFIG_ARCHIVE_MAP, BigBirdConfig, BigBirdOnnxConfig

		try:
				if not is_sentencepiece_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_big_bird import BigBirdTokenizer

		try:
				if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_big_bird_fast import BigBirdTokenizerFast

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_big_bird import (
				    BIG_BIRD_PRETRAINED_MODEL_ARCHIVE_LIST,
				    BigBirdForCausalLM,
				    BigBirdForMaskedLM,
				    BigBirdForMultipleChoice,
				    BigBirdForPreTraining,
				    BigBirdForQuestionAnswering,
				    BigBirdForSequenceClassification,
				    BigBirdForTokenClassification,
				    BigBirdLayer,
				    BigBirdModel,
				    BigBirdPreTrainedModel,
				    load_tf_weights_in_big_bird,
				)

		try:
				if not is_flax_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_flax_big_bird import (
				    FlaxBigBirdForCausalLM,
				    FlaxBigBirdForMaskedLM,
				    FlaxBigBirdForMultipleChoice,
				    FlaxBigBirdForPreTraining,
				    FlaxBigBirdForQuestionAnswering,
				    FlaxBigBirdForSequenceClassification,
				    FlaxBigBirdForTokenClassification,
				    FlaxBigBirdModel,
				    FlaxBigBirdPreTrainedModel,
				)

else:
		import sys

		UpperCAmelCase      :						Dict    =		_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)

