






'''simple docstring'''







import unittest

import numpy as np

from transformers import RobertaPreLayerNormConfig, is_flax_available
from transformers.testing_utils import require_flax, slow

from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask


if is_flax_available():
			import jax.numpy as jnp

			from transformers.models.roberta_prelayernorm.modeling_flax_roberta_prelayernorm import (
			    FlaxRobertaPreLayerNormForCausalLM,
			    FlaxRobertaPreLayerNormForMaskedLM,
			    FlaxRobertaPreLayerNormForMultipleChoice,
			    FlaxRobertaPreLayerNormForQuestionAnswering,
			    FlaxRobertaPreLayerNormForSequenceClassification,
			    FlaxRobertaPreLayerNormForTokenClassification,
			    FlaxRobertaPreLayerNormModel,
			)

class _lowercase			(       unittest.TestCase	):

							'''simple docstring'''





							def __init__(							self:       int    ,							UpperCamelCase__:       Optional[Any]    ,							UpperCamelCase__:       Any=13    ,							UpperCamelCase__:       int=7    ,							UpperCamelCase__:       int=True    ,							UpperCamelCase__:       Dict=True    ,							UpperCamelCase__:       Optional[int]=True    ,							UpperCamelCase__:       List[Any]=True    ,							UpperCamelCase__:       Optional[int]=99    ,							UpperCamelCase__:       Optional[int]=32    ,							UpperCamelCase__:       Dict=5    ,							UpperCamelCase__:       Optional[int]=4    ,							UpperCamelCase__:       Optional[Any]=37    ,							UpperCamelCase__:       Union[str, Any]="gelu"    ,							UpperCamelCase__:       str=0.1    ,							UpperCamelCase__:       str=0.1    ,							UpperCamelCase__:       List[str]=512    ,							UpperCamelCase__:       Optional[Any]=16    ,							UpperCamelCase__:       Union[str, Any]=2    ,							UpperCamelCase__:       Tuple=0.02    ,							UpperCamelCase__:       Union[str, Any]=4    ,							):
														lowerCamelCase__      :			Any 						= parent
														lowerCamelCase__      :			Union[str, Any] 						= batch_size
														lowerCamelCase__      :			Union[str, Any] 						= seq_length
														lowerCamelCase__      :			Optional[Any] 						= is_training
														lowerCamelCase__      :			Optional[Any] 						= use_attention_mask
														lowerCamelCase__      :			List[Any] 						= use_token_type_ids
														lowerCamelCase__      :			Dict 						= use_labels
														lowerCamelCase__      :			List[Any] 						= vocab_size
														lowerCamelCase__      :			Optional[int] 						= hidden_size
														lowerCamelCase__      :			int 						= num_hidden_layers
														lowerCamelCase__      :			List[str] 						= num_attention_heads
														lowerCamelCase__      :			List[str] 						= intermediate_size
														lowerCamelCase__      :			Optional[Any] 						= hidden_act
														lowerCamelCase__      :			Tuple 						= hidden_dropout_prob
														lowerCamelCase__      :			Tuple 						= attention_probs_dropout_prob
														lowerCamelCase__      :			Optional[int] 						= max_position_embeddings
														lowerCamelCase__      :			List[Any] 						= type_vocab_size
														lowerCamelCase__      :			Tuple 						= type_sequence_label_size
														lowerCamelCase__      :			Union[str, Any] 						= initializer_range
														lowerCamelCase__      :			List[str] 						= num_choices




							def 	lowerCamelCase_       (							self:       Optional[Any]  ):
														lowerCamelCase__      :			Optional[int] 						= ids_tensor([self.batch_size, self.seq_length]    ,							self.vocab_size  )

														lowerCamelCase__      :			List[Any] 						= None
														if self.use_attention_mask:
																					lowerCamelCase__      :			Dict 						= random_attention_mask([self.batch_size, self.seq_length]  )

														lowerCamelCase__      :			Optional[Any] 						= None
														if self.use_token_type_ids:
																					lowerCamelCase__      :			Tuple 						= ids_tensor([self.batch_size, self.seq_length]    ,							self.type_vocab_size  )

														lowerCamelCase__      :			Dict 						= RobertaPreLayerNormConfig(
														    vocab_size=self.vocab_size    ,							hidden_size=self.hidden_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    ,							is_decoder=UpperCamelCase__    ,							initializer_range=self.initializer_range    ,							)

														return config, input_ids, token_type_ids, attention_mask




							def 	lowerCamelCase_       (							self:       Tuple  ):
														lowerCamelCase__      :			List[Any] 						= self.prepare_config_and_inputs()
														lowerCamelCase__      :			Dict 						= config_and_inputs
														lowerCamelCase__      :			Tuple 						= {"""input_ids""": input_ids, """token_type_ids""": token_type_ids, """attention_mask""": attention_mask}
														return config, inputs_dict




							def 	lowerCamelCase_       (							self:       List[str]  ):
														lowerCamelCase__      :			Union[str, Any] 						= self.prepare_config_and_inputs()
														lowerCamelCase__      :			str 						= config_and_inputs

														lowerCamelCase__      :			int 						= True
														lowerCamelCase__      :			Optional[int] 						= floats_tensor([self.batch_size, self.seq_length, self.hidden_size]  )
														lowerCamelCase__      :			str 						= ids_tensor([self.batch_size, self.seq_length]    ,							vocab_size=2  )

														return (
														    config,
														    input_ids,
														    token_type_ids,
														    encoder_hidden_states,
														    encoder_attention_mask,
														)



@require_flax
# Copied from tests.models.roberta.test_modelling_flax_roberta.FlaxRobertaPreLayerNormModelTest with ROBERTA->ROBERTA_PRELAYERNORM,Roberta->RobertaPreLayerNorm,roberta-base->andreasmadsen/efficient_mlm_m0.40
class _lowercase			(       _lowercase       ,   unittest.TestCase	):

							'''simple docstring'''





							a          = True

							a          = (
							    (
							        FlaxRobertaPreLayerNormModel,
							        FlaxRobertaPreLayerNormForCausalLM,
							        FlaxRobertaPreLayerNormForMaskedLM,
							        FlaxRobertaPreLayerNormForSequenceClassification,
							        FlaxRobertaPreLayerNormForTokenClassification,
							        FlaxRobertaPreLayerNormForMultipleChoice,
							        FlaxRobertaPreLayerNormForQuestionAnswering,
							    )
							    if is_flax_available()
							    else ()
							)




							def 	lowerCamelCase_       (							self:       Optional[Any]  ):
														lowerCamelCase__      :			List[Any] 						= FlaxRobertaPreLayerNormModelTester(self  )




							@slow
							def 	lowerCamelCase_       (							self:       str  ):
														for model_class_name in self.all_model_classes:
																					lowerCamelCase__      :			int 						= model_class_name.from_pretrained("""andreasmadsen/efficient_mlm_m0.40"""    ,							from_pt=UpperCamelCase__  )
																					lowerCamelCase__      :			List[Any] 						= model(np.ones((1, 1)  )  )
																					self.assertIsNotNone(UpperCamelCase__  )



@require_flax
class _lowercase			(       unittest.TestCase	):

							'''simple docstring'''





							@slow
							def 	lowerCamelCase_       (							self:       str  ):
														lowerCamelCase__      :			List[Any] 						= FlaxRobertaPreLayerNormForMaskedLM.from_pretrained("""andreasmadsen/efficient_mlm_m0.40"""    ,							from_pt=UpperCamelCase__  )

														lowerCamelCase__      :			Union[str, Any] 						= np.array([[0, 31_414, 232, 328, 740, 1_140, 12_695, 69, 46_078, 1_588, 2]]    ,							dtype=jnp.intaa  )
														lowerCamelCase__      :			Optional[Any] 						= model(UpperCamelCase__  )[0]
														lowerCamelCase__      :			Dict 						= [1, 11, 50_265]
														self.assertEqual(list(output.shape  )    ,							UpperCamelCase__  )
														# compare the actual values for a slice.
														lowerCamelCase__      :			Union[str, Any] 						= np.array(
														    [[[40.4_880, 18.0_199, -5.2_367], [-1.8_877, -4.0_885, 10.7_085], [-2.2_613, -5.6_110, 7.2_665]]]    ,							dtype=np.floataa  )
														self.assertTrue(np.allclose(output[:, :3, :3]    ,							UpperCamelCase__    ,							atol=1e-4  )  )




							@slow
							def 	lowerCamelCase_       (							self:       str  ):
														lowerCamelCase__      :			Optional[int] 						= FlaxRobertaPreLayerNormModel.from_pretrained("""andreasmadsen/efficient_mlm_m0.40"""    ,							from_pt=UpperCamelCase__  )

														lowerCamelCase__      :			Any 						= np.array([[0, 31_414, 232, 328, 740, 1_140, 12_695, 69, 46_078, 1_588, 2]]    ,							dtype=jnp.intaa  )
														lowerCamelCase__      :			List[str] 						= model(UpperCamelCase__  )[0]
														# compare the actual values for a slice.
														lowerCamelCase__      :			Optional[int] 						= np.array(
														    [[[0.0_208, -0.0_356, 0.0_237], [-0.1_569, -0.0_411, -0.2_626], [0.1_879, 0.0_125, -0.0_089]]]    ,							dtype=np.floataa  )
														self.assertTrue(np.allclose(output[:, :3, :3]    ,							UpperCamelCase__    ,							atol=1e-4  )  )









'''simple docstring'''







import sys
import turtle





def 				SCREAMING_SNAKE_CASE_ (UpperCamelCase       ,    UpperCamelCase   )   -> tuple[float, float]:
							return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2





def 				SCREAMING_SNAKE_CASE_ (UpperCamelCase       ,    UpperCamelCase       ,    UpperCamelCase       ,    UpperCamelCase       ,    )   -> None:
							my_pen.up()
							my_pen.goto(vertexa[0]       ,    vertexa[1]   )
							my_pen.down()
							my_pen.goto(vertexa[0]       ,    vertexa[1]   )
							my_pen.goto(vertexa[0]       ,    vertexa[1]   )
							my_pen.goto(vertexa[0]       ,    vertexa[1]   )

							if depth == 0:
														return

							triangle(UpperCamelCase       ,    get_mid(UpperCamelCase       ,    UpperCamelCase   )       ,    get_mid(UpperCamelCase       ,    UpperCamelCase   )       ,    depth - 1   )
							triangle(UpperCamelCase       ,    get_mid(UpperCamelCase       ,    UpperCamelCase   )       ,    get_mid(UpperCamelCase       ,    UpperCamelCase   )       ,    depth - 1   )
							triangle(UpperCamelCase       ,    get_mid(UpperCamelCase       ,    UpperCamelCase   )       ,    get_mid(UpperCamelCase       ,    UpperCamelCase   )       ,    depth - 1   )


if __name__ == "__main__":
			if len(sys.argv) != 2:
						raise ValueError(
						    '''Correct format for using this script: '''
						    '''python fractals.py <int:depth_for_fractal>'''
						)
			_A			:    Any					  =turtle.Turtle()
			my_pen.ht()
			my_pen.speed(5)
			my_pen.pencolor('''red''')

			_A			:    Dict					  =[(-175, -125), (0, 175), (175, -125)]  # vertices of triangle
			triangle(vertices[0], vertices[1], vertices[2], int(sys.argv[1]))

