"""simple docstring"""






import warnings

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


class 					UpperCAmelCase		(SCREAMING_SNAKE_CASE__						):



				"""simple docstring"""

				_UpperCAmelCase			:Dict							=				["image_processor", "tokenizer"]
				_UpperCAmelCase			:Optional[Any]							=				"AutoImageProcessor"
				_UpperCAmelCase			:Any							=				"AutoTokenizer"






				def __init__(     self					,    _UpperCAmelCase=None					,    _UpperCAmelCase=None					,    **_UpperCAmelCase							):
							lowercase__:     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.'''					,    _UpperCAmelCase					,    )
										lowercase__:     List[Any]      =   kwargs.pop('''feature_extractor'''							)

							lowercase__:     int      =   image_processor if image_processor is not None else feature_extractor
							if image_processor is None:
										raise ValueError('''You have to specify an image_processor.'''							)
							if tokenizer is None:
										raise ValueError('''You have to specify a tokenizer.'''							)

							super().__init__(_UpperCAmelCase					,    _UpperCAmelCase							)
							lowercase__:     List[str]      =   self.image_processor






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



							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__:     Any      =   self.tokenizer(_UpperCAmelCase					,    return_tensors=_UpperCAmelCase					,    **_UpperCAmelCase							)

							if images is not None:
										lowercase__:     Tuple      =   self.image_processor(_UpperCAmelCase					,    return_tensors=_UpperCAmelCase					,    **_UpperCAmelCase							)

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






				def _snake_case    (     self					,    *_UpperCAmelCase					,    **_UpperCAmelCase							):
							return self.tokenizer.batch_decode(*_UpperCAmelCase					,    **_UpperCAmelCase							)






				def _snake_case    (     self					,    *_UpperCAmelCase					,    **_UpperCAmelCase							):
							return self.tokenizer.decode(*_UpperCAmelCase					,    **_UpperCAmelCase							)






				@property
				def _snake_case    (     self							):
							lowercase__:     int      =   self.tokenizer.model_input_names
							lowercase__:     List[Any]      =   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.'''					,    _UpperCAmelCase					,    )
							return self.image_processor_class






				@property
				def _snake_case    (     self							):
							warnings.warn(
							    '''`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead.'''					,    _UpperCAmelCase					,    )
							return self.image_processor

"""simple docstring"""






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


__A         =				logging.get_logger(__name__)

__A         =				{
    "uw-madison/yoso-4096": "https://huggingface.co/uw-madison/yoso-4096/resolve/main/config.json",
    # See all YOSO models at https://huggingface.co/models?filter=yoso
}


class 					UpperCAmelCase		(_UpperCAmelCase						):



    """simple docstring"""

    _UpperCAmelCase			:Tuple							=				"yoso"






    def __init__(     self					,    _UpperCAmelCase=50265					,    _UpperCAmelCase=768					,    _UpperCAmelCase=12					,    _UpperCAmelCase=12					,    _UpperCAmelCase=3072					,    _UpperCAmelCase="gelu"					,    _UpperCAmelCase=0.1					,    _UpperCAmelCase=0.1					,    _UpperCAmelCase=4096					,    _UpperCAmelCase=1					,    _UpperCAmelCase=0.02					,    _UpperCAmelCase=1e-1_2					,    _UpperCAmelCase="absolute"					,    _UpperCAmelCase=True					,    _UpperCAmelCase=9					,    _UpperCAmelCase=64					,    _UpperCAmelCase=None					,    _UpperCAmelCase=True					,    _UpperCAmelCase=True					,    _UpperCAmelCase=1					,    _UpperCAmelCase=0					,    _UpperCAmelCase=2					,    **_UpperCAmelCase					,    ):
       super().__init__(pad_token_id=_UpperCAmelCase					,    bos_token_id=_UpperCAmelCase					,    eos_token_id=_UpperCAmelCase					,    **_UpperCAmelCase							)

       lowercase__:     int      =   vocab_size
       lowercase__:     List[str]      =   max_position_embeddings
       lowercase__:     Tuple      =   hidden_size
       lowercase__:     Optional[Any]      =   num_hidden_layers
       lowercase__:     Optional[int]      =   num_attention_heads
       lowercase__:     List[Any]      =   intermediate_size
       lowercase__:     Union[str, Any]      =   hidden_act
       lowercase__:     int      =   hidden_dropout_prob
       lowercase__:     Optional[Any]      =   attention_probs_dropout_prob
       lowercase__:     List[Any]      =   initializer_range
       lowercase__:     Optional[Any]      =   type_vocab_size
       lowercase__:     int      =   layer_norm_eps
       lowercase__:     Optional[Any]      =   position_embedding_type
       lowercase__:     int      =   use_expectation
       lowercase__:     List[str]      =   hash_code_len
       lowercase__:     Union[str, Any]      =   num_hash
       lowercase__:     Any      =   conv_window
       lowercase__:     Dict      =   use_fast_hash
       lowercase__:     Dict      =   lsh_backward
