



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


_snake_case	=						logging.get_logger(__name__)

_snake_case	=						{"vocab_file": "vocab.txt"}

_snake_case	=						{
    "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",
    }
}

_snake_case	=						{
    "YituTech/conv-bert-base": 512,
    "YituTech/conv-bert-medium-small": 512,
    "YituTech/conv-bert-small": 512,
}


_snake_case	=						{
    "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 						UpperCAmelCase_					( a):
       lowerCamelCase__         =	VOCAB_FILES_NAMES
       lowerCamelCase__         =	PRETRAINED_VOCAB_FILES_MAP
       lowerCamelCase__         =	PRETRAINED_INIT_CONFIGURATION
       lowerCamelCase__         =	PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
       lowerCamelCase__         =	ConvBertTokenizer







       def __init__(     self,    __a=None,    __a=None,    __a=True,    __a="[UNK]",    __a="[SEP]",    __a="[PAD]",    __a="[CLS]",    __a="[MASK]",    __a=True,    __a=None,    **__a,    ):

              '''simple docstring'''

              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,    )

              _lowerCAmelCase  :							Union[str, 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
              ):
                     _lowerCAmelCase  :							Union[str, Any]				     =					getattr(__a,    normalizer_state.pop("type"))
                     _lowerCAmelCase  :							List[Any]				     =					do_lower_case
                     _lowerCAmelCase  :							Tuple				     =					strip_accents
                     _lowerCAmelCase  :							Tuple				     =					tokenize_chinese_chars
                     _lowerCAmelCase  :							List[str]				     =					normalizer_class(**__a)

              _lowerCAmelCase  :							str				     =					do_lower_case







       def      snake_case__   (     self,    __a,    __a=None):

              '''simple docstring'''

              _lowerCAmelCase  :							Optional[Any]				     =					[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):

              '''simple docstring'''

              _lowerCAmelCase  :							List[Any]				     =					[self.sep_token_id]
              _lowerCAmelCase  :							List[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):

              '''simple docstring'''

              _lowerCAmelCase  :							List[str]				     =					self._tokenizer.model.save(__a,    name=__a)
              return tuple(__a)





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


_snake_case	=						logging.get_logger(__name__)

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



class 						UpperCAmelCase_					( a     ,      a):
							lowerCamelCase__         =	'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,    ):

														'''simple docstring'''

														super().__init__(**__a)

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