





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


__lowercase  :   Dict						      =logging.get_logger(__name__)

__lowercase  :   int						      ={
    """google/switch-base-8""": """https://huggingface.co/google/switch-base-8/blob/main/config.json""",
}

class      A       (	__lowercase						):
      _snake_case							     ='''switch_transformers'''
      _snake_case							     =['''past_key_values''']
      _snake_case							     ={'''hidden_size''': '''d_model''', '''num_attention_heads''': '''num_heads''', '''num_hidden_layers''': '''num_layers'''}



      def __init__(	self:						Optional[Any]		,  _lowerCAmelCase:						Dict=3_2128		,  _lowerCAmelCase:						Optional[Any]=768		,  _lowerCAmelCase:						List[str]=64		,  _lowerCAmelCase:						Any=2048		,  _lowerCAmelCase:						Optional[int]=64		,  _lowerCAmelCase:						Union[str, Any]=12		,  _lowerCAmelCase:						List[str]=3		,  _lowerCAmelCase:						Dict=12		,  _lowerCAmelCase:						int=3		,  _lowerCAmelCase:						str=12		,  _lowerCAmelCase:						Optional[Any]=8		,  _lowerCAmelCase:						Optional[int]=False		,  _lowerCAmelCase:						Optional[Any]=0.01		,  _lowerCAmelCase:						Optional[int]="float32"		,  _lowerCAmelCase:						int=False		,  _lowerCAmelCase:						Optional[Any]=32		,  _lowerCAmelCase:						Optional[Any]=128		,  _lowerCAmelCase:						List[Any]=0.1		,  _lowerCAmelCase:						Any=1e-6		,  _lowerCAmelCase:						Dict=0.0_01		,  _lowerCAmelCase:						Tuple=0.0_01		,  _lowerCAmelCase:						int=1.0		,  _lowerCAmelCase:						List[str]="relu"		,  _lowerCAmelCase:						int=True		,  _lowerCAmelCase:						Dict=False		,  _lowerCAmelCase:						Dict=True		,  _lowerCAmelCase:						Optional[int]=0		,  _lowerCAmelCase:						str=1		,  **_lowerCAmelCase:						Optional[Any]		,  )						->    str:
         '''simple docstring'''

         UpperCAmelCase_											=vocab_size
         UpperCAmelCase_											=d_model
         UpperCAmelCase_											=d_kv
         UpperCAmelCase_											=d_ff

         UpperCAmelCase_											=num_sparse_encoder_layers

         UpperCAmelCase_											=num_layers
         UpperCAmelCase_											=(
             num_decoder_layers if num_decoder_layers is not None else self.num_layers
         )  # default = symmetry
         UpperCAmelCase_											=num_sparse_decoder_layers

         # This tells us, each how many encoder layer we'll have to set a sparse layer.
         if self.num_sparse_encoder_layers > 0:
            UpperCAmelCase_											=self.num_layers // self.num_sparse_encoder_layers
         else:
            UpperCAmelCase_											=self.num_layers  # HACK: this will create 0 sparse layers

         # This tells us, each how many encoder layer we'll have to set a sparse layer.
         if self.num_sparse_decoder_layers > 0:
            UpperCAmelCase_											=self.num_decoder_layers // self.num_sparse_decoder_layers
         else:
            UpperCAmelCase_											=self.num_decoder_layers  # HACK: this will create 0 sparse layers

         UpperCAmelCase_											=num_heads
         UpperCAmelCase_											=num_experts
         UpperCAmelCase_											=expert_capacity
         UpperCAmelCase_											=router_bias
         UpperCAmelCase_											=router_jitter_noise
         if router_dtype not in ["float32", "float16", "bfloat16"]:
            raise ValueError(F'`router_dtype` must be one of \'float32\', \'float16\' or \'bfloat16\', got {router_dtype}'       )
         UpperCAmelCase_											=router_dtype

         UpperCAmelCase_											=router_ignore_padding_tokens
         UpperCAmelCase_											=relative_attention_num_buckets
         UpperCAmelCase_											=relative_attention_max_distance

         UpperCAmelCase_											=dropout_rate
         UpperCAmelCase_											=layer_norm_epsilon
         UpperCAmelCase_											=initializer_factor
         UpperCAmelCase_											=feed_forward_proj
         UpperCAmelCase_											=use_cache
         UpperCAmelCase_											=add_router_probs

         UpperCAmelCase_											=router_z_loss_coef
         UpperCAmelCase_											=router_aux_loss_coef

         UpperCAmelCase_											=self.feed_forward_proj.split("-"       )
         UpperCAmelCase_											=act_info[-1]
         UpperCAmelCase_											=act_info[0] == "gated"

         if len(_lowerCAmelCase       ) > 1 and act_info[0] != "gated" or len(_lowerCAmelCase       ) > 2:
            raise ValueError(
                F'`feed_forward_proj`: {feed_forward_proj} is not a valid activation function of the dense layer.'
                "Please make sure `feed_forward_proj` is of the format `gated-{ACT_FN}` or `{ACT_FN}`, e.g. "
                "'gated-gelu' or 'relu'"       )

         # for backwards compatibility
         if feed_forward_proj == "gated-gelu":
            UpperCAmelCase_											="gelu_new"

         super().__init__(
             pad_token_id=_lowerCAmelCase		,  eos_token_id=_lowerCAmelCase		,  is_encoder_decoder=_lowerCAmelCase		,  **_lowerCAmelCase		,  )











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


__lowercase  :   Union[str, Any]						      =logging.get_logger(__name__)

__lowercase  :   List[Any]						      ={
    """tanreinama/GPTSAN-2.8B-spout_is_uniform""": (
        """https://huggingface.co/tanreinama/GPTSAN-2.8B-spout_is_uniform/resolve/main/config.json"""
    ),
}

class      A       (	__lowercase						):
      _snake_case							     ='''gptsan-japanese'''
      _snake_case							     =[
          '''past_key_values''',
      ]
      _snake_case							     ={
          '''hidden_size''': '''d_model''',
          '''num_attention_heads''': '''num_heads''',
          '''num_hidden_layers''': '''num_layers''',
      }



      def __init__(	self:						Optional[Any]		,  _lowerCAmelCase:						List[Any]=3_6000		,  _lowerCAmelCase:						List[Any]=1280		,  _lowerCAmelCase:						str=1024		,  _lowerCAmelCase:						Any=8192		,  _lowerCAmelCase:						str=4096		,  _lowerCAmelCase:						int=128		,  _lowerCAmelCase:						int=10		,  _lowerCAmelCase:						Dict=0		,  _lowerCAmelCase:						Any=16		,  _lowerCAmelCase:						Optional[int]=16		,  _lowerCAmelCase:						List[Any]=128		,  _lowerCAmelCase:						Tuple=0.0		,  _lowerCAmelCase:						Optional[Any]=1e-5		,  _lowerCAmelCase:						int=False		,  _lowerCAmelCase:						Optional[Any]=0.0		,  _lowerCAmelCase:						str="float32"		,  _lowerCAmelCase:						Dict=False		,  _lowerCAmelCase:						Any=False		,  _lowerCAmelCase:						int=False		,  _lowerCAmelCase:						Union[str, Any]=0.0_02		,  _lowerCAmelCase:						Optional[int]=False		,  _lowerCAmelCase:						int=True		,  _lowerCAmelCase:						List[str]=3_5998		,  _lowerCAmelCase:						Optional[int]=3_5995		,  _lowerCAmelCase:						Dict=3_5999		,  **_lowerCAmelCase:						Optional[Any]		,  )						->    List[Any]:
         '''simple docstring'''

         UpperCAmelCase_											=vocab_size
         UpperCAmelCase_											=max_position_embeddings
         UpperCAmelCase_											=d_model
         UpperCAmelCase_											=d_ff
         UpperCAmelCase_											=d_ext
         UpperCAmelCase_											=d_spout
         UpperCAmelCase_											=num_switch_layers
         UpperCAmelCase_											=num_ext_layers
         UpperCAmelCase_											=num_switch_layers + num_ext_layers
         UpperCAmelCase_											=num_heads
         UpperCAmelCase_											=num_experts
         UpperCAmelCase_											=expert_capacity
         UpperCAmelCase_											=dropout_rate
         UpperCAmelCase_											=layer_norm_epsilon
         UpperCAmelCase_											=router_bias
         UpperCAmelCase_											=router_jitter_noise
         UpperCAmelCase_											=router_dtype
         UpperCAmelCase_											=router_ignore_padding_tokens
         UpperCAmelCase_											=output_hidden_states
         UpperCAmelCase_											=output_attentions
         UpperCAmelCase_											=initializer_factor
         UpperCAmelCase_											=output_router_logits
         UpperCAmelCase_											=use_cache

         super().__init__(
             separator_token_id=_lowerCAmelCase		,  pad_token_id=_lowerCAmelCase		,  eos_token_id=_lowerCAmelCase		,  **_lowerCAmelCase		,  )




