






import warnings

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

class _lowercase			(       UpperCamelCase__	):
							a          = ["""image_processor""", """tokenizer"""]
							a          = """ChineseCLIPImageProcessor"""
							a          = ("""BertTokenizer""", """BertTokenizerFast""")




							def __init__(							self:       List[str]    ,							UpperCamelCase__:       int=None    ,							UpperCamelCase__:       Optional[Any]=None    ,							**UpperCamelCase__:       Optional[Any]  ):
														lowerCamelCase__      :			int 						= 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__      :			Optional[Any] 						= kwargs.pop("""feature_extractor"""  )

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




							def __call__(							self:       List[str]    ,							UpperCamelCase__:       Tuple=None    ,							UpperCamelCase__:       int=None    ,							UpperCamelCase__:       Optional[int]=None    ,							**UpperCamelCase__:       List[Any]  ):



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

														if images is not None:
																					lowerCamelCase__      :			List[str] 						= self.image_processor(__A    ,							return_tensors=__A    ,							**__A  )

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




							def 	lowerCamelCase_       (							self:       List[Any]    ,							*UpperCamelCase__:       Union[str, Any]    ,							**UpperCamelCase__:       Union[str, Any]  ):
														return self.tokenizer.batch_decode(*__A    ,							**__A  )




							def 	lowerCamelCase_       (							self:       Any    ,							*UpperCamelCase__:       Optional[int]    ,							**UpperCamelCase__:       str  ):
														return self.tokenizer.decode(*__A    ,							**__A  )




							@property
							def 	lowerCamelCase_       (							self:       Any  ):
														lowerCamelCase__      :			str 						= self.tokenizer.model_input_names
														lowerCamelCase__      :			List[str] 						= self.image_processor.model_input_names
														return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names  )  )




							@property
							def 	lowerCamelCase_       (							self:       Dict  ):
														warnings.warn(
														    """`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead."""    ,							__A    ,							)
														return self.image_processor_class









'''simple docstring'''







from ...configuration_utils import PretrainedConfig
from ...utils import logging


_A			:    str					  =logging.get_logger(__name__)

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

class _lowercase			(       _lowercase	):
							a          = """roc_bert"""




							def __init__(							self:       Optional[Any]    ,							UpperCamelCase__:       Any=30_522    ,							UpperCamelCase__:       Optional[Any]=768    ,							UpperCamelCase__:       Union[str, Any]=12    ,							UpperCamelCase__:       Tuple=12    ,							UpperCamelCase__:       Tuple=3_072    ,							UpperCamelCase__:       str="gelu"    ,							UpperCamelCase__:       List[Any]=0.1    ,							UpperCamelCase__:       List[str]=0.1    ,							UpperCamelCase__:       Dict=512    ,							UpperCamelCase__:       str=2    ,							UpperCamelCase__:       str=0.02    ,							UpperCamelCase__:       Tuple=1e-12    ,							UpperCamelCase__:       Any=True    ,							UpperCamelCase__:       Union[str, Any]=0    ,							UpperCamelCase__:       List[Any]="absolute"    ,							UpperCamelCase__:       Any=None    ,							UpperCamelCase__:       Any=True    ,							UpperCamelCase__:       Optional[int]=True    ,							UpperCamelCase__:       Union[str, Any]=768    ,							UpperCamelCase__:       int=910    ,							UpperCamelCase__:       Tuple=512    ,							UpperCamelCase__:       int=24_858    ,							UpperCamelCase__:       Optional[Any]=True    ,							**UpperCamelCase__:       Optional[Any]    ,							):
														lowerCamelCase__      :			Optional[Any] 						= vocab_size
														lowerCamelCase__      :			Tuple 						= max_position_embeddings
														lowerCamelCase__      :			List[Any] 						= hidden_size
														lowerCamelCase__      :			int 						= num_hidden_layers
														lowerCamelCase__      :			Tuple 						= num_attention_heads
														lowerCamelCase__      :			Any 						= intermediate_size
														lowerCamelCase__      :			List[str] 						= hidden_act
														lowerCamelCase__      :			str 						= hidden_dropout_prob
														lowerCamelCase__      :			Dict 						= attention_probs_dropout_prob
														lowerCamelCase__      :			Union[str, Any] 						= initializer_range
														lowerCamelCase__      :			Tuple 						= type_vocab_size
														lowerCamelCase__      :			Optional[Any] 						= layer_norm_eps
														lowerCamelCase__      :			List[Any] 						= use_cache
														lowerCamelCase__      :			Tuple 						= enable_pronunciation
														lowerCamelCase__      :			Union[str, Any] 						= enable_shape
														lowerCamelCase__      :			Union[str, Any] 						= pronunciation_embed_dim
														lowerCamelCase__      :			Any 						= pronunciation_vocab_size
														lowerCamelCase__      :			int 						= shape_embed_dim
														lowerCamelCase__      :			Tuple 						= shape_vocab_size
														lowerCamelCase__      :			Optional[Any] 						= concat_input
														lowerCamelCase__      :			str 						= position_embedding_type
														lowerCamelCase__      :			Dict 						= classifier_dropout
														super().__init__(pad_token_id=UpperCamelCase__    ,							**UpperCamelCase__  )

