





"""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_distilbert import DistilBertTokenizer


lowerCamelCase__				  =   logging.get_logger(__name__)

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

lowerCamelCase__				  =   {
    "vocab_file": {
        "distilbert-base-uncased": "https://huggingface.co/distilbert-base-uncased/resolve/main/vocab.txt",
        "distilbert-base-uncased-distilled-squad": (
            "https://huggingface.co/distilbert-base-uncased-distilled-squad/resolve/main/vocab.txt"
        ),
        "distilbert-base-cased": "https://huggingface.co/distilbert-base-cased/resolve/main/vocab.txt",
        "distilbert-base-cased-distilled-squad": (
            "https://huggingface.co/distilbert-base-cased-distilled-squad/resolve/main/vocab.txt"
        ),
        "distilbert-base-german-cased": "https://huggingface.co/distilbert-base-german-cased/resolve/main/vocab.txt",
        "distilbert-base-multilingual-cased": (
            "https://huggingface.co/distilbert-base-multilingual-cased/resolve/main/vocab.txt"
        ),
    },
    "tokenizer_file": {
        "distilbert-base-uncased": "https://huggingface.co/distilbert-base-uncased/resolve/main/tokenizer.json",
        "distilbert-base-uncased-distilled-squad": (
            "https://huggingface.co/distilbert-base-uncased-distilled-squad/resolve/main/tokenizer.json"
        ),
        "distilbert-base-cased": "https://huggingface.co/distilbert-base-cased/resolve/main/tokenizer.json",
        "distilbert-base-cased-distilled-squad": (
            "https://huggingface.co/distilbert-base-cased-distilled-squad/resolve/main/tokenizer.json"
        ),
        "distilbert-base-german-cased": (
            "https://huggingface.co/distilbert-base-german-cased/resolve/main/tokenizer.json"
        ),
        "distilbert-base-multilingual-cased": (
            "https://huggingface.co/distilbert-base-multilingual-cased/resolve/main/tokenizer.json"
        ),
    },
}

lowerCamelCase__				  =   {
    "distilbert-base-uncased": 512,
    "distilbert-base-uncased-distilled-squad": 512,
    "distilbert-base-cased": 512,
    "distilbert-base-cased-distilled-squad": 512,
    "distilbert-base-german-cased": 512,
    "distilbert-base-multilingual-cased": 512,
}


lowerCamelCase__				  =   {
    "distilbert-base-uncased": {"do_lower_case": True},
    "distilbert-base-uncased-distilled-squad": {"do_lower_case": True},
    "distilbert-base-cased": {"do_lower_case": False},
    "distilbert-base-cased-distilled-squad": {"do_lower_case": False},
    "distilbert-base-german-cased": {"do_lower_case": False},
    "distilbert-base-multilingual-cased": {"do_lower_case": False},
}



class      __SCREAMING_SNAKE_CASE    (						_snake_case   ):







  '''simple docstring'''


  SCREAMING_SNAKE_CASE__							:int	     =					VOCAB_FILES_NAMES
  SCREAMING_SNAKE_CASE__							:Union[str, Any]	     =					PRETRAINED_VOCAB_FILES_MAP
  SCREAMING_SNAKE_CASE__							:Optional[int]	     =					PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
  SCREAMING_SNAKE_CASE__							:List[Any]	     =					PRETRAINED_INIT_CONFIGURATION
  SCREAMING_SNAKE_CASE__							:str	     =					['input_ids', 'attention_mask']
  SCREAMING_SNAKE_CASE__							:str	     =					DistilBertTokenizer

  def __init__(		self   :       Union[str, Any]					,   __a   :       Optional[int]=None					,   __a   :       List[str]=None					,   __a   :       int=True					,   __a   :       Any="[UNK]"					,   __a   :       Tuple="[SEP]"					,   __a   :       Dict="[PAD]"					,   __a   :       Optional[Any]="[CLS]"					,   __a   :       int="[MASK]"					,   __a   :       Union[str, Any]=True					,   __a   :       Tuple=None					,   **__a   :       Any					,   )		->				Tuple:
        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					,   )

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

        _UpperCamelCase      :	Union[str, Any]						=       do_lower_case

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












"""simple docstring"""


from typing import TYPE_CHECKING

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


lowerCamelCase__				  =   {
    "configuration_owlvit": [
        "OWLVIT_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "OwlViTConfig",
        "OwlViTOnnxConfig",
        "OwlViTTextConfig",
        "OwlViTVisionConfig",
    ],
    "processing_owlvit": ["OwlViTProcessor"],
}


try:
  if not is_vision_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowerCamelCase__				  =   ["OwlViTFeatureExtractor"]
  lowerCamelCase__				  =   ["OwlViTImageProcessor"]

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowerCamelCase__				  =   [
      "OWLVIT_PRETRAINED_MODEL_ARCHIVE_LIST",
      "OwlViTModel",
      "OwlViTPreTrainedModel",
      "OwlViTTextModel",
      "OwlViTVisionModel",
      "OwlViTForObjectDetection",
  ]

if TYPE_CHECKING:
  from .configuration_owlvit import (
      OWLVIT_PRETRAINED_CONFIG_ARCHIVE_MAP,
      OwlViTConfig,
      OwlViTOnnxConfig,
      OwlViTTextConfig,
      OwlViTVisionConfig,
  )
  from .processing_owlvit import OwlViTProcessor

  try:
    if not is_vision_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .feature_extraction_owlvit import OwlViTFeatureExtractor
    from .image_processing_owlvit import OwlViTImageProcessor

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_owlvit import (
        OWLVIT_PRETRAINED_MODEL_ARCHIVE_LIST,
        OwlViTForObjectDetection,
        OwlViTModel,
        OwlViTPreTrainedModel,
        OwlViTTextModel,
        OwlViTVisionModel,
    )

else:
  import sys

  lowerCamelCase__				  =   _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
