




'''simple docstring'''
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding
class   __UpperCAmelCase				(     lowerCAmelCase				):



					'''simple docstring'''





					_UpperCamelCase							=		["""image_processor""", """tokenizer"""]
					_UpperCamelCase							=		"""AutoImageProcessor"""
					_UpperCamelCase							=		"""AutoTokenizer"""



					def __init__(	self     :						Optional[Any]      ,       _lowercase     :						List[Any]      ,       _lowercase     :						Any)    ->							Any:
								super().__init__(_lowercase      ,       _lowercase)
								A_									= self.image_processor



					def __call__(	self     :						Any      ,       _lowercase     :						str=None      ,       _lowercase     :						Union[str, Any]=None      ,       _lowercase     :						str=None      ,       **_lowercase     :						Optional[Any])    ->							str:

								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_									= self.tokenizer(_lowercase      ,       return_tensors=_lowercase      ,       **_lowercase)

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

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



					def     __snake_case						(	self     :						Tuple      ,       *_lowercase     :						Tuple      ,       **_lowercase     :						str)    ->							Tuple:
								return self.tokenizer.batch_decode(*_lowercase      ,       **_lowercase)



					def     __snake_case						(	self     :						List[str]      ,       *_lowercase     :						str      ,       **_lowercase     :						List[str])    ->							Tuple:
								return self.tokenizer.decode(*_lowercase      ,       **_lowercase)



					@property
					def     __snake_case						(	self     :						Optional[Any])    ->							Optional[Any]:
								return ["input_ids", "attention_mask", "pixel_values"]










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


_SCREAMING_SNAKE_CASE			=						logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE			=						{
    "facebook/dpr-ctx_encoder-single-nq-base": (
        "https://huggingface.co/facebook/dpr-ctx_encoder-single-nq-base/resolve/main/config.json"
    ),
    "facebook/dpr-question_encoder-single-nq-base": (
        "https://huggingface.co/facebook/dpr-question_encoder-single-nq-base/resolve/main/config.json"
    ),
    "facebook/dpr-reader-single-nq-base": (
        "https://huggingface.co/facebook/dpr-reader-single-nq-base/resolve/main/config.json"
    ),
    "facebook/dpr-ctx_encoder-multiset-base": (
        "https://huggingface.co/facebook/dpr-ctx_encoder-multiset-base/resolve/main/config.json"
    ),
    "facebook/dpr-question_encoder-multiset-base": (
        "https://huggingface.co/facebook/dpr-question_encoder-multiset-base/resolve/main/config.json"
    ),
    "facebook/dpr-reader-multiset-base": (
        "https://huggingface.co/facebook/dpr-reader-multiset-base/resolve/main/config.json"
    ),
}
class   __UpperCAmelCase				(     lowerCAmelCase				):



					'''simple docstring'''





					_UpperCamelCase							=		"""dpr"""



					def __init__(	self     :						Optional[Any]      ,       _lowercase     :						Dict=30_522      ,       _lowercase     :						Tuple=768      ,       _lowercase     :						int=12      ,       _lowercase     :						List[str]=12      ,       _lowercase     :						Union[str, Any]=3_072      ,       _lowercase     :						Dict="gelu"      ,       _lowercase     :						Dict=0.1      ,       _lowercase     :						Any=0.1      ,       _lowercase     :						Union[str, Any]=512      ,       _lowercase     :						Optional[int]=2      ,       _lowercase     :						Union[str, Any]=0.02      ,       _lowercase     :						List[Any]=1E-12      ,       _lowercase     :						List[str]=0      ,       _lowercase     :						Dict="absolute"      ,       _lowercase     :						int = 0      ,       **_lowercase     :						int      ,       )    ->							int:
								super().__init__(pad_token_id=_lowercase      ,       **_lowercase)

								A_									= vocab_size
								A_									= hidden_size
								A_									= num_hidden_layers
								A_									= num_attention_heads
								A_									= hidden_act
								A_									= intermediate_size
								A_									= hidden_dropout_prob
								A_									= attention_probs_dropout_prob
								A_									= max_position_embeddings
								A_									= type_vocab_size
								A_									= initializer_range
								A_									= layer_norm_eps
								A_									= projection_dim
								A_									= position_embedding_type




