



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


__UpperCAmelCase			  =			logging.get_logger(__name__)

__UpperCAmelCase			  =			{
    '''bigcode/gpt_bigcode-santacoder''': '''https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json''',
}



class 							lowerCAmelCase_						(    a__				):
       UpperCAmelCase__							:   Optional[Any]  	=    "gpt_bigcode"
       UpperCAmelCase__							:   int  	=    ["past_key_values"]
       UpperCAmelCase__							:   Optional[int]  	=    {
           "hidden_size": "n_embd",
           "max_position_embeddings": "n_positions",
           "num_attention_heads": "n_head",
           "num_hidden_layers": "n_layer",
       }
       def __init__(     self,     SCREAMING_SNAKE_CASE_=5_0257,     SCREAMING_SNAKE_CASE_=1024,     SCREAMING_SNAKE_CASE_=768,     SCREAMING_SNAKE_CASE_=12,     SCREAMING_SNAKE_CASE_=12,     SCREAMING_SNAKE_CASE_=None,     SCREAMING_SNAKE_CASE_="gelu_pytorch_tanh",     SCREAMING_SNAKE_CASE_=0.1,     SCREAMING_SNAKE_CASE_=0.1,     SCREAMING_SNAKE_CASE_=0.1,     SCREAMING_SNAKE_CASE_=1e-5,     SCREAMING_SNAKE_CASE_=0.02,     SCREAMING_SNAKE_CASE_=True,     SCREAMING_SNAKE_CASE_=True,     SCREAMING_SNAKE_CASE_=5_0256,     SCREAMING_SNAKE_CASE_=5_0256,     SCREAMING_SNAKE_CASE_=True,     SCREAMING_SNAKE_CASE_=True,     SCREAMING_SNAKE_CASE_=True,     **SCREAMING_SNAKE_CASE_,     )	->						Any:
          UpperCamelCase       :    int		      =      vocab_size
          UpperCamelCase       :    Any		      =      n_positions
          UpperCamelCase       :    Optional[int]		      =      n_embd
          UpperCamelCase       :    int		      =      n_layer
          UpperCamelCase       :    int		      =      n_head
          UpperCamelCase       :    Any		      =      n_inner
          UpperCamelCase       :    int		      =      activation_function
          UpperCamelCase       :    Tuple		      =      resid_pdrop
          UpperCamelCase       :    int		      =      embd_pdrop
          UpperCamelCase       :    Any		      =      attn_pdrop
          UpperCamelCase       :    int		      =      layer_norm_epsilon
          UpperCamelCase       :    Tuple		      =      initializer_range
          UpperCamelCase       :    Dict		      =      scale_attn_weights
          UpperCamelCase       :    Union[str, Any]		      =      use_cache
          UpperCamelCase       :    Dict		      =      attention_softmax_in_fpaa
          UpperCamelCase       :    Any		      =      scale_attention_softmax_in_fpaa
          UpperCamelCase       :    Optional[Any]		      =      multi_query

          UpperCamelCase       :    Any		      =      bos_token_id
          UpperCamelCase       :    Union[str, Any]		      =      eos_token_id

          super().__init__(bos_token_id=SCREAMING_SNAKE_CASE_,     eos_token_id=SCREAMING_SNAKE_CASE_,     **SCREAMING_SNAKE_CASE_			)








import logging
import os

from .state import PartialState
class    __UpperCamelCase			(       logging.LoggerAdapter				):

 """simple docstring"""



 @staticmethod
 def 						_UpperCAmelCase       (	SCREAMING_SNAKE_CASE      ) ->			Optional[Any]:
  a__												= PartialState()
  return not main_process_only or (main_process_only and state.is_main_process)



 def 						_UpperCAmelCase       (	self		,				SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE		,				*SCREAMING_SNAKE_CASE		,				**SCREAMING_SNAKE_CASE      ) ->			Optional[int]:
  if PartialState._shared_state == {}:
   raise RuntimeError(
       '''You must initialize the accelerate state by calling either `PartialState()` or `Accelerator()` before using the logging utility.'''      )
  a__												= kwargs.pop('''main_process_only'''		,				SCREAMING_SNAKE_CASE      )
  a__												= kwargs.pop('''in_order'''		,				SCREAMING_SNAKE_CASE      )

  if self.isEnabledFor(SCREAMING_SNAKE_CASE      ):
   if self._should_log(SCREAMING_SNAKE_CASE      ):
    a__							,			a__												= self.process(SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE      )
    self.logger.log(SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE		,				*SCREAMING_SNAKE_CASE		,				**SCREAMING_SNAKE_CASE      )

   elif in_order:
    a__												= PartialState()
    for i in range(state.num_processes      ):
     if i == state.process_index:
      a__							,			a__												= self.process(SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE      )
      self.logger.log(SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE		,				*SCREAMING_SNAKE_CASE		,				**SCREAMING_SNAKE_CASE      )
     state.wait_for_everyone()






def     __a					(		__UpperCAmelCase							,  __UpperCAmelCase = None       ):
 if log_level is None:
  a__												= os.environ.get('''ACCELERATE_LOG_LEVEL'''							,  __UpperCAmelCase       )
 a__												= logging.getLogger(__UpperCAmelCase       )
 if log_level is not None:
  logger.setLevel(log_level.upper()       )
  logger.root.setLevel(log_level.upper()       )
 return MultiProcessAdapter(__UpperCAmelCase							,  {}       )





