

'''simple docstring'''
import warnings

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


class        a__  (							lowerCamelCase_  ):
   _SCREAMING_SNAKE_CASE   :					Optional[int]     	=							['image_processor', 'tokenizer']
   _SCREAMING_SNAKE_CASE   :					Tuple     	=							'ChineseCLIPImageProcessor'
   _SCREAMING_SNAKE_CASE   :					Optional[Any]     	=							('BertTokenizer', 'BertTokenizerFast')


   def __init__(			self      ,    _UpperCamelCase=None      ,    _UpperCamelCase=None      ,    **_UpperCamelCase  ):





      """simple docstring"""





      _lowercase      :				List[str]      					=       None
      if "feature_extractor" in kwargs:
         warnings.warn(
             "The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`"
             " instead."      ,    _UpperCamelCase      ,    )
         _lowercase      :				Optional[int]      					=       kwargs.pop("feature_extractor"  )

      _lowercase      :				Tuple      					=       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__(_UpperCamelCase      ,    _UpperCamelCase  )
      _lowercase      :				str      					=       self.image_processor


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





      """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:
         _lowercase      :				Union[str, Any]      					=       self.tokenizer(_UpperCamelCase      ,    return_tensors=_UpperCamelCase      ,    **_UpperCamelCase  )

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

      if text is not None and images is not None:
         _lowercase      :				List[Any]      					=       image_features.pixel_values
         return encoding
      elif text is not None:
         return encoding
      else:
         return BatchEncoding(data=dict(**_UpperCamelCase  )      ,    tensor_type=_UpperCamelCase  )


   def 						_lowerCamelCase       (			self      ,    *_UpperCamelCase      ,    **_UpperCamelCase  ):





      """simple docstring"""





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


   def 						_lowerCamelCase       (			self      ,    *_UpperCamelCase      ,    **_UpperCamelCase  ):





      """simple docstring"""





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


   @property
   def 						_lowerCamelCase       (			self  ):





      """simple docstring"""





      _lowercase      :				int      					=       self.tokenizer.model_input_names
      _lowercase      :				Tuple      					=       self.image_processor.model_input_names
      return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names  )  )






   @property
   def 						_lowerCamelCase       (			self  ):





      """simple docstring"""





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









'''simple docstring'''
from ...configuration_utils import PretrainedConfig
from ...utils import logging


_snake_case         =  logging.get_logger(__name__)

_snake_case         =  {
    'weiweishi/roc-bert-base-zh': 'https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/config.json',
}


class        a__  (							lowerCamelCase_  ):
   _SCREAMING_SNAKE_CASE   :					Any     	=							'roc_bert'


   def __init__(			self      ,    _UpperCamelCase=30522      ,    _UpperCamelCase=768      ,    _UpperCamelCase=12      ,    _UpperCamelCase=12      ,    _UpperCamelCase=3072      ,    _UpperCamelCase="gelu"      ,    _UpperCamelCase=0.1      ,    _UpperCamelCase=0.1      ,    _UpperCamelCase=512      ,    _UpperCamelCase=2      ,    _UpperCamelCase=0.0_2      ,    _UpperCamelCase=1E-1_2      ,    _UpperCamelCase=True      ,    _UpperCamelCase=0      ,    _UpperCamelCase="absolute"      ,    _UpperCamelCase=None      ,    _UpperCamelCase=True      ,    _UpperCamelCase=True      ,    _UpperCamelCase=768      ,    _UpperCamelCase=910      ,    _UpperCamelCase=512      ,    _UpperCamelCase=24858      ,    _UpperCamelCase=True      ,    **_UpperCamelCase      ,    ):





      """simple docstring"""





      _lowercase      :				str      					=       vocab_size
      _lowercase      :				List[str]      					=       max_position_embeddings
      _lowercase      :				List[Any]      					=       hidden_size
      _lowercase      :				Dict      					=       num_hidden_layers
      _lowercase      :				str      					=       num_attention_heads
      _lowercase      :				int      					=       intermediate_size
      _lowercase      :				Optional[Any]      					=       hidden_act
      _lowercase      :				Union[str, Any]      					=       hidden_dropout_prob
      _lowercase      :				Dict      					=       attention_probs_dropout_prob
      _lowercase      :				Dict      					=       initializer_range
      _lowercase      :				List[Any]      					=       type_vocab_size
      _lowercase      :				Tuple      					=       layer_norm_eps
      _lowercase      :				Optional[int]      					=       use_cache
      _lowercase      :				Tuple      					=       enable_pronunciation
      _lowercase      :				Optional[int]      					=       enable_shape
      _lowercase      :				int      					=       pronunciation_embed_dim
      _lowercase      :				List[str]      					=       pronunciation_vocab_size
      _lowercase      :				int      					=       shape_embed_dim
      _lowercase      :				str      					=       shape_vocab_size
      _lowercase      :				str      					=       concat_input
      _lowercase      :				Dict      					=       position_embedding_type
      _lowercase      :				Optional[Any]      					=       classifier_dropout
      super().__init__(pad_token_id=_UpperCamelCase      ,    **_UpperCamelCase  )






