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 	lowercase		(				unittest.TestCase):
  
  
  
  
  
  
  	"""simple docstring"""
  
  
  	def __init__(			self			:		List[Any]		,						__UpperCAmelCase			:		Optional[int]		,						__UpperCAmelCase			:		Tuple=13		,						__UpperCAmelCase			:		Dict=7		,						__UpperCAmelCase			:		Optional[Any]=True		,						__UpperCAmelCase			:		List[Any]=True		,						__UpperCAmelCase			:		List[Any]=True		,						__UpperCAmelCase			:		List[Any]=True		,						__UpperCAmelCase			:		Union[str, Any]=99		,						__UpperCAmelCase			:		Dict=24		,						__UpperCAmelCase			:		Any=32		,						__UpperCAmelCase			:		Dict=5		,						__UpperCAmelCase			:		List[Any]=4		,						__UpperCAmelCase			:		Any=37		,						__UpperCAmelCase			:		Dict="gelu"		,						__UpperCAmelCase			:		str=0.1		,						__UpperCAmelCase			:		List[Any]=0.1		,						__UpperCAmelCase			:		List[str]=512		,						__UpperCAmelCase			:		int=16		,						__UpperCAmelCase			:		int=2		,						__UpperCAmelCase			:		Union[str, Any]=0.02		,						__UpperCAmelCase			:		Tuple=4		,						)    ->				Optional[Any]:
  							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 						_SCREAMING_SNAKE_CASE	(			self			:		Optional[int]  )    ->				Tuple:
  							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 						_SCREAMING_SNAKE_CASE	(			self			:		str  )    ->				Optional[int]:
  							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 	lowercase		(				snake_case__				,					unittest.TestCase):
  
  
  
  
  
  
  	"""simple docstring"""
  
  
  	a__   :      int	     =							True
  
  	a__   :      Dict	     =							(
  	    (
  	        FlaxElectraModel,
  	        FlaxElectraForCausalLM,
  	        FlaxElectraForMaskedLM,
  	        FlaxElectraForPreTraining,
  	        FlaxElectraForTokenClassification,
  	        FlaxElectraForQuestionAnswering,
  	        FlaxElectraForMultipleChoice,
  	        FlaxElectraForSequenceClassification,
  	    )
  	    if is_flax_available()
  	    else ()
  	)
  
  
  
  
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		Union[str, Any]  )    ->				List[Any]:
  							UpperCAmelCase_=     FlaxElectraModelTester(self  )
  
  
  
  
  	@slow
  	def 						_SCREAMING_SNAKE_CASE	(			self			:		str  )    ->				str:
  							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(__UpperCAmelCase  )
  
  
  
  
  
style_context: 
  
  
  
  from ...configuration_utils import PretrainedConfig
  from ...utils import logging
  
  
  __A       					=		logging.get_logger(__name__)
  
  __A       					=		{
      '''ZinengTang/tvlt-base''': '''https://huggingface.co/ZinengTang/tvlt-base/blob/main/config.json''',
  }
  
  
  
  
  
  
  class 	lowercase		(				snake_case__):
  
  
  
  
  
  
  	"""simple docstring"""
  
  
  	a__   :      Tuple	     =							"tvlt"
  
  
  
  
  	def __init__(			self			:		List[str]		,						__UpperCAmelCase			:		List[str]=224		,						__UpperCAmelCase			:		List[str]=2_048		,						__UpperCAmelCase			:		Tuple=128		,						__UpperCAmelCase			:		Union[str, Any]=[16, 16]		,						__UpperCAmelCase			:		str=[16, 16]		,						__UpperCAmelCase			:		str=3		,						__UpperCAmelCase			:		List[str]=1		,						__UpperCAmelCase			:		Tuple=8		,						__UpperCAmelCase			:		Optional[Any]=768		,						__UpperCAmelCase			:		List[Any]=12		,						__UpperCAmelCase			:		Tuple=12		,						__UpperCAmelCase			:		List[str]=3_072		,						__UpperCAmelCase			:		List[Any]="gelu"		,						__UpperCAmelCase			:		str=0.0		,						__UpperCAmelCase			:		str=0.0		,						__UpperCAmelCase			:		List[Any]=0.02		,						__UpperCAmelCase			:		Optional[int]=1E-6		,						__UpperCAmelCase			:		Tuple=True		,						__UpperCAmelCase			:		List[Any]=False		,						__UpperCAmelCase			:		Union[str, Any]=16		,						__UpperCAmelCase			:		Any=512		,						__UpperCAmelCase			:		Optional[Any]=8		,						__UpperCAmelCase			:		Dict=2_048		,						__UpperCAmelCase			:		Dict=0.75		,						__UpperCAmelCase			:		Union[str, Any]=0.15		,						__UpperCAmelCase			:		Any="frame-level"		,						__UpperCAmelCase			:		int=True		,						__UpperCAmelCase			:		List[Any]=True		,						__UpperCAmelCase			:		Union[str, Any]="classification"		,						**__UpperCAmelCase			:		Any		,						)    ->				Tuple:
  							super().__init__(**__UpperCAmelCase  )
  
  							if audio_mask_type not in ("frame-level", "patch_level"):
  													raise ValueError(
  													    """audio_mask_type must be one of two acceptable strategies - {'frame_level', 'patch-level') """
  													    F"""got {audio_mask_type}"""  )
  
  							UpperCAmelCase_=     image_size
  							UpperCAmelCase_=     spectrogram_length
  							UpperCAmelCase_=     frequency_length
  							UpperCAmelCase_=     image_patch_size
  							UpperCAmelCase_=     audio_patch_size
  							UpperCAmelCase_=     num_image_channels
  							UpperCAmelCase_=     num_audio_channels
  							UpperCAmelCase_=     num_frames
  
  							UpperCAmelCase_=     hidden_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_=     initializer_range
  							UpperCAmelCase_=     layer_norm_eps
  							UpperCAmelCase_=     qkv_bias
  							UpperCAmelCase_=     use_mean_pooling
  
  							UpperCAmelCase_=     decoder_num_attention_heads
  							UpperCAmelCase_=     decoder_hidden_size
  							UpperCAmelCase_=     decoder_num_hidden_layers
  							UpperCAmelCase_=     decoder_intermediate_size
  							UpperCAmelCase_=     pixel_mask_ratio
  							UpperCAmelCase_=     audio_mask_ratio
  							UpperCAmelCase_=     audio_mask_type
  
  							UpperCAmelCase_=     task_matching
  							UpperCAmelCase_=     task_mae
  							UpperCAmelCase_=     loss_type
  
  
  
  
  