






'''simple docstring'''







import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_layoutlm import LayoutLMTokenizer


__lowerCAmelCase					   =       logging.get_logger(__name__)

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

__lowerCAmelCase					   =       {
    "vocab_file": {
        "microsoft/layoutlm-base-uncased": (
            "https://huggingface.co/microsoft/layoutlm-base-uncased/resolve/main/vocab.txt"
        ),
        "microsoft/layoutlm-large-uncased": (
            "https://huggingface.co/microsoft/layoutlm-large-uncased/resolve/main/vocab.txt"
        ),
    },
    "tokenizer_file": {
        "microsoft/layoutlm-base-uncased": (
            "https://huggingface.co/microsoft/layoutlm-base-uncased/resolve/main/tokenizer.json"
        ),
        "microsoft/layoutlm-large-uncased": (
            "https://huggingface.co/microsoft/layoutlm-large-uncased/resolve/main/tokenizer.json"
        ),
    },
}

__lowerCAmelCase					   =       {
    "microsoft/layoutlm-base-uncased": 5_12,
    "microsoft/layoutlm-large-uncased": 5_12,
}

__lowerCAmelCase					   =       {
    "microsoft/layoutlm-base-uncased": {"do_lower_case": True},
    "microsoft/layoutlm-large-uncased": {"do_lower_case": True},
}




class      __SCREAMING_SNAKE_CASE					(__A					):


  """simple docstring"""


  _a     :   Dict			 =    VOCAB_FILES_NAMES
  _a     :   Optional[Any]			 =    PRETRAINED_VOCAB_FILES_MAP
  _a     :   Optional[int]			 =    PRETRAINED_INIT_CONFIGURATION
  _a     :   Tuple			 =    PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
  _a     :   Union[str, Any]			 =    LayoutLMTokenizer







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






         """simple docstring"""


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

         a_	    = 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
         ):
                a_	    = getattr(UpperCamelCase__      ,  normalizer_state.pop('type'  )  )
                a_	    = do_lower_case
                a_	    = strip_accents
                a_	    = tokenize_chinese_chars
                a_	    = normalizer_class(**UpperCamelCase__  )

         a_	    = do_lower_case







  def       _a					( self      ,  UpperCamelCase__      ,  UpperCamelCase__=None  ):






         """simple docstring"""


         a_	    = [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       _a					( self      ,  UpperCamelCase__      ,  UpperCamelCase__ = None  ):






         """simple docstring"""


         a_	    = [self.sep_token_id]
         a_	    = [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       _a					( self      ,  UpperCamelCase__      ,  UpperCamelCase__ = None  ):






         """simple docstring"""


         a_	    = self._tokenizer.model.save(UpperCamelCase__      ,  name=UpperCamelCase__  )
         return tuple(UpperCamelCase__  )












'''simple docstring'''







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


__lowerCAmelCase					   =       logging.get_logger(__name__)

__lowerCAmelCase					   =       {
    "uw-madison/nystromformer-512": "https://huggingface.co/uw-madison/nystromformer-512/resolve/main/config.json",
    # See all Nystromformer models at https://huggingface.co/models?filter=nystromformer
}




class      __SCREAMING_SNAKE_CASE					(__A					):


  """simple docstring"""


  _a     :   Union[str, Any]			 =    '''nystromformer'''







  def __init__( self      ,  UpperCamelCase__=30_000      ,  UpperCamelCase__=768      ,  UpperCamelCase__=12      ,  UpperCamelCase__=12      ,  UpperCamelCase__=3_072      ,  UpperCamelCase__="gelu_new"      ,  UpperCamelCase__=0.1      ,  UpperCamelCase__=0.1      ,  UpperCamelCase__=510      ,  UpperCamelCase__=2      ,  UpperCamelCase__=64      ,  UpperCamelCase__=64      ,  UpperCamelCase__=65      ,  UpperCamelCase__=False      ,  UpperCamelCase__=0.02      ,  UpperCamelCase__=1e-5      ,  UpperCamelCase__=1      ,  UpperCamelCase__=0      ,  UpperCamelCase__=2      ,  **UpperCamelCase__      ,  ):






         """simple docstring"""


         a_	    = vocab_size
         a_	    = max_position_embeddings
         a_	    = hidden_size
         a_	    = num_hidden_layers
         a_	    = num_attention_heads
         a_	    = intermediate_size
         a_	    = hidden_act
         a_	    = hidden_dropout_prob
         a_	    = attention_probs_dropout_prob
         a_	    = initializer_range
         a_	    = type_vocab_size
         a_	    = segment_means_seq_len
         a_	    = num_landmarks
         a_	    = conv_kernel_size
         a_	    = inv_coeff_init_option
         a_	    = layer_norm_eps
         super().__init__(pad_token_id=UpperCamelCase__      ,  bos_token_id=UpperCamelCase__      ,  eos_token_id=UpperCamelCase__      ,  **UpperCamelCase__  )




