





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


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

_A :   int  			=  {'vocab_file': 'vocab.txt', 'tokenizer_file': 'tokenizer.json'}

_A :   Any  			=  {
    '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'
        ),
    },
}

_A :   Dict  			=  {
    'distilbert-base-uncased': 5_12,
    'distilbert-base-uncased-distilled-squad': 5_12,
    'distilbert-base-cased': 5_12,
    'distilbert-base-cased-distilled-squad': 5_12,
    'distilbert-base-german-cased': 5_12,
    'distilbert-base-multilingual-cased': 5_12,
}


_A :   Any  			=  {
    '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      (			__a ):
       _UpperCAmelCase				:  Dict      =   VOCAB_FILES_NAMES
       _UpperCAmelCase				:  Dict      =   PRETRAINED_VOCAB_FILES_MAP
       _UpperCAmelCase				:  Dict      =   PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
       _UpperCAmelCase				:  List[str]      =   PRETRAINED_INIT_CONFIGURATION
       _UpperCAmelCase				:  List[str]      =   ["""input_ids""", """attention_mask"""]
       _UpperCAmelCase				:  int      =   DistilBertTokenizer







       def __init__(				self					:     List[Any]		, A					:     List[str]=None		, A					:     List[Any]=None		, A					:     Any=True		, A					:     Optional[Any]="[UNK]"		, A					:     int="[SEP]"		, A					:     List[Any]="[PAD]"		, A					:     Optional[Any]="[CLS]"		, A					:     int="[MASK]"		, A					:     List[Any]=True		, A					:     Optional[int]=None		, **A					:     List[Any]		, )       ->Dict:
          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__       :						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__       :						Dict        =							getattr(a__		, normalizer_state.pop('''type'''      )      )
             lowerCamelCase__       :						Optional[Any]        =							do_lower_case
             lowerCamelCase__       :						Union[str, Any]        =							strip_accents
             lowerCamelCase__       :						Optional[Any]        =							tokenize_chinese_chars
             lowerCamelCase__       :						List[str]        =							normalizer_class(**a__      )

          lowerCamelCase__       :						List[str]        =							do_lower_case







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










import os
from pathlib import Path



def 	_a						(   )    ->    Tuple:







   """simple docstring"""
   from torch.utils.cpp_extension import load

   lowerCamelCase__       :						List[Any]        =							Path(UpperCAmelCase					).resolve().parent.parent.parent / '''kernels''' / '''deformable_detr'''
   lowerCamelCase__       :						Any        =							[
       root / filename
       for filename in [
           '''vision.cpp''',
           os.path.join('''cpu'''      ,  '''ms_deform_attn_cpu.cpp'''					),
           os.path.join('''cuda'''      ,  '''ms_deform_attn_cuda.cu'''					),
       ]
   ]

   load(
       '''MultiScaleDeformableAttention'''      ,  UpperCAmelCase      ,  with_cuda=UpperCAmelCase      ,  extra_include_paths=[str(UpperCAmelCase					)]      ,  extra_cflags=['''-DWITH_CUDA=1''']      ,  extra_cuda_cflags=[
           '''-DCUDA_HAS_FP16=1''',
           '''-D__CUDA_NO_HALF_OPERATORS__''',
           '''-D__CUDA_NO_HALF_CONVERSIONS__''',
           '''-D__CUDA_NO_HALF2_OPERATORS__''',
       ]      ,  )

   import MultiScaleDeformableAttention as MSDA

   return MSDA



