



"""simple docstring"""







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


A		=						logging.get_logger(__name__)

A		=						{
    'facebook/s2t-wav2vec2-large-en-de': (
        'https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main/config.json'
    ),
    # See all Speech2Text models at https://huggingface.co/models?filter=speech2text2
}

class       _a  ( SCREAMING_SNAKE_CASE__):
			__magic_name__     					=     """speech_to_text_2"""
			__magic_name__     					=     ["""past_key_values"""]
			__magic_name__     					=     {"""num_attention_heads""": """decoder_attention_heads""", """hidden_size""": """d_model"""}



			def __init__(			self							:				Dict   ,	_lowercase							:				List[Any]=10000   ,	_lowercase							:				Optional[Any]=6   ,	_lowercase							:				Union[str, Any]=2048   ,	_lowercase							:				Tuple=4   ,	_lowercase							:				Optional[int]=0.0   ,	_lowercase							:				int=True   ,	_lowercase							:				List[Any]="relu"   ,	_lowercase							:				Optional[int]=256   ,	_lowercase							:				Dict=0.1   ,	_lowercase							:				List[str]=0.0   ,	_lowercase							:				Optional[int]=0.0   ,	_lowercase							:				int=0.02   ,	_lowercase							:				Any=2   ,	_lowercase							:				Optional[int]=True   ,	_lowercase							:				Any=1   ,	_lowercase							:				Optional[Any]=0   ,	_lowercase							:				Union[str, Any]=2   ,	_lowercase							:				Union[str, Any]=1024   ,	**_lowercase							:				Dict   ,	)							->					List[str]:
									snake_case   :			Optional[Any]						    = vocab_size
									snake_case   :			Optional[int]						    = d_model
									snake_case   :			Optional[int]						    = decoder_ffn_dim
									snake_case   :			int						    = decoder_layers
									snake_case   :			Tuple						    = decoder_attention_heads
									snake_case   :			Any						    = dropout
									snake_case   :			int						    = attention_dropout
									snake_case   :			Tuple						    = activation_dropout
									snake_case   :			Dict						    = activation_function
									snake_case   :			Union[str, Any]						    = init_std
									snake_case   :			Optional[Any]						    = decoder_layerdrop
									snake_case   :			Optional[int]						    = use_cache
									snake_case   :			Optional[int]						    = decoder_layers
									snake_case   :			str						    = scale_embedding  # scale factor will be sqrt(d_model) if True
									snake_case   :			Any						    = max_target_positions

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






"""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_funnel import FunnelTokenizer


UpperCAmelCase													=logging.get_logger(__name__)

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

UpperCAmelCase													=[
    "small",
    "small-base",
    "medium",
    "medium-base",
    "intermediate",
    "intermediate-base",
    "large",
    "large-base",
    "xlarge",
    "xlarge-base",
]

UpperCAmelCase													={
    "vocab_file": {
        "funnel-transformer/small": "https://huggingface.co/funnel-transformer/small/resolve/main/vocab.txt",
        "funnel-transformer/small-base": "https://huggingface.co/funnel-transformer/small-base/resolve/main/vocab.txt",
        "funnel-transformer/medium": "https://huggingface.co/funnel-transformer/medium/resolve/main/vocab.txt",
        "funnel-transformer/medium-base": (
            "https://huggingface.co/funnel-transformer/medium-base/resolve/main/vocab.txt"
        ),
        "funnel-transformer/intermediate": (
            "https://huggingface.co/funnel-transformer/intermediate/resolve/main/vocab.txt"
        ),
        "funnel-transformer/intermediate-base": (
            "https://huggingface.co/funnel-transformer/intermediate-base/resolve/main/vocab.txt"
        ),
        "funnel-transformer/large": "https://huggingface.co/funnel-transformer/large/resolve/main/vocab.txt",
        "funnel-transformer/large-base": "https://huggingface.co/funnel-transformer/large-base/resolve/main/vocab.txt",
        "funnel-transformer/xlarge": "https://huggingface.co/funnel-transformer/xlarge/resolve/main/vocab.txt",
        "funnel-transformer/xlarge-base": (
            "https://huggingface.co/funnel-transformer/xlarge-base/resolve/main/vocab.txt"
        ),
    },
    "tokenizer_file": {
        "funnel-transformer/small": "https://huggingface.co/funnel-transformer/small/resolve/main/tokenizer.json",
        "funnel-transformer/small-base": (
            "https://huggingface.co/funnel-transformer/small-base/resolve/main/tokenizer.json"
        ),
        "funnel-transformer/medium": "https://huggingface.co/funnel-transformer/medium/resolve/main/tokenizer.json",
        "funnel-transformer/medium-base": (
            "https://huggingface.co/funnel-transformer/medium-base/resolve/main/tokenizer.json"
        ),
        "funnel-transformer/intermediate": (
            "https://huggingface.co/funnel-transformer/intermediate/resolve/main/tokenizer.json"
        ),
        "funnel-transformer/intermediate-base": (
            "https://huggingface.co/funnel-transformer/intermediate-base/resolve/main/tokenizer.json"
        ),
        "funnel-transformer/large": "https://huggingface.co/funnel-transformer/large/resolve/main/tokenizer.json",
        "funnel-transformer/large-base": (
            "https://huggingface.co/funnel-transformer/large-base/resolve/main/tokenizer.json"
        ),
        "funnel-transformer/xlarge": "https://huggingface.co/funnel-transformer/xlarge/resolve/main/tokenizer.json",
        "funnel-transformer/xlarge-base": (
            "https://huggingface.co/funnel-transformer/xlarge-base/resolve/main/tokenizer.json"
        ),
    },
}
UpperCAmelCase													={f"""funnel-transformer/{name}""": 512 for name in _model_names}
UpperCAmelCase													={f"""funnel-transformer/{name}""": {"do_lower_case": True} for name in _model_names}





class lowerCamelCase__   (				SCREAMING_SNAKE_CASE    ):



    '''simple docstring'''




    _lowerCamelCase					=   VOCAB_FILES_NAMES
    _lowerCamelCase					=   PRETRAINED_VOCAB_FILES_MAP
    _lowerCamelCase					=   PRETRAINED_INIT_CONFIGURATION
    _lowerCamelCase					=   FunnelTokenizer
    _lowerCamelCase					=   PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
    _lowerCamelCase					=   2




    def __init__( self ,lowerCamelCase_=None ,lowerCamelCase_=None ,lowerCamelCase_=True ,lowerCamelCase_="<unk>" ,lowerCamelCase_="<sep>" ,lowerCamelCase_="<pad>" ,lowerCamelCase_="<cls>" ,lowerCamelCase_="<mask>" ,lowerCamelCase_="<s>" ,lowerCamelCase_="</s>" ,lowerCamelCase_=True ,lowerCamelCase_=True ,lowerCamelCase_=None ,lowerCamelCase_="##" ,**lowerCamelCase_ ,)    ->      List[Any]:
          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_ ,bos_token=lowerCamelCase_ ,eos_token=lowerCamelCase_ ,clean_text=lowerCamelCase_ ,tokenize_chinese_chars=lowerCamelCase_ ,strip_accents=lowerCamelCase_ ,wordpieces_prefix=lowerCamelCase_ ,**lowerCamelCase_ ,)

          A				  =		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
          ):
                A				  =		getattr(lowerCamelCase_ ,normalizer_state.pop("""type"""    )    )
                A				  =		do_lower_case
                A				  =		strip_accents
                A				  =		tokenize_chinese_chars
                A				  =		normalizer_class(**lowerCamelCase_    )

          A				  =		do_lower_case




    def UpperCamelCase__		( self ,lowerCamelCase_ ,lowerCamelCase_=None    )    ->      List[Any]:
          A				  =		[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 ,lowerCamelCase_ ,lowerCamelCase_ = None    )    ->      List[int]:
          A				  =		[self.sep_token_id]
          A				  =		[self.cls_token_id]
          if token_ids_a is None:
                return len(cls    ) * [self.cls_token_type_id] + len(token_ids_a + sep    ) * [0]
          return len(cls    ) * [self.cls_token_type_id] + len(token_ids_a + sep    ) * [0] + len(token_ids_a + sep    ) * [1]




    def UpperCamelCase__		( self ,lowerCamelCase_ ,lowerCamelCase_ = None    )    ->      Tuple[str]:
          A				  =		self._tokenizer.model.save(lowerCamelCase_ ,name=lowerCamelCase_    )
          return tuple(lowerCamelCase_    )




