




"""simple docstring"""
import warnings
from typing import List, Optional, Union

from ...image_utils import ImageInput
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...utils import TensorType

class __lowercase(   SCREAMING_SNAKE_CASE_					):




					'''simple docstring'''


					__a    :    Union[str, Any]  		=			['image_processor', 'tokenizer']
					__a    :    Dict  		=			'FlavaImageProcessor'
					__a    :    Optional[Any]  		=			('BertTokenizer', 'BertTokenizerFast')
					def __init__(     self    ,						__a=None    ,						__a=None    ,						**__a  ):
								__lowerCamelCase       :						Union[str, Any]													=					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       :						Dict													=					kwargs.pop('feature_extractor'  )

								__lowerCamelCase       :						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__(__a    ,						__a  )
								__lowerCamelCase       :						str													=					self.image_processor
					def __call__(     self    ,						__a = None    ,						__a = None    ,						__a = True    ,						__a = False    ,						__a = False    ,						__a = None    ,						__a = 0    ,						__a = None    ,						__a = None    ,						__a = None    ,						__a = None    ,						__a = None    ,						__a = False    ,						__a = False    ,						__a = False    ,						__a = False    ,						__a = True    ,						__a = None    ,						**__a    ,						):

								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       :						int													=					self.tokenizer(
											    text=__a    ,						add_special_tokens=__a    ,						padding=__a    ,						truncation=__a    ,						max_length=__a    ,						stride=__a    ,						pad_to_multiple_of=__a    ,						return_token_type_ids=__a    ,						return_attention_mask=__a    ,						return_overflowing_tokens=__a    ,						return_special_tokens_mask=__a    ,						return_offsets_mapping=__a    ,						return_length=__a    ,						verbose=__a    ,						return_tensors=__a    ,						**__a    ,						)
								if images is not None:
											__lowerCamelCase       :						Union[str, Any]													=					self.image_processor(
											    __a    ,						return_image_mask=__a    ,						return_codebook_pixels=__a    ,						return_tensors=__a    ,						**__a    ,						)

								if text is not None and images is not None:
											encoding.update(__a  )
											return encoding
								elif text is not None:
											return encoding
								else:
											return BatchEncoding(data=dict(**__a  )    ,						tensor_type=__a  )
					def      snake_case_					(     self    ,						*__a    ,						**__a  ):
								return self.tokenizer.batch_decode(*__a    ,						**__a  )
					def      snake_case_					(     self    ,						*__a    ,						**__a  ):
								return self.tokenizer.decode(*__a    ,						**__a  )
					@property
					def      snake_case_					(     self  ):
								__lowerCamelCase       :						Optional[Any]													=					self.tokenizer.model_input_names
								__lowerCamelCase       :						Dict													=					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.'    ,						__a    ,						)
								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.'    ,						__a    ,						)
								return self.image_processor








'''simple docstring'''





import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto.configuration_auto import CONFIG_MAPPING


A__    :   Union[str, Any]           =					logging.get_logger(__name__)



class  snake_case__						(    SCREAMING_SNAKE_CASE_				):
 A__				= '''upernet'''
 def __init__(   self						:							Optional[int]      ,     __a						:							Dict=None      ,     __a						:							List[str]=512      ,     __a						:							int=0.0_2      ,     __a						:							Optional[Any]=[1, 2, 3, 6]      ,     __a						:							Union[str, Any]=True      ,     __a						:							Any=0.4      ,     __a						:							int=384      ,     __a						:							int=256      ,     __a						:							str=1      ,     __a						:							List[Any]=False      ,     __a						:							Dict=255      ,     **__a						:							Dict      ,     )      ->   Optional[int]:







       '''simple docstring'''
       super().__init__(**__a  )

       if backbone_config is None:
             logger.info('`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone.'  )
             __snake_case :   Optional[int]													=    CONFIG_MAPPING['resnet'](out_features=['stage1', 'stage2', 'stage3', 'stage4']  )
       elif isinstance(__a      ,     __a  ):
             __snake_case :   List[Any]													=    backbone_config.get('model_type'  )
             __snake_case :   List[str]													=    CONFIG_MAPPING[backbone_model_type]
             __snake_case :   int													=    config_class.from_dict(__a  )

       __snake_case :   Any													=    backbone_config
       __snake_case :   Tuple													=    hidden_size
       __snake_case :   str													=    initializer_range
       __snake_case :   Dict													=    pool_scales
       __snake_case :   Optional[Any]													=    use_auxiliary_head
       __snake_case :   Optional[Any]													=    auxiliary_loss_weight
       __snake_case :   Optional[int]													=    auxiliary_in_channels
       __snake_case :   Dict													=    auxiliary_channels
       __snake_case :   Any													=    auxiliary_num_convs
       __snake_case :   Optional[Any]													=    auxiliary_concat_input
       __snake_case :   List[str]													=    loss_ignore_index





 def A_   (   self						:							List[Any]  )      ->   Union[str, Any]:







       '''simple docstring'''
       __snake_case :   Union[str, Any]													=    copy.deepcopy(self.__dict__  )
       __snake_case :   str													=    self.backbone_config.to_dict()
       __snake_case :   Optional[int]													=    self.__class__.model_type
       return output



