


'''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_bert import BertTokenizer


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

A				:					List[str]    						=			{'''vocab_file''': '''vocab.txt''', '''tokenizer_file''': '''tokenizer.json'''}

A				:					Optional[int]    						=			{
    '''vocab_file''': {
        '''bert-base-uncased''': '''https://huggingface.co/bert-base-uncased/resolve/main/vocab.txt''',
        '''bert-large-uncased''': '''https://huggingface.co/bert-large-uncased/resolve/main/vocab.txt''',
        '''bert-base-cased''': '''https://huggingface.co/bert-base-cased/resolve/main/vocab.txt''',
        '''bert-large-cased''': '''https://huggingface.co/bert-large-cased/resolve/main/vocab.txt''',
        '''bert-base-multilingual-uncased''': (
            '''https://huggingface.co/bert-base-multilingual-uncased/resolve/main/vocab.txt'''
        ),
        '''bert-base-multilingual-cased''': '''https://huggingface.co/bert-base-multilingual-cased/resolve/main/vocab.txt''',
        '''bert-base-chinese''': '''https://huggingface.co/bert-base-chinese/resolve/main/vocab.txt''',
        '''bert-base-german-cased''': '''https://huggingface.co/bert-base-german-cased/resolve/main/vocab.txt''',
        '''bert-large-uncased-whole-word-masking''': (
            '''https://huggingface.co/bert-large-uncased-whole-word-masking/resolve/main/vocab.txt'''
        ),
        '''bert-large-cased-whole-word-masking''': (
            '''https://huggingface.co/bert-large-cased-whole-word-masking/resolve/main/vocab.txt'''
        ),
        '''bert-large-uncased-whole-word-masking-finetuned-squad''': (
            '''https://huggingface.co/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/vocab.txt'''
        ),
        '''bert-large-cased-whole-word-masking-finetuned-squad''': (
            '''https://huggingface.co/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/vocab.txt'''
        ),
        '''bert-base-cased-finetuned-mrpc''': (
            '''https://huggingface.co/bert-base-cased-finetuned-mrpc/resolve/main/vocab.txt'''
        ),
        '''bert-base-german-dbmdz-cased''': '''https://huggingface.co/bert-base-german-dbmdz-cased/resolve/main/vocab.txt''',
        '''bert-base-german-dbmdz-uncased''': (
            '''https://huggingface.co/bert-base-german-dbmdz-uncased/resolve/main/vocab.txt'''
        ),
        '''TurkuNLP/bert-base-finnish-cased-v1''': (
            '''https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/vocab.txt'''
        ),
        '''TurkuNLP/bert-base-finnish-uncased-v1''': (
            '''https://huggingface.co/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/vocab.txt'''
        ),
        '''wietsedv/bert-base-dutch-cased''': (
            '''https://huggingface.co/wietsedv/bert-base-dutch-cased/resolve/main/vocab.txt'''
        ),
    },
    '''tokenizer_file''': {
        '''bert-base-uncased''': '''https://huggingface.co/bert-base-uncased/resolve/main/tokenizer.json''',
        '''bert-large-uncased''': '''https://huggingface.co/bert-large-uncased/resolve/main/tokenizer.json''',
        '''bert-base-cased''': '''https://huggingface.co/bert-base-cased/resolve/main/tokenizer.json''',
        '''bert-large-cased''': '''https://huggingface.co/bert-large-cased/resolve/main/tokenizer.json''',
        '''bert-base-multilingual-uncased''': (
            '''https://huggingface.co/bert-base-multilingual-uncased/resolve/main/tokenizer.json'''
        ),
        '''bert-base-multilingual-cased''': (
            '''https://huggingface.co/bert-base-multilingual-cased/resolve/main/tokenizer.json'''
        ),
        '''bert-base-chinese''': '''https://huggingface.co/bert-base-chinese/resolve/main/tokenizer.json''',
        '''bert-base-german-cased''': '''https://huggingface.co/bert-base-german-cased/resolve/main/tokenizer.json''',
        '''bert-large-uncased-whole-word-masking''': (
            '''https://huggingface.co/bert-large-uncased-whole-word-masking/resolve/main/tokenizer.json'''
        ),
        '''bert-large-cased-whole-word-masking''': (
            '''https://huggingface.co/bert-large-cased-whole-word-masking/resolve/main/tokenizer.json'''
        ),
        '''bert-large-uncased-whole-word-masking-finetuned-squad''': (
            '''https://huggingface.co/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/tokenizer.json'''
        ),
        '''bert-large-cased-whole-word-masking-finetuned-squad''': (
            '''https://huggingface.co/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/tokenizer.json'''
        ),
        '''bert-base-cased-finetuned-mrpc''': (
            '''https://huggingface.co/bert-base-cased-finetuned-mrpc/resolve/main/tokenizer.json'''
        ),
        '''bert-base-german-dbmdz-cased''': (
            '''https://huggingface.co/bert-base-german-dbmdz-cased/resolve/main/tokenizer.json'''
        ),
        '''bert-base-german-dbmdz-uncased''': (
            '''https://huggingface.co/bert-base-german-dbmdz-uncased/resolve/main/tokenizer.json'''
        ),
        '''TurkuNLP/bert-base-finnish-cased-v1''': (
            '''https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/tokenizer.json'''
        ),
        '''TurkuNLP/bert-base-finnish-uncased-v1''': (
            '''https://huggingface.co/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/tokenizer.json'''
        ),
        '''wietsedv/bert-base-dutch-cased''': (
            '''https://huggingface.co/wietsedv/bert-base-dutch-cased/resolve/main/tokenizer.json'''
        ),
    },
}

A				:					List[str]    						=			{
    '''bert-base-uncased''': 512,
    '''bert-large-uncased''': 512,
    '''bert-base-cased''': 512,
    '''bert-large-cased''': 512,
    '''bert-base-multilingual-uncased''': 512,
    '''bert-base-multilingual-cased''': 512,
    '''bert-base-chinese''': 512,
    '''bert-base-german-cased''': 512,
    '''bert-large-uncased-whole-word-masking''': 512,
    '''bert-large-cased-whole-word-masking''': 512,
    '''bert-large-uncased-whole-word-masking-finetuned-squad''': 512,
    '''bert-large-cased-whole-word-masking-finetuned-squad''': 512,
    '''bert-base-cased-finetuned-mrpc''': 512,
    '''bert-base-german-dbmdz-cased''': 512,
    '''bert-base-german-dbmdz-uncased''': 512,
    '''TurkuNLP/bert-base-finnish-cased-v1''': 512,
    '''TurkuNLP/bert-base-finnish-uncased-v1''': 512,
    '''wietsedv/bert-base-dutch-cased''': 512,
}

A				:					List[Any]    						=			{
    '''bert-base-uncased''': {'''do_lower_case''': True},
    '''bert-large-uncased''': {'''do_lower_case''': True},
    '''bert-base-cased''': {'''do_lower_case''': False},
    '''bert-large-cased''': {'''do_lower_case''': False},
    '''bert-base-multilingual-uncased''': {'''do_lower_case''': True},
    '''bert-base-multilingual-cased''': {'''do_lower_case''': False},
    '''bert-base-chinese''': {'''do_lower_case''': False},
    '''bert-base-german-cased''': {'''do_lower_case''': False},
    '''bert-large-uncased-whole-word-masking''': {'''do_lower_case''': True},
    '''bert-large-cased-whole-word-masking''': {'''do_lower_case''': False},
    '''bert-large-uncased-whole-word-masking-finetuned-squad''': {'''do_lower_case''': True},
    '''bert-large-cased-whole-word-masking-finetuned-squad''': {'''do_lower_case''': False},
    '''bert-base-cased-finetuned-mrpc''': {'''do_lower_case''': False},
    '''bert-base-german-dbmdz-cased''': {'''do_lower_case''': False},
    '''bert-base-german-dbmdz-uncased''': {'''do_lower_case''': True},
    '''TurkuNLP/bert-base-finnish-cased-v1''': {'''do_lower_case''': False},
    '''TurkuNLP/bert-base-finnish-uncased-v1''': {'''do_lower_case''': True},
    '''wietsedv/bert-base-dutch-cased''': {'''do_lower_case''': False},
}


class 			__lowerCamelCase			(	a_	):
    """simple docstring"""
    a													=   VOCAB_FILES_NAMES
    a													=   PRETRAINED_VOCAB_FILES_MAP
    a													=   PRETRAINED_INIT_CONFIGURATION
    a													=   PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
    a													=   BertTokenizer


    def __init__(  self      :							List[str]				,							SCREAMING_SNAKE_CASE      :							List[str]=None				,							SCREAMING_SNAKE_CASE      :							List[str]=None				,							SCREAMING_SNAKE_CASE      :							Optional[int]=True				,							SCREAMING_SNAKE_CASE      :							Union[str, Any]="[UNK]"				,							SCREAMING_SNAKE_CASE      :							Union[str, Any]="[SEP]"				,							SCREAMING_SNAKE_CASE      :							Any="[PAD]"				,							SCREAMING_SNAKE_CASE      :							Any="[CLS]"				,							SCREAMING_SNAKE_CASE      :							List[str]="[MASK]"				,							SCREAMING_SNAKE_CASE      :							str=True				,							SCREAMING_SNAKE_CASE      :							str=None				,							**SCREAMING_SNAKE_CASE      :							List[Any]				,							):
           super().__init__(
               SCREAMING_SNAKE_CASE				,							tokenizer_file=SCREAMING_SNAKE_CASE				,							do_lower_case=SCREAMING_SNAKE_CASE				,							unk_token=SCREAMING_SNAKE_CASE				,							sep_token=SCREAMING_SNAKE_CASE				,							pad_token=SCREAMING_SNAKE_CASE				,							cls_token=SCREAMING_SNAKE_CASE				,							mask_token=SCREAMING_SNAKE_CASE				,							tokenize_chinese_chars=SCREAMING_SNAKE_CASE				,							strip_accents=SCREAMING_SNAKE_CASE				,							**SCREAMING_SNAKE_CASE				,							)

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

           _A					:     int     = do_lower_case


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










'''simple docstring'''







from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_torch_available,
    is_vision_available,
)


A				:					str    						=			{
    '''configuration_blip''': [
        '''BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''BlipConfig''',
        '''BlipTextConfig''',
        '''BlipVisionConfig''',
    ],
    '''processing_blip''': ['''BlipProcessor'''],
}

try:
   if not is_vision_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   A				:					Optional[Any]    						=			['''BlipImageProcessor''']


try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   A				:					List[Any]    						=			[
       '''BLIP_PRETRAINED_MODEL_ARCHIVE_LIST''',
       '''BlipModel''',
       '''BlipPreTrainedModel''',
       '''BlipForConditionalGeneration''',
       '''BlipForQuestionAnswering''',
       '''BlipVisionModel''',
       '''BlipTextModel''',
       '''BlipForImageTextRetrieval''',
   ]

try:
   if not is_tf_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   A				:					Union[str, Any]    						=			[
       '''TF_BLIP_PRETRAINED_MODEL_ARCHIVE_LIST''',
       '''TFBlipModel''',
       '''TFBlipPreTrainedModel''',
       '''TFBlipForConditionalGeneration''',
       '''TFBlipForQuestionAnswering''',
       '''TFBlipVisionModel''',
       '''TFBlipTextModel''',
       '''TFBlipForImageTextRetrieval''',
   ]

if TYPE_CHECKING:
   from .configuration_blip import BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP, BlipConfig, BlipTextConfig, BlipVisionConfig
   from .processing_blip import BlipProcessor

   try:
      if not is_vision_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .image_processing_blip import BlipImageProcessor

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_blip import (
          BLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
          BlipForConditionalGeneration,
          BlipForImageTextRetrieval,
          BlipForQuestionAnswering,
          BlipModel,
          BlipPreTrainedModel,
          BlipTextModel,
          BlipVisionModel,
      )

   try:
      if not is_tf_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_tf_blip import (
          TF_BLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
          TFBlipForConditionalGeneration,
          TFBlipForImageTextRetrieval,
          TFBlipForQuestionAnswering,
          TFBlipModel,
          TFBlipPreTrainedModel,
          TFBlipTextModel,
          TFBlipVisionModel,
      )

else:
   import sys

   A				:					Optional[int]    						=			_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)






