


'''simple docstring'''






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					,    lowerCamelCase_					,    lowerCamelCase_=13					,    lowerCamelCase_=7					,    lowerCamelCase_=True					,    lowerCamelCase_=True					,    lowerCamelCase_=True					,    lowerCamelCase_=True					,    lowerCamelCase_=99					,    lowerCamelCase_=24					,    lowerCamelCase_=32					,    lowerCamelCase_=5					,    lowerCamelCase_=4					,    lowerCamelCase_=37					,    lowerCamelCase_="gelu"					,    lowerCamelCase_=0.1					,    lowerCamelCase_=0.1					,    lowerCamelCase_=5_12					,    lowerCamelCase_=16					,    lowerCamelCase_=2					,    lowerCamelCase_=0.02					,    lowerCamelCase_=4					,    )       ->							Any:
														lowerCAmelCase__          =	parent
														lowerCAmelCase__          =	batch_size
														lowerCAmelCase__          =	seq_length
														lowerCAmelCase__          =	is_training
														lowerCAmelCase__          =	use_attention_mask
														lowerCAmelCase__          =	use_token_type_ids
														lowerCAmelCase__          =	use_labels
														lowerCAmelCase__          =	vocab_size
														lowerCAmelCase__          =	hidden_size
														lowerCAmelCase__          =	embedding_size
														lowerCAmelCase__          =	num_hidden_layers
														lowerCAmelCase__          =	num_attention_heads
														lowerCAmelCase__          =	intermediate_size
														lowerCAmelCase__          =	hidden_act
														lowerCAmelCase__          =	hidden_dropout_prob
														lowerCAmelCase__          =	attention_probs_dropout_prob
														lowerCAmelCase__          =	max_position_embeddings
														lowerCAmelCase__          =	type_vocab_size
														lowerCAmelCase__          =	type_sequence_label_size
														lowerCAmelCase__          =	initializer_range
														lowerCAmelCase__          =	num_choices







							def   __SCREAMING_SNAKE_CASE							(		self   )       ->							str:
														lowerCAmelCase__          =	ids_tensor([self.batch_size, self.seq_length]					,    self.vocab_size   )

														lowerCAmelCase__          =	None
														if self.use_attention_mask:
																					lowerCAmelCase__          =	random_attention_mask([self.batch_size, self.seq_length]   )

														lowerCAmelCase__          =	None
														if self.use_token_type_ids:
																					lowerCAmelCase__          =	ids_tensor([self.batch_size, self.seq_length]					,    self.type_vocab_size   )

														lowerCAmelCase__          =	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   )       ->							Any:
														lowerCAmelCase__          =	self.prepare_config_and_inputs()
														lowerCAmelCase__   ,					lowerCAmelCase__   ,					lowerCAmelCase__   ,					lowerCAmelCase__          =	config_and_inputs
														lowerCAmelCase__          =	{'''input_ids''': input_ids, '''token_type_ids''': token_type_ids, '''attention_mask''': attention_mask}
														return config, inputs_dict




@require_flax
class 		a__				(							a__				,				unittest.TestCase  ):





							'''simple docstring'''






							lowercase__			:   Optional[int]							=      True

							lowercase__			:   Union[str, Any]							=      (
							    (
							        FlaxElectraModel,
							        FlaxElectraForCausalLM,
							        FlaxElectraForMaskedLM,
							        FlaxElectraForPreTraining,
							        FlaxElectraForTokenClassification,
							        FlaxElectraForQuestionAnswering,
							        FlaxElectraForMultipleChoice,
							        FlaxElectraForSequenceClassification,
							    )
							    if is_flax_available()
							    else ()
							)







							def   __SCREAMING_SNAKE_CASE							(		self   )       ->							str:
														lowerCAmelCase__          =	FlaxElectraModelTester(self   )







							@slow
							def   __SCREAMING_SNAKE_CASE							(		self   )       ->							int:
														for model_class_name in self.all_model_classes:
																					if model_class_name == FlaxElectraForMaskedLM:
																												lowerCAmelCase__          =	model_class_name.from_pretrained('''google/electra-small-generator'''   )
																					else:
																												lowerCAmelCase__          =	model_class_name.from_pretrained('''google/electra-small-discriminator'''   )
																					lowerCAmelCase__          =	model(np.ones((1, 1)   )   )
																					self.assertIsNotNone(lowerCamelCase_   )



'''simple docstring'''






import warnings

from ...utils import logging
from .image_processing_mobilenet_va import MobileNetVaImageProcessor


__UpperCAmelCase    				=							logging.get_logger(__name__)




class 		a__				(							a__  ):





							'''simple docstring'''






							def __init__(		self					,    *lowerCamelCase_					,    **lowerCamelCase_   )       ->							None:
														warnings.warn(
														    '''The class MobileNetV2FeatureExtractor is deprecated and will be removed in version 5 of Transformers.'''
														    ''' Please use MobileNetV2ImageProcessor instead.'''					,    lowerCamelCase_					,    )
														super().__init__(*lowerCamelCase_					,    **lowerCamelCase_   )