




import warnings

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







class 				lowerCAmelCase_       (					lowerCamelCase_							):
				__a     :       Any						=     ["image_processor", "tokenizer"]
				__a     :       Tuple						=     "ChineseCLIPImageProcessor"
				__a     :       List[Any]						=     ("BertTokenizer", "BertTokenizerFast")






				def __init__(			self      ,snake_case__=None      ,snake_case__=None      ,**snake_case__ ):
							SCREAMING_SNAKE_CASE_   : Dict					  =      None
							if "feature_extractor" in kwargs:
										warnings.warn(
										    'The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`'
										    ' instead.'      ,snake_case__      ,)
										SCREAMING_SNAKE_CASE_   : Optional[Any]					  =      kwargs.pop('feature_extractor' )

							SCREAMING_SNAKE_CASE_   : List[str]					  =      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__(snake_case__      ,snake_case__ )
							SCREAMING_SNAKE_CASE_   : Union[str, Any]					  =      self.image_processor






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

							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_   : List[Any]					  =      self.tokenizer(snake_case__      ,return_tensors=snake_case__      ,**snake_case__ )

							if images is not None:
										SCREAMING_SNAKE_CASE_   : int					  =      self.image_processor(snake_case__      ,return_tensors=snake_case__      ,**snake_case__ )

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






				def 		snake_case	(			self      ,*snake_case__      ,**snake_case__ ):
							return self.tokenizer.batch_decode(*snake_case__      ,**snake_case__ )






				def 		snake_case	(			self      ,*snake_case__      ,**snake_case__ ):
							return self.tokenizer.decode(*snake_case__      ,**snake_case__ )






				@property
				def 		snake_case	(			self ):
							SCREAMING_SNAKE_CASE_   : Tuple					  =      self.tokenizer.model_input_names
							SCREAMING_SNAKE_CASE_   : Optional[int]					  =      self.image_processor.model_input_names
							return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names ) )






				@property
				def 		snake_case	(			self ):
							warnings.warn(
							    '`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead.'      ,snake_case__      ,)
							return self.image_processor_class






from typing import TYPE_CHECKING

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


SCREAMING_SNAKE_CASE		:Optional[int]						=     {
    """configuration_rembert""": ["""REMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """RemBertConfig""", """RemBertOnnxConfig"""]
}

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

try:
 if not is_tokenizers_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 SCREAMING_SNAKE_CASE		:Optional[Any]						=     ["""RemBertTokenizerFast"""]

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 SCREAMING_SNAKE_CASE		:Dict						=     [
     """REMBERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
     """RemBertForCausalLM""",
     """RemBertForMaskedLM""",
     """RemBertForMultipleChoice""",
     """RemBertForQuestionAnswering""",
     """RemBertForSequenceClassification""",
     """RemBertForTokenClassification""",
     """RemBertLayer""",
     """RemBertModel""",
     """RemBertPreTrainedModel""",
     """load_tf_weights_in_rembert""",
 ]


try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 SCREAMING_SNAKE_CASE		:Optional[int]						=     [
     """TF_REMBERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
     """TFRemBertForCausalLM""",
     """TFRemBertForMaskedLM""",
     """TFRemBertForMultipleChoice""",
     """TFRemBertForQuestionAnswering""",
     """TFRemBertForSequenceClassification""",
     """TFRemBertForTokenClassification""",
     """TFRemBertLayer""",
     """TFRemBertModel""",
     """TFRemBertPreTrainedModel""",
 ]


if TYPE_CHECKING:
 from .configuration_rembert import REMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, RemBertConfig, RemBertOnnxConfig

 try:
  if not is_sentencepiece_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_rembert import RemBertTokenizer

 try:
  if not is_tokenizers_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_rembert_fast import RemBertTokenizerFast

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_rembert import (
      REMBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
      RemBertForCausalLM,
      RemBertForMaskedLM,
      RemBertForMultipleChoice,
      RemBertForQuestionAnswering,
      RemBertForSequenceClassification,
      RemBertForTokenClassification,
      RemBertLayer,
      RemBertModel,
      RemBertPreTrainedModel,
      load_tf_weights_in_rembert,
  )

 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_tf_rembert import (
      TF_REMBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
      TFRemBertForCausalLM,
      TFRemBertForMaskedLM,
      TFRemBertForMultipleChoice,
      TFRemBertForQuestionAnswering,
      TFRemBertForSequenceClassification,
      TFRemBertForTokenClassification,
      TFRemBertLayer,
      TFRemBertModel,
      TFRemBertPreTrainedModel,
  )


else:
 import sys

 SCREAMING_SNAKE_CASE		:List[Any]						=     _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)
