




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


UpperCAmelCase    =					logging.get_logger(__name__)

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







class lowerCAmelCase_		(				__a ):

 '''simple docstring'''

 __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	,   _UpperCAmelCase=3_21_28	,   _UpperCAmelCase=7_68	,   _UpperCAmelCase=64	,   _UpperCAmelCase=20_48	,   _UpperCAmelCase=64	,   _UpperCAmelCase=12	,   _UpperCAmelCase=3	,   _UpperCAmelCase=12	,   _UpperCAmelCase=3	,   _UpperCAmelCase=12	,   _UpperCAmelCase=8	,   _UpperCAmelCase=False	,   _UpperCAmelCase=0.01	,   _UpperCAmelCase="float32"	,   _UpperCAmelCase=False	,   _UpperCAmelCase=32	,   _UpperCAmelCase=1_28	,   _UpperCAmelCase=0.1	,   _UpperCAmelCase=1E-6	,   _UpperCAmelCase=0.001	,   _UpperCAmelCase=0.001	,   _UpperCAmelCase=1.0	,   _UpperCAmelCase="relu"	,   _UpperCAmelCase=True	,   _UpperCAmelCase=False	,   _UpperCAmelCase=True	,   _UpperCAmelCase=0	,   _UpperCAmelCase=1	,   **_UpperCAmelCase	,   ):
       snake_case_ =   vocab_size
       snake_case_ =   d_model
       snake_case_ =   d_kv
       snake_case_ =   d_ff

       snake_case_ =   num_sparse_encoder_layers

       snake_case_ =   num_layers
       snake_case_ =   (
           num_decoder_layers if num_decoder_layers is not None else self.num_layers
       )  # default = symmetry
       snake_case_ =   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:
             snake_case_ =   self.num_layers // self.num_sparse_encoder_layers
       else:
             snake_case_ =   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:
             snake_case_ =   self.num_decoder_layers // self.num_sparse_decoder_layers
       else:
             snake_case_ =   self.num_decoder_layers  # HACK: this will create 0 sparse layers

       snake_case_ =   num_heads
       snake_case_ =   num_experts
       snake_case_ =   expert_capacity
       snake_case_ =   router_bias
       snake_case_ =   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}'''      )
       snake_case_ =   router_dtype

       snake_case_ =   router_ignore_padding_tokens
       snake_case_ =   relative_attention_num_buckets
       snake_case_ =   relative_attention_max_distance

       snake_case_ =   dropout_rate
       snake_case_ =   layer_norm_epsilon
       snake_case_ =   initializer_factor
       snake_case_ =   feed_forward_proj
       snake_case_ =   use_cache
       snake_case_ =   add_router_probs

       snake_case_ =   router_z_loss_coef
       snake_case_ =   router_aux_loss_coef

       snake_case_ =   self.feed_forward_proj.split('''-'''      )
       snake_case_ =   act_info[-1]
       snake_case_ =   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":
             snake_case_ =   '''gelu_new'''

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



def  __lowerCAmelCase					(SCREAMING_SNAKE_CASE      ,      SCREAMING_SNAKE_CASE      )->						int:




      """simple docstring"""

      return int((input_a, input_a).count(0      ) == 0      )






def  __lowerCAmelCase					()->						None:




      """simple docstring"""

      assert and_gate(0      ,      0      ) == 0
      assert and_gate(0      ,      1      ) == 0
      assert and_gate(1      ,      0      ) == 0
      assert and_gate(1      ,      1      ) == 1


if __name__ == "__main__":
   test_and_gate()
   print(and_gate(1, 0))
   print(and_gate(0, 0))
   print(and_gate(0, 1))
   print(and_gate(1, 1))