
'''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_mobilebert import MobileBertTokenizer


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

lowerCAmelCase					:    str           = {'vocab_file': 'vocab.txt', 'tokenizer_file': 'tokenizer.json'}

lowerCAmelCase					:    Optional[int]           = {
    '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					:    str           = {'mobilebert-uncased': 5_12}


lowerCAmelCase					:    Optional[int]           = {}


class 			SCREAMING_SNAKE_CASE__      (     UpperCAmelCase__):
				lowerCAmelCase_     			=							VOCAB_FILES_NAMES
				lowerCAmelCase_     			=							PRETRAINED_VOCAB_FILES_MAP
				lowerCAmelCase_     			=							PRETRAINED_INIT_CONFIGURATION
				lowerCAmelCase_     			=							PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
				lowerCAmelCase_     			=							MobileBertTokenizer







				def __init__(       self						,				A_=None						,				A_=None						,				A_=True						,				A_="[UNK]"						,				A_="[SEP]"						,				A_="[PAD]"						,				A_="[CLS]"						,				A_="[MASK]"						,				A_=True						,				A_=None						,				**A_						,				)->		List[str]:







											'''simple docstring'''






											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   			=     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   			=     getattr(A_						,				normalizer_state.pop('type'     )     )
																		UpperCamelCase   			=     do_lower_case
																		UpperCamelCase   			=     strip_accents
																		UpperCamelCase   			=     tokenize_chinese_chars
																		UpperCamelCase   			=     normalizer_class(**A_     )

											UpperCamelCase   			=     do_lower_case







				def 						UpperCAmelCase_    (       self						,				A_						,				A_=None     )->		Any:







											'''simple docstring'''






											UpperCamelCase   			=     [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 						UpperCAmelCase_    (       self						,				A_						,				A_ = None     )->		List[Any]:







											'''simple docstring'''






											UpperCamelCase   			=     [self.sep_token_id]
											UpperCamelCase   			=     [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 						UpperCAmelCase_    (       self						,				A_						,				A_ = None     )->		List[str]:







											'''simple docstring'''






											UpperCamelCase   			=     self._tokenizer.model.save(A_						,				name=A_     )
											return tuple(A_     )





'''simple docstring'''




# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


__UpperCAmelCase					={
    "configuration_efficientnet": [
        "EFFICIENTNET_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "EfficientNetConfig",
        "EfficientNetOnnxConfig",
    ]
}

try:
  if not is_vision_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __UpperCAmelCase					=["EfficientNetImageProcessor"]

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __UpperCAmelCase					=[
      "EFFICIENTNET_PRETRAINED_MODEL_ARCHIVE_LIST",
      "EfficientNetForImageClassification",
      "EfficientNetModel",
      "EfficientNetPreTrainedModel",
  ]

if TYPE_CHECKING:
  from .configuration_efficientnet import (
      EFFICIENTNET_PRETRAINED_CONFIG_ARCHIVE_MAP,
      EfficientNetConfig,
      EfficientNetOnnxConfig,
  )

  try:
    if not is_vision_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .image_processing_efficientnet import EfficientNetImageProcessor

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_efficientnet import (
        EFFICIENTNET_PRETRAINED_MODEL_ARCHIVE_LIST,
        EfficientNetForImageClassification,
        EfficientNetModel,
        EfficientNetPreTrainedModel,
    )

else:
  import sys

  __UpperCAmelCase					=_LazyModule(__name__, globals()["__file__"], _import_structure)
