


'''simple docstring'''







from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


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

A__:    List[Any]					    =       {
    '''hustvl/yolos-small''': '''https://huggingface.co/hustvl/yolos-small/resolve/main/config.json''',
    # See all YOLOS models at https://huggingface.co/models?filter=yolos
}







class A__       (						_snake_case      ):
      __UpperCamelCase       :  Union[str, Any]	       =							'''yolos'''






      def __init__( self			:List[str]     ,						SCREAMING_SNAKE_CASE			:Tuple=7_6_8     ,						SCREAMING_SNAKE_CASE			:List[Any]=1_2     ,						SCREAMING_SNAKE_CASE			:Tuple=1_2     ,						SCREAMING_SNAKE_CASE			:Optional[Any]=3_0_7_2     ,						SCREAMING_SNAKE_CASE			:Optional[int]="gelu"     ,						SCREAMING_SNAKE_CASE			:Dict=0.0     ,						SCREAMING_SNAKE_CASE			:Optional[Any]=0.0     ,						SCREAMING_SNAKE_CASE			:int=0.02     ,						SCREAMING_SNAKE_CASE			:List[str]=1e-12     ,						SCREAMING_SNAKE_CASE			:Dict=[5_1_2, 8_6_4]     ,						SCREAMING_SNAKE_CASE			:str=1_6     ,						SCREAMING_SNAKE_CASE			:List[str]=3     ,						SCREAMING_SNAKE_CASE			:str=True     ,						SCREAMING_SNAKE_CASE			:Union[str, Any]=1_0_0     ,						SCREAMING_SNAKE_CASE			:Optional[Any]=True     ,						SCREAMING_SNAKE_CASE			:Optional[Any]=False     ,						SCREAMING_SNAKE_CASE			:Optional[int]=1     ,						SCREAMING_SNAKE_CASE			:Optional[int]=5     ,						SCREAMING_SNAKE_CASE			:str=2     ,						SCREAMING_SNAKE_CASE			:Optional[Any]=5     ,						SCREAMING_SNAKE_CASE			:Union[str, Any]=2     ,						SCREAMING_SNAKE_CASE			:str=0.1     ,						**SCREAMING_SNAKE_CASE			:Tuple     ,						)       ->					Optional[Any]:




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

             _a    : List[str]     					=hidden_size
             _a    : Any     					=num_hidden_layers
             _a    : List[Any]     					=num_attention_heads
             _a    : Optional[Any]     					=intermediate_size
             _a    : Any     					=hidden_act
             _a    : int     					=hidden_dropout_prob
             _a    : List[Any]     					=attention_probs_dropout_prob
             _a    : Tuple     					=initializer_range
             _a    : Optional[Any]     					=layer_norm_eps
             _a    : Dict     					=image_size
             _a    : List[str]     					=patch_size
             _a    : Optional[Any]     					=num_channels
             _a    : Union[str, Any]     					=qkv_bias
             _a    : Optional[int]     					=num_detection_tokens
             _a    : Dict     					=use_mid_position_embeddings
             _a    : Union[str, Any]     					=auxiliary_loss
             # Hungarian matcher
             _a    : List[str]     					=class_cost
             _a    : Dict     					=bbox_cost
             _a    : str     					=giou_cost
             # Loss coefficients
             _a    : List[str]     					=bbox_loss_coefficient
             _a    : Union[str, Any]     					=giou_loss_coefficient
             _a    : int     					=eos_coefficient







class A__       (						_snake_case      ):
      __UpperCamelCase       :  List[Any]	       =							version.parse("1.11"      )






      @property
      def __UpperCAmelCase       ( self			:int	)       ->					Mapping[str, Mapping[int, str]]:




             '''simple docstring'''
             return OrderedDict(
                 [
                     ("""pixel_values""", {0: """batch""", 1: """num_channels""", 2: """height""", 3: """width"""}),
                 ]	)






      @property
      def __UpperCAmelCase       ( self			:List[Any]	)       ->					float:




             '''simple docstring'''
             return 1e-4






      @property
      def __UpperCAmelCase       ( self			:Optional[int]	)       ->					int:




             '''simple docstring'''
             return 1_2










import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_convbert import ConvBertTokenizer


__UpperCAmelCase								=						logging.get_logger(__name__)

__UpperCAmelCase								=						{'vocab_file': 'vocab.txt'}

__UpperCAmelCase								=						{
    'vocab_file': {
        'YituTech/conv-bert-base': 'https://huggingface.co/YituTech/conv-bert-base/resolve/main/vocab.txt',
        'YituTech/conv-bert-medium-small': (
            'https://huggingface.co/YituTech/conv-bert-medium-small/resolve/main/vocab.txt'
        ),
        'YituTech/conv-bert-small': 'https://huggingface.co/YituTech/conv-bert-small/resolve/main/vocab.txt',
    }
}

__UpperCAmelCase								=						{
    'YituTech/conv-bert-base': 512,
    'YituTech/conv-bert-medium-small': 512,
    'YituTech/conv-bert-small': 512,
}


__UpperCAmelCase								=						{
    'YituTech/conv-bert-base': {'do_lower_case': True},
    'YituTech/conv-bert-medium-small': {'do_lower_case': True},
    'YituTech/conv-bert-small': {'do_lower_case': True},
}



class   lowerCamelCase      (_snake_case			):







		'''simple docstring'''



		_snake_case    :    Optional[int]       						=  VOCAB_FILES_NAMES
		_snake_case    :    int       						=  PRETRAINED_VOCAB_FILES_MAP
		_snake_case    :    Dict       						=  PRETRAINED_INIT_CONFIGURATION
		_snake_case    :    List[str]       						=  PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
		_snake_case    :    Any       						=  ConvBertTokenizer



		def __init__(							self				,		_UpperCamelCase=None				,		_UpperCamelCase=None				,		_UpperCamelCase=True				,		_UpperCamelCase="[UNK]"				,		_UpperCamelCase="[SEP]"				,		_UpperCamelCase="[PAD]"				,		_UpperCamelCase="[CLS]"				,		_UpperCamelCase="[MASK]"				,		_UpperCamelCase=True				,		_UpperCamelCase=None				,		**_UpperCamelCase				,		)	->							Dict:
							super().__init__(
							    _UpperCamelCase				,		tokenizer_file=_UpperCamelCase				,		do_lower_case=_UpperCamelCase				,		unk_token=_UpperCamelCase				,		sep_token=_UpperCamelCase				,		pad_token=_UpperCamelCase				,		cls_token=_UpperCamelCase				,		mask_token=_UpperCamelCase				,		tokenize_chinese_chars=_UpperCamelCase				,		strip_accents=_UpperCamelCase				,		**_UpperCamelCase				,		)

							UpperCAmelCase_    :      Optional[int]            =						json.loads(self.backend_tokenizer.normalizer.__getstate__()   )
							if (
							    normalizer_state.get('lowercase'				,		_UpperCamelCase   ) != do_lower_case
							    or normalizer_state.get('strip_accents'				,		_UpperCamelCase   ) != strip_accents
							    or normalizer_state.get('handle_chinese_chars'				,		_UpperCamelCase   ) != tokenize_chinese_chars
							):
												UpperCAmelCase_    :      Any            =						getattr(_UpperCamelCase				,		normalizer_state.pop('type'   )   )
												UpperCAmelCase_    :      str            =						do_lower_case
												UpperCAmelCase_    :      List[Any]            =						strip_accents
												UpperCAmelCase_    :      str            =						tokenize_chinese_chars
												UpperCAmelCase_    :      Tuple            =						normalizer_class(**_UpperCamelCase   )

							UpperCAmelCase_    :      Any            =						do_lower_case



		def 					__UpperCAmelCase			(							self				,		_UpperCamelCase				,		_UpperCamelCase=None   )	->							List[str]:
							UpperCAmelCase_    :      int            =						[self.cls_token_id] + token_ids_a + [self.sep_token_id]

							if token_ids_a:
												output += token_ids_a + [self.sep_token_id]

							return output



		def 					__UpperCAmelCase			(							self				,		_UpperCamelCase				,		_UpperCamelCase = None   )	->							List[int]:
							UpperCAmelCase_    :      Union[str, Any]            =						[self.sep_token_id]
							UpperCAmelCase_    :      int            =						[self.cls_token_id]
							if token_ids_a is None:
												return len(cls + token_ids_a + sep   ) * [0]
							return len(cls + token_ids_a + sep   ) * [0] + len(token_ids_a + sep   ) * [1]



		def 					__UpperCAmelCase			(							self				,		_UpperCamelCase				,		_UpperCamelCase = None   )	->							Tuple[str]:
							UpperCAmelCase_    :      Any            =						self._tokenizer.model.save(_UpperCamelCase				,		name=_UpperCamelCase   )
							return tuple(_UpperCamelCase   )






