





import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_squeezebert import SqueezeBertTokenizer


SCREAMING_SNAKE_CASE__							:      List[Any]         =    logging.get_logger(__name__)

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

SCREAMING_SNAKE_CASE__							:      int         =    {
    """vocab_file""": {
        """squeezebert/squeezebert-uncased""": (
            """https://huggingface.co/squeezebert/squeezebert-uncased/resolve/main/vocab.txt"""
        ),
        """squeezebert/squeezebert-mnli""": """https://huggingface.co/squeezebert/squeezebert-mnli/resolve/main/vocab.txt""",
        """squeezebert/squeezebert-mnli-headless""": (
            """https://huggingface.co/squeezebert/squeezebert-mnli-headless/resolve/main/vocab.txt"""
        ),
    },
    """tokenizer_file""": {
        """squeezebert/squeezebert-uncased""": (
            """https://huggingface.co/squeezebert/squeezebert-uncased/resolve/main/tokenizer.json"""
        ),
        """squeezebert/squeezebert-mnli""": (
            """https://huggingface.co/squeezebert/squeezebert-mnli/resolve/main/tokenizer.json"""
        ),
        """squeezebert/squeezebert-mnli-headless""": (
            """https://huggingface.co/squeezebert/squeezebert-mnli-headless/resolve/main/tokenizer.json"""
        ),
    },
}

SCREAMING_SNAKE_CASE__							:      Optional[Any]         =    {
    """squeezebert/squeezebert-uncased""": 5_1_2,
    """squeezebert/squeezebert-mnli""": 5_1_2,
    """squeezebert/squeezebert-mnli-headless""": 5_1_2,
}


SCREAMING_SNAKE_CASE__							:      Optional[int]         =    {
    """squeezebert/squeezebert-uncased""": {"""do_lower_case""": True},
    """squeezebert/squeezebert-mnli""": {"""do_lower_case""": True},
    """squeezebert/squeezebert-mnli-headless""": {"""do_lower_case""": True},
}







class 	__lowerCAmelCase      (       _UpperCamelCase	):
   _UpperCamelCase			:    List[Any]  		=					VOCAB_FILES_NAMES
   _UpperCamelCase			:    Tuple  		=					PRETRAINED_VOCAB_FILES_MAP
   _UpperCamelCase			:    List[Any]  		=					PRETRAINED_INIT_CONFIGURATION
   _UpperCamelCase			:    List[Any]  		=					PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
   _UpperCamelCase			:    Any  		=					SqueezeBertTokenizer





   def __init__(			self       ,      snake_case=None       ,      snake_case=None       ,      snake_case=True       ,      snake_case="[UNK]"       ,      snake_case="[SEP]"       ,      snake_case="[PAD]"       ,      snake_case="[CLS]"       ,      snake_case="[MASK]"       ,      snake_case=True       ,      snake_case=None       ,      **snake_case       ,      )					->	Dict:
      """simple docstring"""





      super().__init__(
          snake_case       ,      tokenizer_file=snake_case       ,      do_lower_case=snake_case       ,      unk_token=snake_case       ,      sep_token=snake_case       ,      pad_token=snake_case       ,      cls_token=snake_case       ,      mask_token=snake_case       ,      tokenize_chinese_chars=snake_case       ,      strip_accents=snake_case       ,      **snake_case       ,      )

      a__						:    Optional[int]   		=	json.loads(self.backend_tokenizer.normalizer.__getstate__()   )
      if (
          normalizer_state.get("lowercase"       ,      snake_case   ) != do_lower_case
          or normalizer_state.get("strip_accents"       ,      snake_case   ) != strip_accents
          or normalizer_state.get("handle_chinese_chars"       ,      snake_case   ) != tokenize_chinese_chars
      ):
         a__						:    Dict   		=	getattr(snake_case       ,      normalizer_state.pop("type"   )   )
         a__						:    Any   		=	do_lower_case
         a__						:    Tuple   		=	strip_accents
         a__						:    Any   		=	tokenize_chinese_chars
         a__						:    Tuple   		=	normalizer_class(**snake_case   )

      a__						:    Optional[int]   		=	do_lower_case





   def 						_snake_case			(			self       ,      snake_case       ,      snake_case=None   )					->	List[Any]:
      """simple docstring"""





      a__						:    Optional[int]   		=	[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 						_snake_case			(			self       ,      snake_case       ,      snake_case = None   )					->	List[int]:
      """simple docstring"""





      a__						:    List[str]   		=	[self.sep_token_id]
      a__						:    Any   		=	[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 						_snake_case			(			self       ,      snake_case       ,      snake_case = None   )					->	Tuple[str]:
      """simple docstring"""





      a__						:    Union[str, Any]   		=	self._tokenizer.model.save(snake_case       ,      name=snake_case   )
      return tuple(snake_case   )








from ...utils import (
    OptionalDependencyNotAvailable,
    is_torch_available,
    is_transformers_available,
    is_transformers_version,
)


try:
  if not (is_transformers_available() and is_torch_available() and is_transformers_version(""">=""", """4.25.0""")):
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  from ...utils.dummy_torch_and_transformers_objects import (
      VersatileDiffusionDualGuidedPipeline,
      VersatileDiffusionImageVariationPipeline,
      VersatileDiffusionPipeline,
      VersatileDiffusionTextToImagePipeline,
  )
else:
  from .modeling_text_unet import UNetFlatConditionModel
  from .pipeline_versatile_diffusion import VersatileDiffusionPipeline
  from .pipeline_versatile_diffusion_dual_guided import VersatileDiffusionDualGuidedPipeline
  from .pipeline_versatile_diffusion_image_variation import VersatileDiffusionImageVariationPipeline
  from .pipeline_versatile_diffusion_text_to_image import VersatileDiffusionTextToImagePipeline

