






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


lowerCamelCase	:							Union[str, Any]				=logging.get_logger(__name__)

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

lowerCamelCase	:							Tuple				={
    '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'
        ),
    },
}

lowerCamelCase	:							int				={
    'squeezebert/squeezebert-uncased': 512,
    'squeezebert/squeezebert-mnli': 512,
    'squeezebert/squeezebert-mnli-headless': 512,
}


lowerCamelCase	:							str				={
    'squeezebert/squeezebert-uncased': {'do_lower_case': True},
    'squeezebert/squeezebert-mnli': {'do_lower_case': True},
    'squeezebert/squeezebert-mnli-headless': {'do_lower_case': True},
}





class 			__a  (    _SCREAMING_SNAKE_CASE       ):
 _lowerCAmelCase       :       List[str]        = VOCAB_FILES_NAMES
 _lowerCAmelCase       :       Optional[Any]        = PRETRAINED_VOCAB_FILES_MAP
 _lowerCAmelCase       :       Union[str, Any]        = PRETRAINED_INIT_CONFIGURATION
 _lowerCAmelCase       :       str        = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
 _lowerCAmelCase       :       Union[str, Any]        = SqueezeBertTokenizer







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


      '''simple docstring'''






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

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

      UpperCamelCase__			:   List[str]       				=  do_lower_case







 def 					__lowercase					(		self					:   Tuple							,   SCREAMING_SNAKE_CASE					:   str							,   SCREAMING_SNAKE_CASE					:   Optional[int]=None						):


      '''simple docstring'''






      UpperCamelCase__			:   Optional[Any]       				=  [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					:   Optional[int]							,   SCREAMING_SNAKE_CASE					:   List[int]							,   SCREAMING_SNAKE_CASE					:   Optional[List[int]] = None						):


      '''simple docstring'''






      UpperCamelCase__			:   Any       				=  [self.sep_token_id]
      UpperCamelCase__			:   Optional[int]       				=  [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					:   Tuple							,   SCREAMING_SNAKE_CASE					:   str							,   SCREAMING_SNAKE_CASE					:   Optional[str] = None						):


      '''simple docstring'''






      UpperCamelCase__			:   Dict       				=  self._tokenizer.model.save(_lowerCAmelCase							,   name=_lowerCAmelCase						)
      return tuple(_lowerCAmelCase						)





from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCamelCase__ :   List[str]					=							logging.get_logger(__name__)

lowerCamelCase__ :   List[str]					=							{
    'facebook/s2t-small-librispeech-asr': (
        'https://huggingface.co/facebook/s2t-small-librispeech-asr/resolve/main/config.json'
    ),
    # See all Speech2Text models at https://huggingface.co/models?filter=speech_to_text
}





class        lowerCamelCase_							(      _SCREAMING_SNAKE_CASE					):


 '''simple docstring'''







 lowercase_				    =    "speech_to_text"
 lowercase_				    =    ["past_key_values"]
 lowercase_				    =    {"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}



 def __init__(							self  :		Tuple				,				_lowerCAmelCase  :		List[Any]=10_000				,				_lowerCAmelCase  :		List[Any]=12				,				_lowerCAmelCase  :		Union[str, Any]=2_048				,				_lowerCAmelCase  :		Optional[int]=4				,				_lowerCAmelCase  :		Union[str, Any]=6				,				_lowerCAmelCase  :		Optional[int]=2_048				,				_lowerCAmelCase  :		Optional[Any]=4				,				_lowerCAmelCase  :		Any=0.0				,				_lowerCAmelCase  :		Optional[Any]=0.0				,				_lowerCAmelCase  :		List[str]=True				,				_lowerCAmelCase  :		List[Any]=True				,				_lowerCAmelCase  :		int="relu"				,				_lowerCAmelCase  :		Union[str, Any]=256				,				_lowerCAmelCase  :		List[str]=0.1				,				_lowerCAmelCase  :		str=0.0				,				_lowerCAmelCase  :		Tuple=0.0				,				_lowerCAmelCase  :		List[str]=0.02				,				_lowerCAmelCase  :		List[str]=2				,				_lowerCAmelCase  :		Tuple=True				,				_lowerCAmelCase  :		List[str]=1				,				_lowerCAmelCase  :		str=0				,				_lowerCAmelCase  :		str=2				,				_lowerCAmelCase  :		Union[str, Any]=6_000				,				_lowerCAmelCase  :		List[str]=1_024				,				_lowerCAmelCase  :		str=2				,				_lowerCAmelCase  :		Optional[Any]=(5, 5)				,				_lowerCAmelCase  :		str=1_024				,				_lowerCAmelCase  :		str=80				,				_lowerCAmelCase  :		Tuple=1				,				**_lowerCAmelCase  :		Any				,				):
       SCREAMING_SNAKE_CASE_							=			vocab_size
       SCREAMING_SNAKE_CASE_							=			d_model
       SCREAMING_SNAKE_CASE_							=			encoder_ffn_dim
       SCREAMING_SNAKE_CASE_							=			encoder_layers
       SCREAMING_SNAKE_CASE_							=			encoder_attention_heads
       SCREAMING_SNAKE_CASE_							=			decoder_ffn_dim
       SCREAMING_SNAKE_CASE_							=			decoder_layers
       SCREAMING_SNAKE_CASE_							=			decoder_attention_heads
       SCREAMING_SNAKE_CASE_							=			dropout
       SCREAMING_SNAKE_CASE_							=			attention_dropout
       SCREAMING_SNAKE_CASE_							=			activation_dropout
       SCREAMING_SNAKE_CASE_							=			activation_function
       SCREAMING_SNAKE_CASE_							=			init_std
       SCREAMING_SNAKE_CASE_							=			encoder_layerdrop
       SCREAMING_SNAKE_CASE_							=			decoder_layerdrop
       SCREAMING_SNAKE_CASE_							=			use_cache
       SCREAMING_SNAKE_CASE_							=			encoder_layers
       SCREAMING_SNAKE_CASE_							=			scale_embedding  # scale factor will be sqrt(d_model) if True
       SCREAMING_SNAKE_CASE_							=			max_source_positions
       SCREAMING_SNAKE_CASE_							=			max_target_positions
       SCREAMING_SNAKE_CASE_							=			num_conv_layers
       SCREAMING_SNAKE_CASE_							=			list(_lowerCAmelCase						)
       SCREAMING_SNAKE_CASE_							=			conv_channels
       SCREAMING_SNAKE_CASE_							=			input_feat_per_channel
       SCREAMING_SNAKE_CASE_							=			input_channels

       if len(self.conv_kernel_sizes						) != self.num_conv_layers:
             raise ValueError(
                 'Configuration for convolutional module is incorrect. '
                 'It is required that `len(config.conv_kernel_sizes)` == `config.num_conv_layers` '
                 F"but is `len(config.conv_kernel_sizes) = {len(self.conv_kernel_sizes						)}`, "
                 F"`config.num_conv_layers = {self.num_conv_layers}`."						)

       super().__init__(
           pad_token_id=_lowerCAmelCase				,				bos_token_id=_lowerCAmelCase				,				eos_token_id=_lowerCAmelCase				,				is_encoder_decoder=_lowerCAmelCase				,				decoder_start_token_id=_lowerCAmelCase				,				**_lowerCAmelCase				,				)