

"""simple docstring"""




import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_electra import ElectraTokenizer


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

__UpperCAmelCase			=					{
    'vocab_file': {
        'google/electra-small-generator': (
            'https://huggingface.co/google/electra-small-generator/resolve/main/vocab.txt'
        ),
        'google/electra-base-generator': 'https://huggingface.co/google/electra-base-generator/resolve/main/vocab.txt',
        'google/electra-large-generator': (
            'https://huggingface.co/google/electra-large-generator/resolve/main/vocab.txt'
        ),
        'google/electra-small-discriminator': (
            'https://huggingface.co/google/electra-small-discriminator/resolve/main/vocab.txt'
        ),
        'google/electra-base-discriminator': (
            'https://huggingface.co/google/electra-base-discriminator/resolve/main/vocab.txt'
        ),
        'google/electra-large-discriminator': (
            'https://huggingface.co/google/electra-large-discriminator/resolve/main/vocab.txt'
        ),
    },
    'tokenizer_file': {
        'google/electra-small-generator': (
            'https://huggingface.co/google/electra-small-generator/resolve/main/tokenizer.json'
        ),
        'google/electra-base-generator': (
            'https://huggingface.co/google/electra-base-generator/resolve/main/tokenizer.json'
        ),
        'google/electra-large-generator': (
            'https://huggingface.co/google/electra-large-generator/resolve/main/tokenizer.json'
        ),
        'google/electra-small-discriminator': (
            'https://huggingface.co/google/electra-small-discriminator/resolve/main/tokenizer.json'
        ),
        'google/electra-base-discriminator': (
            'https://huggingface.co/google/electra-base-discriminator/resolve/main/tokenizer.json'
        ),
        'google/electra-large-discriminator': (
            'https://huggingface.co/google/electra-large-discriminator/resolve/main/tokenizer.json'
        ),
    },
}

__UpperCAmelCase			=					{
    'google/electra-small-generator': 512,
    'google/electra-base-generator': 512,
    'google/electra-large-generator': 512,
    'google/electra-small-discriminator': 512,
    'google/electra-base-discriminator': 512,
    'google/electra-large-discriminator': 512,
}

__UpperCAmelCase			=					{
    'google/electra-small-generator': {'do_lower_case': True},
    'google/electra-base-generator': {'do_lower_case': True},
    'google/electra-large-generator': {'do_lower_case': True},
    'google/electra-small-discriminator': {'do_lower_case': True},
    'google/electra-base-discriminator': {'do_lower_case': True},
    'google/electra-large-discriminator': {'do_lower_case': True},
}







class   __lowercase      (     __lowerCamelCase       ):
  snake_case_												=							VOCAB_FILES_NAMES
  snake_case_												=							PRETRAINED_VOCAB_FILES_MAP
  snake_case_												=							PRETRAINED_INIT_CONFIGURATION
  snake_case_												=							PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
  snake_case_												=							ElectraTokenizer

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






   '''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__       :	Optional[int]        =       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__       :	Any        =       getattr(A       ,normalizer_state.pop("""type"""     )     )
    UpperCAmelCase__       :	int        =       do_lower_case
    UpperCAmelCase__       :	List[Any]        =       strip_accents
    UpperCAmelCase__       :	Any        =       tokenize_chinese_chars
    UpperCAmelCase__       :	Tuple        =       normalizer_class(**A     )

   UpperCAmelCase__       :	Union[str, Any]        =       do_lower_case

  def  __lowercase							(	self		:      List[Any]       ,A		:      Dict       ,A		:      str=None     ):






   '''simple docstring'''
   UpperCAmelCase__       :	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  __lowercase							(	self		:      Dict       ,A		:      List[int]       ,A		:      Optional[List[int]] = None     ):






   '''simple docstring'''
   UpperCAmelCase__       :	Union[str, Any]        =       [self.sep_token_id]
   UpperCAmelCase__       :	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  __lowercase							(	self		:      int       ,A		:      str       ,A		:      Optional[str] = None     ):






   '''simple docstring'''
   UpperCAmelCase__       :	Optional[int]        =       self._tokenizer.model.save(A       ,name=A     )
   return tuple(A     )









'''simple docstring'''



# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
#
# 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.

# this script dumps information about the environment

import os
import platform
import sys


A__						:   List[str]				=    """3"""

print("""Python version:""", sys.version)

print("""OS platform:""", platform.platform())
print("""OS architecture:""", platform.machine())

try:
      import torch

      print("""Torch version:""", torch.__version__)
      print("""Cuda available:""", torch.cuda.is_available())
      print("""Cuda version:""", torch.version.cuda)
      print("""CuDNN version:""", torch.backends.cudnn.version())
      print("""Number of GPUs available:""", torch.cuda.device_count())
except ImportError:
      print("""Torch version:""", None)

try:
      import transformers

      print("""transformers version:""", transformers.__version__)
except ImportError:
      print("""transformers version:""", None)






