





import sys

from .dependency_versions_table import deps
from .utils.versions import require_version, require_version_core


# define which module versions we always want to check at run time
# (usually the ones defined in `install_requires` in setup.py)
#
# order specific notes:
# - tqdm must be checked before tokenizers

a_    :						Optional[Any]    		=      'python tqdm regex requests packaging filelock numpy tokenizers'.split()
if sys.version_info < (3, 7):
      pkgs_to_check_at_runtime.append("dataclasses")
if sys.version_info < (3, 8):
      pkgs_to_check_at_runtime.append("importlib_metadata")

for pkg in pkgs_to_check_at_runtime:
      if pkg in deps:
            if pkg == "tokenizers":
                  # must be loaded here, or else tqdm check may fail
                  from .utils import is_tokenizers_available

                  if not is_tokenizers_available():
                        continue  # not required, check version only if installed

            require_version_core(deps[pkg])
      else:
            raise ValueError(F"""can't find {pkg} in {deps.keys()}, check dependency_versions_table.py""")


def        __lowerCAmelCase    (       _UpperCamelCase		:  Tuple		,							_UpperCamelCase		:  List[str]=None	)		->							int:
 '''simple docstring'''


 require_version(deps[pkg]		,							_SCREAMING_SNAKE_CASE	)




from typing import List, Optional, Tuple

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_herbert import HerbertTokenizer


a_    :						Optional[Any]    		=      logging.get_logger(__name__)

a_    :						Optional[Any]    		=      {"vocab_file": "vocab.json", "merges_file": "merges.txt", "tokenizer_file": "tokenizer.json"}

a_    :						Any    		=      {
    "vocab_file": {
        "allegro/herbert-base-cased": "https://huggingface.co/allegro/herbert-base-cased/resolve/main/vocab.json"
    },
    "merges_file": {
        "allegro/herbert-base-cased": "https://huggingface.co/allegro/herbert-base-cased/resolve/main/merges.txt"
    },
}

a_    :						Union[str, Any]    		=      {"allegro/herbert-base-cased": 514}
a_    :						List[Any]    		=      {}




class      UpperCamelCase (     SCREAMING_SNAKE_CASE   ):
    __UpperCamelCase         =VOCAB_FILES_NAMES
    __UpperCamelCase         =PRETRAINED_VOCAB_FILES_MAP
    __UpperCamelCase         =PRETRAINED_INIT_CONFIGURATION
    __UpperCamelCase         =PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
    __UpperCamelCase         =HerbertTokenizer

    def __init__(			self :      Tuple							,    snake_case__ :      Optional[Any]=None							,    snake_case__ :      int=None							,    snake_case__ :      Optional[int]=None							,    snake_case__ :      str="<s>"							,    snake_case__ :      Tuple="<unk>"							,    snake_case__ :      List[str]="<pad>"							,    snake_case__ :      Tuple="<mask>"							,    snake_case__ :      Dict="</s>"							,    **snake_case__ :      List[str]							,    ):

     """simple docstring"""






     super().__init__(
         snake_case__							,    snake_case__							,    tokenizer_file=snake_case__							,    cls_token=snake_case__							,    unk_token=snake_case__							,    pad_token=snake_case__							,    mask_token=snake_case__							,    sep_token=snake_case__							,    **snake_case__							,    )

    def UpperCamelCase			(			self :      Union[str, Any]							,    snake_case__ :      List[int]							,    snake_case__ :      Optional[List[int]] = None    ):

     """simple docstring"""






     SCREAMING_SNAKE_CASE								=			[self.cls_token_id]
     SCREAMING_SNAKE_CASE								=			[self.sep_token_id]
     if token_ids_a is None:
      return cls + token_ids_a + sep

     return cls + token_ids_a + sep + token_ids_a + sep

    def UpperCamelCase			(			self :      Optional[Any]							,    snake_case__ :      List[int]							,    snake_case__ :      Optional[List[int]] = None							,    snake_case__ :      bool = False    ):

     """simple docstring"""






     if already_has_special_tokens:
      return super().get_special_tokens_mask(
          token_ids_a=snake_case__							,    token_ids_a=snake_case__							,    already_has_special_tokens=snake_case__    )

     if token_ids_a is None:
      return [1] + ([0] * len(snake_case__    )) + [1]
     return [1] + ([0] * len(snake_case__    )) + [1] + ([0] * len(snake_case__    )) + [1]

    def UpperCamelCase			(			self :      Optional[Any]							,    snake_case__ :      List[int]							,    snake_case__ :      Optional[List[int]] = None    ):

     """simple docstring"""






     SCREAMING_SNAKE_CASE								=			[self.sep_token_id]
     SCREAMING_SNAKE_CASE								=			[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 :      Tuple							,    snake_case__ :      str							,    snake_case__ :      Optional[str] = None    ):

     """simple docstring"""






     SCREAMING_SNAKE_CASE								=			self._tokenizer.model.save(snake_case__							,    name=snake_case__    )
     return tuple(snake_case__    )

