
"""simple docstring"""

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


SCREAMING_SNAKE_CASE_    					=						logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_    					=						{
    '''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      _UpperCAmelCase							(		SCREAMING_SNAKE_CASE_							):
      __SCREAMING_SNAKE_CASE   :							Any							      =	"speech_to_text_2"
      __SCREAMING_SNAKE_CASE   :							Optional[Any]							      =	["past_key_values"]
      __SCREAMING_SNAKE_CASE   :							Optional[int]							      =	{"num_attention_heads": "decoder_attention_heads", "hidden_size": "d_model"}




      def __init__(							self   ,       lowercase_=1_0_0_0_0   ,       lowercase_=6   ,       lowercase_=2_0_4_8   ,       lowercase_=4   ,       lowercase_=0.0   ,       lowercase_=True   ,       lowercase_="relu"   ,       lowercase_=2_5_6   ,       lowercase_=0.1   ,       lowercase_=0.0   ,       lowercase_=0.0   ,       lowercase_=0.0_2   ,       lowercase_=2   ,       lowercase_=True   ,       lowercase_=1   ,       lowercase_=0   ,       lowercase_=2   ,       lowercase_=1_0_2_4   ,       **lowercase_   ,       )						->					int:
          UpperCAmelCase									=					vocab_size
          UpperCAmelCase									=					d_model
          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									=					decoder_layerdrop
          UpperCAmelCase									=					use_cache
          UpperCAmelCase									=					decoder_layers
          UpperCAmelCase									=					scale_embedding  # scale factor will be sqrt(d_model) if True
          UpperCAmelCase									=					max_target_positions

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





"""simple docstring"""

import copy

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


SCREAMING_SNAKE_CASE_    					=						logging.get_logger(__name__)
class      _UpperCAmelCase							(		SCREAMING_SNAKE_CASE_							):
      __SCREAMING_SNAKE_CASE   :							Union[str, Any]							      =	"encoder-decoder"
      __SCREAMING_SNAKE_CASE   :							Any							      =	True




      def __init__(							self   ,       **lowercase_							)						->					str:
          super().__init__(**lowercase_							)
          assert (
              "encoder" in kwargs and "decoder" in kwargs
          ), "Config has to be initialized with encoder and decoder config"
          UpperCAmelCase									=					kwargs.pop('encoder'							)
          UpperCAmelCase									=					encoder_config.pop('model_type'							)
          UpperCAmelCase									=					kwargs.pop('decoder'							)
          UpperCAmelCase									=					decoder_config.pop('model_type'							)

          from ..auto.configuration_auto import AutoConfig

          UpperCAmelCase									=					AutoConfig.for_model(lowercase_   ,       **lowercase_							)
          UpperCAmelCase									=					AutoConfig.for_model(lowercase_   ,       **lowercase_							)
          UpperCAmelCase									=					True




      @classmethod
      def     a_      (							cls   ,       lowercase_   ,       lowercase_   ,       **lowercase_							)						->					PretrainedConfig:
          logger.info('Set `config.is_decoder=True` and `config.add_cross_attention=True` for decoder_config'							)
          UpperCAmelCase									=					True
          UpperCAmelCase									=					True

          return cls(encoder=encoder_config.to_dict()   ,       decoder=decoder_config.to_dict()   ,       **lowercase_							)




      def     a_      (							self							)						->					Optional[int]:
          UpperCAmelCase									=					copy.deepcopy(self.__dict__							)
          UpperCAmelCase									=					self.encoder.to_dict()
          UpperCAmelCase									=					self.decoder.to_dict()
          UpperCAmelCase									=					self.__class__.model_type
          return output



