





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


__lowercase	: str       =logging.get_logger(__name__)

__lowercase	: List[Any]       ={
    """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   A							(						a__    ):
      _snake_case				  ="""speech_to_text"""
      _snake_case				  =["""past_key_values"""]
      _snake_case				  ={"""num_attention_heads""": """encoder_attention_heads""", """hidden_size""": """d_model"""}



      def __init__(						self:    Tuple		,	_lowerCAmelCase:    Optional[int]=1_0000		,	_lowerCAmelCase:    Dict=12		,	_lowerCAmelCase:    List[Any]=2048		,	_lowerCAmelCase:    List[Any]=4		,	_lowerCAmelCase:    Optional[Any]=6		,	_lowerCAmelCase:    str=2048		,	_lowerCAmelCase:    Optional[int]=4		,	_lowerCAmelCase:    List[str]=0.0		,	_lowerCAmelCase:    Optional[int]=0.0		,	_lowerCAmelCase:    Any=True		,	_lowerCAmelCase:    str=True		,	_lowerCAmelCase:    List[Any]="relu"		,	_lowerCAmelCase:    Optional[Any]=256		,	_lowerCAmelCase:    Optional[int]=0.1		,	_lowerCAmelCase:    Tuple=0.0		,	_lowerCAmelCase:    Optional[int]=0.0		,	_lowerCAmelCase:    Optional[Any]=0.02		,	_lowerCAmelCase:    int=2		,	_lowerCAmelCase:    Optional[int]=True		,	_lowerCAmelCase:    Union[str, Any]=1		,	_lowerCAmelCase:    Union[str, Any]=0		,	_lowerCAmelCase:    int=2		,	_lowerCAmelCase:    Union[str, Any]=6000		,	_lowerCAmelCase:    Tuple=1024		,	_lowerCAmelCase:    Any=2		,	_lowerCAmelCase:    Any=(5, 5)		,	_lowerCAmelCase:    Optional[Any]=1024		,	_lowerCAmelCase:    Any=80		,	_lowerCAmelCase:    Optional[int]=1		,	**_lowerCAmelCase:    List[Any]		,	)    ->     Optional[int]:
         '''simple docstring'''

         UpperCAmelCase_           =vocab_size
         UpperCAmelCase_           =d_model
         UpperCAmelCase_           =encoder_ffn_dim
         UpperCAmelCase_           =encoder_layers
         UpperCAmelCase_           =encoder_attention_heads
         UpperCAmelCase_           =decoder_ffn_dim
         UpperCAmelCase_           =decoder_layers
         UpperCAmelCase_           =decoder_attention_heads
         UpperCAmelCase_           =dropout
         UpperCAmelCase_           =attention_dropout
         UpperCAmelCase_           =activation_dropout
         UpperCAmelCase_           =activation_function
         UpperCAmelCase_           =init_std
         UpperCAmelCase_           =encoder_layerdrop
         UpperCAmelCase_           =decoder_layerdrop
         UpperCAmelCase_           =use_cache
         UpperCAmelCase_           =encoder_layers
         UpperCAmelCase_           =scale_embedding  # scale factor will be sqrt(d_model) if True
         UpperCAmelCase_           =max_source_positions
         UpperCAmelCase_           =max_target_positions
         UpperCAmelCase_           =num_conv_layers
         UpperCAmelCase_           =list(__a							)
         UpperCAmelCase_           =conv_channels
         UpperCAmelCase_           =input_feat_per_channel
         UpperCAmelCase_           =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=__a		,	bos_token_id=__a		,	eos_token_id=__a		,	is_encoder_decoder=__a		,	decoder_start_token_id=__a		,	**__a		,	)










'''simple docstring'''







import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_lxmert import LxmertTokenizer


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

lowercase      :   Dict      =       {
    """vocab_file""": {
        """unc-nlp/lxmert-base-uncased""": """https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/vocab.txt""",
    },
    """tokenizer_file""": {
        """unc-nlp/lxmert-base-uncased""": (
            """https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/tokenizer.json"""
        ),
    },
}

lowercase      :   List[Any]      =       {
    """unc-nlp/lxmert-base-uncased""": 512,
}

lowercase      :   Tuple      =       {
    """unc-nlp/lxmert-base-uncased""": {"""do_lower_case""": True},
}







class 					_a (a__	):





     '''simple docstring'''



     lowerCAmelCase_  :     Optional[int]          =					VOCAB_FILES_NAMES
     lowerCAmelCase_  :     Optional[int]          =					PRETRAINED_VOCAB_FILES_MAP
     lowerCAmelCase_  :     Any          =					PRETRAINED_INIT_CONFIGURATION
     lowerCAmelCase_  :     Optional[int]          =					PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
     lowerCAmelCase_  :     Optional[int]          =					LxmertTokenizer







     def __init__(				self							,__a=None							,__a=None							,__a=True							,__a="[UNK]"							,__a="[SEP]"							,__a="[PAD]"							,__a="[CLS]"							,__a="[MASK]"							,__a=True							,__a=None							,**__a							,)      ->				str:
          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							,)

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

          snake_case			:      str        =			do_lower_case







     def 			snake_case_      (				self							,__a							,__a=None							)      ->				Optional[int]:
          snake_case			:      Tuple        =			[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 			snake_case_      (				self							,__a							,__a = None							)      ->				List[int]:
          snake_case			:      int        =			[self.sep_token_id]
          snake_case			:      Any        =			[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 			snake_case_      (				self							,__a							,__a = None							)      ->				Tuple[str]:
          snake_case			:      Optional[int]        =			self._tokenizer.model.save(__a							,name=__a							)
          return tuple(__a							)



