

import logging
import os

from .state import PartialState


class 				SCREAMING_SNAKE_CASE__ (logging.LoggerAdapter					):





    @staticmethod
    def 				snake_case_    (				a):
         lowercase__   :       int				=	PartialState()
         return not main_process_only or (main_process_only and state.is_main_process)





    def 				snake_case_    (				self						,       a						,       a						,       *a						,       **a):
         if PartialState._shared_state == {}:
              raise RuntimeError(
                  'You must initialize the accelerate state by calling either `PartialState()` or `Accelerator()` before using the logging utility.')
         lowercase__   :       int				=	kwargs.pop('main_process_only'						,       a)
         lowercase__   :       Dict				=	kwargs.pop('in_order'						,       a)

         if self.isEnabledFor(a):
              if self._should_log(a):
                   lowercase__				,			lowercase__   :       Any				=	self.process(a						,       a)
                   self.logger.log(a						,       a						,       *a						,       **a)

              elif in_order:
                   lowercase__   :       Tuple				=	PartialState()
                   for i in range(state.num_processes):
                        if i == state.process_index:
                             lowercase__				,			lowercase__   :       Optional[Any]				=	self.process(a						,       a)
                             self.logger.log(a						,       a						,       *a						,       **a)
                        state.wait_for_everyone()



def      snake_case__      (   SCREAMING_SNAKE_CASE_		:   str     ,					SCREAMING_SNAKE_CASE_		:   str = None      ):



     '''simple docstring'''





     if log_level is None:
          lowercase__   :       Union[str, Any]				=	os.environ.get('ACCELERATE_LOG_LEVEL'     ,					SCREAMING_SNAKE_CASE_      )
     lowercase__   :       Tuple				=	logging.getLogger(SCREAMING_SNAKE_CASE_      )
     if log_level is not None:
          logger.setLevel(log_level.upper()      )
          logger.root.setLevel(log_level.upper()      )
     return MultiProcessAdapter(SCREAMING_SNAKE_CASE_     ,					{}      )




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


snake_case_        =			logging.get_logger(__name__)

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 				SCREAMING_SNAKE_CASE__ (__snake_case					):
    __lowerCamelCase						:	List[Any]														=					"""speech_to_text_2"""
    __lowerCamelCase						:	str														=					["""past_key_values"""]
    __lowerCamelCase						:	List[Any]														=					{"""num_attention_heads""": """decoder_attention_heads""", """hidden_size""": """d_model"""}





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

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

