
"""simple docstring"""





from typing import List, Optional, Tuple

from tokenizers import pre_tokenizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_clip import CLIPTokenizer


_a									=				logging.get_logger(__name__)

_a									=				{'vocab_file': 'vocab.json', 'merges_file': 'merges.txt', 'tokenizer_file': 'tokenizer.json'}

_a									=				{
    'vocab_file': {
        'openai/clip-vit-base-patch32': 'https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/vocab.json',
    },
    'merges_file': {
        'openai/clip-vit-base-patch32': 'https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/merges.txt',
    },
    'tokenizer_file': {
        'openai/clip-vit-base-patch32': (
            'https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/tokenizer.json'
        ),
    },
}

_a									=				{
    'openai/clip-vit-base-patch32': 77,
}


class A_      (lowercase__ ):




  '''simple docstring'''
  SCREAMING_SNAKE_CASE__     :		Union[str, Any]    	=						VOCAB_FILES_NAMES
  SCREAMING_SNAKE_CASE__     :		int    	=						PRETRAINED_VOCAB_FILES_MAP
  SCREAMING_SNAKE_CASE__     :		int    	=						PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
  SCREAMING_SNAKE_CASE__     :		Any    	=						["""input_ids""", """attention_mask"""]
  SCREAMING_SNAKE_CASE__     :		Union[str, Any]    	=						CLIPTokenizer







  def __init__(						self							,  lowercase_=None							,  lowercase_=None							,  lowercase_=None							,  lowercase_="<|endoftext|>"							,  lowercase_="<|startoftext|>"							,  lowercase_="<|endoftext|>"							,  lowercase_="<|endoftext|>"							,  **lowercase_							,  ):

     """simple docstring"""
     super().__init__(
         lowercase_							,  lowercase_							,  tokenizer_file=lowercase_							,  unk_token=lowercase_							,  bos_token=lowercase_							,  eos_token=lowercase_							,  pad_token=lowercase_							,  **lowercase_							,  )

     if not isinstance(self.backend_tokenizer.pre_tokenizer							,  pre_tokenizers.Sequence    ):
        raise ValueError(
            "The `backend_tokenizer` provided does not match the expected format. The CLIP tokenizer has been"
            " heavily modified from transformers version 4.17.0. You need to convert the tokenizer you are using"
            " to be compatible with this version.The easiest way to do so is"
            " `CLIPTokenizerFast.from_pretrained(\"path_to_local_folder_or_hub_repo, from_slow=True)`. If you want"
            " to use your existing tokenizer, you will have to revert to a version prior to 4.17.0 of"
            " transformers."    )

     self._wrap_decode_method_backend_tokenizer()







  def 			UpperCamelCase__   (						self    ):

     """simple docstring"""
     UpperCAmelCase_   :   int     	=       self.backend_tokenizer.decode

     def new_decode_method(*lowercase_							,  **lowercase_    ):
        UpperCAmelCase_   :   Any     	=       orig_decode_method(*lowercase_							,  **lowercase_    )
        UpperCAmelCase_   :   Optional[Any]     	=       text.replace(self.backend_tokenizer.model.end_of_word_suffix							,  " "    ).strip()
        return text

     UpperCAmelCase_   :   List[str]     	=       new_decode_method







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

     """simple docstring"""
     UpperCAmelCase_   :   List[str]     	=       [self.bos_token_id]
     UpperCAmelCase_   :   Optional[int]     	=       [self.eos_token_id]

     if token_ids_a is None:
        return bos_token + token_ids_a + eos_token
     return bos_token + token_ids_a + eos_token + eos_token + token_ids_a + eos_token







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

     """simple docstring"""
     UpperCAmelCase_   :   Union[str, Any]     	=       [self.bos_token_id]
     UpperCAmelCase_   :   Union[str, Any]     	=       [self.eos_token_id]

     if token_ids_a is None:
        return len(bos_token + token_ids_a + eos_token    ) * [0]
     return len(bos_token + token_ids_a + eos_token + eos_token + token_ids_a + eos_token    ) * [0]







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

     """simple docstring"""
     UpperCAmelCase_   :   Any     	=       self._tokenizer.model.save(lowercase_							,  name=lowercase_    )
     return tuple(lowercase_    )




"""simple docstring"""





from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


_a									=				logging.get_logger(__name__)

_a									=				{
    'squeezebert/squeezebert-uncased': (
        'https://huggingface.co/squeezebert/squeezebert-uncased/resolve/main/config.json'
    ),
    'squeezebert/squeezebert-mnli': 'https://huggingface.co/squeezebert/squeezebert-mnli/resolve/main/config.json',
    'squeezebert/squeezebert-mnli-headless': (
        'https://huggingface.co/squeezebert/squeezebert-mnli-headless/resolve/main/config.json'
    ),
}


class A_      (lowercase__ ):




  '''simple docstring'''
  SCREAMING_SNAKE_CASE__     :		Any    	=						SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP
  SCREAMING_SNAKE_CASE__     :		Optional[Any]    	=						"""squeezebert"""







  def __init__(						self							,  lowercase_=3_0522							,  lowercase_=768							,  lowercase_=12							,  lowercase_=12							,  lowercase_=3072							,  lowercase_="gelu"							,  lowercase_=0.1							,  lowercase_=0.1							,  lowercase_=512							,  lowercase_=2							,  lowercase_=0.02							,  lowercase_=1E-1_2							,  lowercase_=0							,  lowercase_=768							,  lowercase_=4							,  lowercase_=4							,  lowercase_=4							,  lowercase_=1							,  lowercase_=4							,  lowercase_=4							,  **lowercase_							,  ):

     """simple docstring"""
     super().__init__(pad_token_id=lowercase_							,  **lowercase_    )

     UpperCAmelCase_   :   List[Any]     	=       vocab_size
     UpperCAmelCase_   :   Optional[Any]     	=       hidden_size
     UpperCAmelCase_   :   Tuple     	=       num_hidden_layers
     UpperCAmelCase_   :   Optional[int]     	=       num_attention_heads
     UpperCAmelCase_   :   Optional[Any]     	=       hidden_act
     UpperCAmelCase_   :   Tuple     	=       intermediate_size
     UpperCAmelCase_   :   Union[str, Any]     	=       hidden_dropout_prob
     UpperCAmelCase_   :   List[Any]     	=       attention_probs_dropout_prob
     UpperCAmelCase_   :   int     	=       max_position_embeddings
     UpperCAmelCase_   :   List[str]     	=       type_vocab_size
     UpperCAmelCase_   :   Optional[Any]     	=       initializer_range
     UpperCAmelCase_   :   Optional[int]     	=       layer_norm_eps
     UpperCAmelCase_   :   Tuple     	=       embedding_size
     UpperCAmelCase_   :   Dict     	=       q_groups
     UpperCAmelCase_   :   List[Any]     	=       k_groups
     UpperCAmelCase_   :   List[str]     	=       v_groups
     UpperCAmelCase_   :   Optional[Any]     	=       post_attention_groups
     UpperCAmelCase_   :   List[str]     	=       intermediate_groups
     UpperCAmelCase_   :   List[Any]     	=       output_groups




class A_      (lowercase__ ):




  '''simple docstring'''







  @property
  def 			UpperCamelCase__   (						self    ):

     """simple docstring"""
     if self.task == "multiple-choice":
        UpperCAmelCase_   :   List[str]     	=       {0: "batch", 1: "choice", 2: "sequence"}
     else:
        UpperCAmelCase_   :   Optional[int]     	=       {0: "batch", 1: "sequence"}
     return OrderedDict(
         [
             ("input_ids", dynamic_axis),
             ("attention_mask", dynamic_axis),
             ("token_type_ids", dynamic_axis),
         ]    )


