code: 
  
  
  
  
  
  
  import unittest
  
  import numpy as np
  
  from transformers import ElectraConfig, is_flax_available
  from transformers.testing_utils import require_flax, slow
  
  from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask
  
  
  if is_flax_available():
     from transformers.models.electra.modeling_flax_electra import (
         FlaxElectraForCausalLM,
         FlaxElectraForMaskedLM,
         FlaxElectraForMultipleChoice,
         FlaxElectraForPreTraining,
         FlaxElectraForQuestionAnswering,
         FlaxElectraForSequenceClassification,
         FlaxElectraForTokenClassification,
         FlaxElectraModel,
     )
  
  
  
  class 							_A (    unittest.TestCase							):
      """simple docstring"""
  
      def __init__(							self			:    Dict   ,    __SCREAMING_SNAKE_CASE			:    List[Any]   ,    __SCREAMING_SNAKE_CASE			:    str=13   ,    __SCREAMING_SNAKE_CASE			:    int=7   ,    __SCREAMING_SNAKE_CASE			:    Dict=True   ,    __SCREAMING_SNAKE_CASE			:    Dict=True   ,    __SCREAMING_SNAKE_CASE			:    Union[str, Any]=True   ,    __SCREAMING_SNAKE_CASE			:    str=True   ,    __SCREAMING_SNAKE_CASE			:    List[str]=99   ,    __SCREAMING_SNAKE_CASE			:    Optional[int]=24   ,    __SCREAMING_SNAKE_CASE			:    Any=32   ,    __SCREAMING_SNAKE_CASE			:    List[str]=5   ,    __SCREAMING_SNAKE_CASE			:    Dict=4   ,    __SCREAMING_SNAKE_CASE			:    int=37   ,    __SCREAMING_SNAKE_CASE			:    str="gelu"   ,    __SCREAMING_SNAKE_CASE			:    Tuple=0.1   ,    __SCREAMING_SNAKE_CASE			:    Optional[int]=0.1   ,    __SCREAMING_SNAKE_CASE			:    int=512   ,    __SCREAMING_SNAKE_CASE			:    Dict=16   ,    __SCREAMING_SNAKE_CASE			:    int=2   ,    __SCREAMING_SNAKE_CASE			:    str=0.02   ,    __SCREAMING_SNAKE_CASE			:    List[Any]=4   ,    )			->       str:
             __UpperCAmelCase    							=parent
             __UpperCAmelCase    							=batch_size
             __UpperCAmelCase    							=seq_length
             __UpperCAmelCase    							=is_training
             __UpperCAmelCase    							=use_attention_mask
             __UpperCAmelCase    							=use_token_type_ids
             __UpperCAmelCase    							=use_labels
             __UpperCAmelCase    							=vocab_size
             __UpperCAmelCase    							=hidden_size
             __UpperCAmelCase    							=embedding_size
             __UpperCAmelCase    							=num_hidden_layers
             __UpperCAmelCase    							=num_attention_heads
             __UpperCAmelCase    							=intermediate_size
             __UpperCAmelCase    							=hidden_act
             __UpperCAmelCase    							=hidden_dropout_prob
             __UpperCAmelCase    							=attention_probs_dropout_prob
             __UpperCAmelCase    							=max_position_embeddings
             __UpperCAmelCase    							=type_vocab_size
             __UpperCAmelCase    							=type_sequence_label_size
             __UpperCAmelCase    							=initializer_range
             __UpperCAmelCase    							=num_choices
  
  
  
      def _a       (							self			:    str			)			->       List[Any]:
             __UpperCAmelCase    							=ids_tensor([self.batch_size, self.seq_length]   ,    self.vocab_size			)
  
             __UpperCAmelCase    							=None
             if self.use_attention_mask:
                    __UpperCAmelCase    							=random_attention_mask([self.batch_size, self.seq_length]			)
  
             __UpperCAmelCase    							=None
             if self.use_token_type_ids:
                    __UpperCAmelCase    							=ids_tensor([self.batch_size, self.seq_length]   ,    self.type_vocab_size			)
  
             __UpperCAmelCase    							=ElectraConfig(
                 vocab_size=self.vocab_size   ,    hidden_size=self.hidden_size   ,    embedding_size=self.embedding_size   ,    num_hidden_layers=self.num_hidden_layers   ,    num_attention_heads=self.num_attention_heads   ,    intermediate_size=self.intermediate_size   ,    hidden_act=self.hidden_act   ,    hidden_dropout_prob=self.hidden_dropout_prob   ,    attention_probs_dropout_prob=self.attention_probs_dropout_prob   ,    max_position_embeddings=self.max_position_embeddings   ,    type_vocab_size=self.type_vocab_size   ,    initializer_range=self.initializer_range   ,    )
  
             return config, input_ids, token_type_ids, attention_mask
  
  
  
      def _a       (							self			:    Any			)			->       List[Any]:
             __UpperCAmelCase    							=self.prepare_config_and_inputs()
             __UpperCAmelCase							,   __UpperCAmelCase							,   __UpperCAmelCase							,   __UpperCAmelCase    							=config_and_inputs
             __UpperCAmelCase    							={"""input_ids""": input_ids, """token_type_ids""": token_type_ids, """attention_mask""": attention_mask}
             return config, inputs_dict
  
  
  
  
  @require_flax
  class 							_A (    lowerCAmelCase__				,				unittest.TestCase							):
      """simple docstring"""
  
      lowerCamelCase  :       int   =   True
  
      lowerCamelCase  :       str   =   (
          (
              FlaxElectraModel,
              FlaxElectraForCausalLM,
              FlaxElectraForMaskedLM,
              FlaxElectraForPreTraining,
              FlaxElectraForTokenClassification,
              FlaxElectraForQuestionAnswering,
              FlaxElectraForMultipleChoice,
              FlaxElectraForSequenceClassification,
          )
          if is_flax_available()
          else ()
      )
  
  
  
      def _a       (							self			:    Optional[int]			)			->       List[Any]:
             __UpperCAmelCase    							=FlaxElectraModelTester(self			)
  
  
  
      @slow
      def _a       (							self			:    Dict			)			->       Optional[Any]:
  
  
  
  
  
  
             for model_class_name in self.all_model_classes:
                    if model_class_name == FlaxElectraForMaskedLM:
                           __UpperCAmelCase    							=model_class_name.from_pretrained("""google/electra-small-generator"""			)
                    else:
                           __UpperCAmelCase    							=model_class_name.from_pretrained("""google/electra-small-discriminator"""			)
                    __UpperCAmelCase    							=model(np.ones((1, 1)			)			)
                    self.assertIsNotNone(lowerCAmelCase_			)
  
  
  
  
  
style_context: 
  
  
  
  
  
  
  __A  							=  [0.485, 0.456, 0.406]
  __A  							=  [0.229, 0.224, 0.225]
  __A  							=  [0.5, 0.5, 0.5]
  __A  							=  [0.5, 0.5, 0.5]
  __A  							=  [0.4814_5466, 0.457_8275, 0.4082_1073]
  __A  							=  [0.2686_2954, 0.2613_0258, 0.2757_7711]
  
  
  
  
  