
import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_mobilebert import MobileBertTokenizer


__lowerCamelCase							=       logging.get_logger(__name__)

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

__lowerCamelCase							=       {
    """vocab_file""": {"""mobilebert-uncased""": """https://huggingface.co/google/mobilebert-uncased/resolve/main/vocab.txt"""},
    """tokenizer_file""": {
        """mobilebert-uncased""": """https://huggingface.co/google/mobilebert-uncased/resolve/main/tokenizer.json"""
    },
}

__lowerCamelCase							=       {"""mobilebert-uncased""": 5_12}


__lowerCamelCase							=       {}






class   UpperCAmelCase		(						A_ ):
   A__					:		Union[str, Any]						     =     VOCAB_FILES_NAMES
   A__					:		Dict						     =     PRETRAINED_VOCAB_FILES_MAP
   A__					:		Any						     =     PRETRAINED_INIT_CONFIGURATION
   A__					:		int						     =     PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
   A__					:		Optional[Any]						     =     MobileBertTokenizer



   def __init__(self		:					str    ,						snake_case__		:					List[str]=None    ,						snake_case__		:					int=None    ,						snake_case__		:					List[str]=True    ,						snake_case__		:					str="[UNK]"    ,						snake_case__		:					int="[SEP]"    ,						snake_case__		:					Optional[Any]="[PAD]"    ,						snake_case__		:					Any="[CLS]"    ,						snake_case__		:					Tuple="[MASK]"    ,						snake_case__		:					Tuple=True    ,						snake_case__		:					str=None    ,						**snake_case__		:					Optional[Any]    ,						)		->	Optional[int]:


          '''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__    ,						)

          snake_case       :   Dict							=      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
          ):
                 snake_case       :   Tuple							=      getattr(snake_case__    ,						normalizer_state.pop("type" ) )
                 snake_case       :   Optional[Any]							=      do_lower_case
                 snake_case       :   Dict							=      strip_accents
                 snake_case       :   Union[str, Any]							=      tokenize_chinese_chars
                 snake_case       :   Tuple							=      normalizer_class(**snake_case__ )

          snake_case       :   Optional[Any]							=      do_lower_case



   def 				_SCREAMING_SNAKE_CASE   (self		:					Dict    ,						snake_case__		:					Union[str, Any]    ,						snake_case__		:					List[str]=None )		->	Union[str, Any]:


          '''simple docstring'''


          snake_case       :   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 				_SCREAMING_SNAKE_CASE   (self		:					Union[str, Any]    ,						snake_case__		:					List[int]    ,						snake_case__		:					Optional[List[int]] = None )		->	List[int]:


          '''simple docstring'''


          snake_case       :   Dict							=      [self.sep_token_id]
          snake_case       :   Dict							=      [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		:					List[str]    ,						snake_case__		:					str    ,						snake_case__		:					Optional[str] = None )		->	Tuple[str]:


          '''simple docstring'''


          snake_case       :   List[Any]							=      self._tokenizer.model.save(snake_case__    ,						name=snake_case__ )
          return tuple(snake_case__ )









'''simple docstring'''
from ...utils import (
    OptionalDependencyNotAvailable,
    is_flax_available,
    is_torch_available,
    is_transformers_available,
)


try:
		if not (is_transformers_available() and is_torch_available()):
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		from ...utils.dummy_torch_and_transformers_objects import *  # noqa F403
else:
		from .multicontrolnet import MultiControlNetModel
		from .pipeline_controlnet import StableDiffusionControlNetPipeline
		from .pipeline_controlnet_imgaimg import StableDiffusionControlNetImgaImgPipeline
		from .pipeline_controlnet_inpaint import StableDiffusionControlNetInpaintPipeline


if is_transformers_available() and is_flax_available():
		from .pipeline_flax_controlnet import FlaxStableDiffusionControlNetPipeline