




'''simple docstring'''







from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


lowercase      :   Tuple      =       logging.get_logger(__name__)

lowercase      :   Dict      =       {
    """microsoft/focalnet-tiny""": """https://huggingface.co/microsoft/focalnet-tiny/resolve/main/config.json""",
}







class 					_a (a__,		a__	):





     '''simple docstring'''



     lowerCAmelCase_  :     Any          =					"""focalnet"""







     def __init__(				self							,__a=224							,__a=4							,__a=3							,__a=96							,__a=False							,__a=[192, 384, 768, 768]							,__a=[2, 2, 6, 2]							,__a=[2, 2, 2, 2]							,__a=[3, 3, 3, 3]							,__a="gelu"							,__a=4.0							,__a=0.0							,__a=0.1							,__a=False							,__a=1E-4							,__a=False							,__a=False							,__a=False							,__a=0.02							,__a=1E-5							,__a=32							,__a=None							,__a=None							,**__a							,)      ->				Union[str, Any]:
          super().__init__(**__a							)

          snake_case			:      Tuple        =			image_size
          snake_case			:      List[Any]        =			patch_size
          snake_case			:      List[Any]        =			num_channels
          snake_case			:      Optional[int]        =			embed_dim
          snake_case			:      Optional[Any]        =			use_conv_embed
          snake_case			:      Union[str, Any]        =			hidden_sizes
          snake_case			:      Optional[int]        =			depths
          snake_case			:      Tuple        =			focal_levels
          snake_case			:      str        =			focal_windows
          snake_case			:      Dict        =			hidden_act
          snake_case			:      Any        =			mlp_ratio
          snake_case			:      str        =			hidden_dropout_prob
          snake_case			:      Dict        =			drop_path_rate
          snake_case			:      List[Any]        =			use_layerscale
          snake_case			:      Tuple        =			layerscale_value
          snake_case			:      List[str]        =			use_post_layernorm
          snake_case			:      List[Any]        =			use_post_layernorm_in_modulation
          snake_case			:      Optional[int]        =			normalize_modulator
          snake_case			:      Optional[Any]        =			initializer_range
          snake_case			:      Optional[Any]        =			layer_norm_eps
          snake_case			:      str        =			encoder_stride
          snake_case			:      Any        =			["""stem"""] + [F'''stage{idx}''' for idx in range(1							,len(self.depths							) + 1							)]
          snake_case ,		snake_case			:      Union[str, Any]        =			get_aligned_output_features_output_indices(
              out_features=__a							,out_indices=__a							,stage_names=self.stage_names							)









'''simple docstring'''







import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_lxmert import LxmertTokenizer


lowercase      :   Tuple      =       {"""vocab_file""": """vocab.txt""", """tokenizer_file""": """tokenizer.json"""}

lowercase      :   Dict      =       {
    """vocab_file""": {
        """unc-nlp/lxmert-base-uncased""": """https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/vocab.txt""",
    },
    """tokenizer_file""": {
        """unc-nlp/lxmert-base-uncased""": (
            """https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/tokenizer.json"""
        ),
    },
}

lowercase      :   List[Any]      =       {
    """unc-nlp/lxmert-base-uncased""": 512,
}

lowercase      :   Tuple      =       {
    """unc-nlp/lxmert-base-uncased""": {"""do_lower_case""": True},
}







class 					_a (a__	):





     '''simple docstring'''



     lowerCAmelCase_  :     Optional[int]          =					VOCAB_FILES_NAMES
     lowerCAmelCase_  :     Optional[int]          =					PRETRAINED_VOCAB_FILES_MAP
     lowerCAmelCase_  :     Any          =					PRETRAINED_INIT_CONFIGURATION
     lowerCAmelCase_  :     Optional[int]          =					PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
     lowerCAmelCase_  :     Optional[int]          =					LxmertTokenizer







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

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

          snake_case			:      str        =			do_lower_case







     def 			snake_case_      (				self							,__a							,__a=None							)      ->				Optional[int]:
          snake_case			:      Tuple        =			[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 			snake_case_      (				self							,__a							,__a = None							)      ->				List[int]:
          snake_case			:      int        =			[self.sep_token_id]
          snake_case			:      Any        =			[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 			snake_case_      (				self							,__a							,__a = None							)      ->				Tuple[str]:
          snake_case			:      Optional[int]        =			self._tokenizer.model.save(__a							,name=__a							)
          return tuple(__a							)



