



'''simple docstring'''
import unittest

from parameterized import parameterized

from transformers import OpenLlamaConfig, is_torch_available, set_seed
from transformers.testing_utils import require_torch, torch_device

from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
					import torch

					from transformers import OpenLlamaForCausalLM, OpenLlamaForSequenceClassification, OpenLlamaModel






class 							lowercase__	:





	def __init__( self					:				Tuple ,lowerCamelCase__					:				Optional[Any] ,lowerCamelCase__					:				Tuple=13 ,lowerCamelCase__					:				Any=7 ,lowerCamelCase__					:				Optional[Any]=True ,lowerCamelCase__					:				List[Any]=True ,lowerCamelCase__					:				Optional[int]=False ,lowerCamelCase__					:				List[Any]=True ,lowerCamelCase__					:				List[Any]=99 ,lowerCamelCase__					:				Dict=32 ,lowerCamelCase__					:				Tuple=5 ,lowerCamelCase__					:				str=4 ,lowerCamelCase__					:				List[str]=37 ,lowerCamelCase__					:				int="gelu" ,lowerCamelCase__					:				List[Any]=0.1 ,lowerCamelCase__					:				Union[str, Any]=0.1 ,lowerCamelCase__					:				Union[str, Any]=512 ,lowerCamelCase__					:				Optional[Any]=16 ,lowerCamelCase__					:				List[Any]=2 ,lowerCamelCase__					:				str=0.0_2 ,lowerCamelCase__					:				str=3 ,lowerCamelCase__					:				Union[str, Any]=4 ,lowerCamelCase__					:				List[str]=None ,):







							'''simple docstring'''
							_UpperCamelCase					:		int 				=   parent
							_UpperCamelCase					:		Tuple 				=   batch_size
							_UpperCamelCase					:		Optional[Any] 				=   seq_length
							_UpperCamelCase					:		Any 				=   is_training
							_UpperCamelCase					:		Union[str, Any] 				=   use_input_mask
							_UpperCamelCase					:		Optional[int] 				=   use_token_type_ids
							_UpperCamelCase					:		str 				=   use_labels
							_UpperCamelCase					:		Dict 				=   vocab_size
							_UpperCamelCase					:		Any 				=   hidden_size
							_UpperCamelCase					:		Dict 				=   num_hidden_layers
							_UpperCamelCase					:		List[str] 				=   num_attention_heads
							_UpperCamelCase					:		Optional[int] 				=   intermediate_size
							_UpperCamelCase					:		Optional[int] 				=   hidden_act
							_UpperCamelCase					:		Optional[int] 				=   hidden_dropout_prob
							_UpperCamelCase					:		Tuple 				=   attention_probs_dropout_prob
							_UpperCamelCase					:		Tuple 				=   max_position_embeddings
							_UpperCamelCase					:		Tuple 				=   type_vocab_size
							_UpperCamelCase					:		Optional[Any] 				=   type_sequence_label_size
							_UpperCamelCase					:		Tuple 				=   initializer_range
							_UpperCamelCase					:		str 				=   num_labels
							_UpperCamelCase					:		Optional[int] 				=   num_choices
							_UpperCamelCase					:		Dict 				=   scope





	def 	UpperCamelCase_  ( self					:				Union[str, Any] ):







							'''simple docstring'''
							_UpperCamelCase					:		str 				=   ids_tensor([self.batch_size, self.seq_length] ,self.vocab_size )

							_UpperCamelCase					:		List[Any] 				=   None
							if self.use_input_mask:
													_UpperCamelCase					:		int 				=   random_attention_mask([self.batch_size, self.seq_length] )

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

							_UpperCamelCase					:		Optional[Any] 				=   None
							_UpperCamelCase					:		Any 				=   None
							_UpperCamelCase					:		Optional[Any] 				=   None
							if self.use_labels:
													_UpperCamelCase					:		Optional[Any] 				=   ids_tensor([self.batch_size] ,self.type_sequence_label_size )
													_UpperCamelCase					:		str 				=   ids_tensor([self.batch_size, self.seq_length] ,self.num_labels )
													_UpperCamelCase					:		int 				=   ids_tensor([self.batch_size] ,self.num_choices )

							_UpperCamelCase					:		str 				=   self.get_config()

							return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels





	def 	UpperCamelCase_  ( self					:				Optional[int] ):







							'''simple docstring'''
							return OpenLlamaConfig(
							    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 ,use_stable_embedding=UpperCamelCase__ ,)





	def 	UpperCamelCase_  ( self					:				Tuple ,lowerCamelCase__					:				Optional[Any] ,lowerCamelCase__					:				int ,lowerCamelCase__					:				str ,lowerCamelCase__					:				List[str] ,lowerCamelCase__					:				Union[str, Any] ,lowerCamelCase__					:				List[str] ,lowerCamelCase__					:				Optional[Any] ):







							'''simple docstring'''
							_UpperCamelCase					:		Dict 				=   OpenLlamaModel(config=UpperCamelCase__ )
							model.to(UpperCamelCase__ )
							model.eval()
							_UpperCamelCase					:		Dict 				=   model(UpperCamelCase__ ,attention_mask=UpperCamelCase__ )
							_UpperCamelCase					:		Tuple 				=   model(UpperCamelCase__ )
							self.parent.assertEqual(result.last_hidden_state.shape ,(self.batch_size, self.seq_length, self.hidden_size) )





	def 	UpperCamelCase_  ( self					:				List[Any] ,lowerCamelCase__					:				str ,lowerCamelCase__					:				List[str] ,lowerCamelCase__					:				Any ,lowerCamelCase__					:				List[str] ,lowerCamelCase__					:				List[Any] ,lowerCamelCase__					:				Tuple ,lowerCamelCase__					:				List[Any] ,lowerCamelCase__					:				List[str] ,lowerCamelCase__					:				Union[str, Any] ,):







							'''simple docstring'''
							_UpperCamelCase					:		Union[str, Any] 				=   True
							_UpperCamelCase					:		List[Any] 				=   OpenLlamaModel(UpperCamelCase__ )
							model.to(UpperCamelCase__ )
							model.eval()
							_UpperCamelCase					:		Optional[int] 				=   model(
							    UpperCamelCase__ ,attention_mask=UpperCamelCase__ ,encoder_hidden_states=UpperCamelCase__ ,encoder_attention_mask=UpperCamelCase__ ,)
							_UpperCamelCase					:		Union[str, Any] 				=   model(
							    UpperCamelCase__ ,attention_mask=UpperCamelCase__ ,encoder_hidden_states=UpperCamelCase__ ,)
							_UpperCamelCase					:		List[str] 				=   model(UpperCamelCase__ ,attention_mask=UpperCamelCase__ )
							self.parent.assertEqual(result.last_hidden_state.shape ,(self.batch_size, self.seq_length, self.hidden_size) )





	def 	UpperCamelCase_  ( self					:				List[Any] ,lowerCamelCase__					:				List[Any] ,lowerCamelCase__					:				Any ,lowerCamelCase__					:				Optional[Any] ,lowerCamelCase__					:				Union[str, Any] ,lowerCamelCase__					:				Optional[Any] ,lowerCamelCase__					:				Optional[Any] ,lowerCamelCase__					:				Any ,lowerCamelCase__					:				str ,lowerCamelCase__					:				List[str] ,):







							'''simple docstring'''
							_UpperCamelCase					:		str 				=   OpenLlamaForCausalLM(config=UpperCamelCase__ )
							model.to(UpperCamelCase__ )
							model.eval()
							_UpperCamelCase					:		Any 				=   model(UpperCamelCase__ ,attention_mask=UpperCamelCase__ ,labels=UpperCamelCase__ )
							self.parent.assertEqual(result.logits.shape ,(self.batch_size, self.seq_length, self.vocab_size) )





	def 	UpperCamelCase_  ( self					:				int ,lowerCamelCase__					:				Optional[Any] ,lowerCamelCase__					:				List[str] ,lowerCamelCase__					:				List[Any] ,lowerCamelCase__					:				Tuple ,lowerCamelCase__					:				List[str] ,lowerCamelCase__					:				Optional[Any] ,lowerCamelCase__					:				Union[str, Any] ,lowerCamelCase__					:				List[Any] ,lowerCamelCase__					:				List[str] ,):







							'''simple docstring'''
							_UpperCamelCase					:		Tuple 				=   True
							_UpperCamelCase					:		List[Any] 				=   True
							_UpperCamelCase					:		Optional[Any] 				=   OpenLlamaForCausalLM(config=UpperCamelCase__ )
							model.to(UpperCamelCase__ )
							model.eval()

							# first forward pass
							_UpperCamelCase					:		Union[str, Any] 				=   model(
							    UpperCamelCase__ ,attention_mask=UpperCamelCase__ ,encoder_hidden_states=UpperCamelCase__ ,encoder_attention_mask=UpperCamelCase__ ,use_cache=UpperCamelCase__ ,)
							_UpperCamelCase					:		Tuple 				=   outputs.past_key_values

							# create hypothetical multiple next token and extent to next_input_ids
							_UpperCamelCase					:		Any 				=   ids_tensor((self.batch_size, 3) ,config.vocab_size )
							_UpperCamelCase					:		Dict 				=   ids_tensor((self.batch_size, 3) ,vocab_size=2 )

							# append to next input_ids and
							_UpperCamelCase					:		int 				=   torch.cat([input_ids, next_tokens] ,dim=-1 )
							_UpperCamelCase					:		List[str] 				=   torch.cat([input_mask, next_mask] ,dim=-1 )

							_UpperCamelCase					:		List[Any] 				=   model(
							    UpperCamelCase__ ,attention_mask=UpperCamelCase__ ,encoder_hidden_states=UpperCamelCase__ ,encoder_attention_mask=UpperCamelCase__ ,output_hidden_states=UpperCamelCase__ ,)['hidden_states'][0]
							_UpperCamelCase					:		Optional[int] 				=   model(
							    UpperCamelCase__ ,attention_mask=UpperCamelCase__ ,encoder_hidden_states=UpperCamelCase__ ,encoder_attention_mask=UpperCamelCase__ ,past_key_values=UpperCamelCase__ ,output_hidden_states=UpperCamelCase__ ,)['hidden_states'][0]

							# select random slice
							_UpperCamelCase					:		Any 				=   ids_tensor((1,) ,output_from_past.shape[-1] ).item()
							_UpperCamelCase					:		Optional[Any] 				=   output_from_no_past[:, -3:, random_slice_idx].detach()
							_UpperCamelCase					:		Optional[int] 				=   output_from_past[:, :, random_slice_idx].detach()

							self.parent.assertTrue(output_from_past_slice.shape[1] == next_tokens.shape[1] )

							# test that outputs are equal for slice
							self.parent.assertTrue(torch.allclose(UpperCamelCase__ ,UpperCamelCase__ ,atol=1E-3 ) )





	def 	UpperCamelCase_  ( self					:				Any ):







							'''simple docstring'''
							_UpperCamelCase					:		List[str] 				=   self.prepare_config_and_inputs()
							(
							    (
							    _UpperCamelCase      
							)				,			(
							    _UpperCamelCase      
							)				,			(
							    _UpperCamelCase      
							)				,			(
							    _UpperCamelCase      
							)				,			(
							    _UpperCamelCase      
							)				,			(
							    _UpperCamelCase      
							)				,			(
							    _UpperCamelCase      
							)				,			      
							)					:		int 				=   config_and_inputs
							_UpperCamelCase					:		List[Any] 				=   {'input_ids': input_ids, 'attention_mask': input_mask}
							return config, inputs_dict






@require_torch
class 							lowercase__	(							_a						,					_a						,					_a						,					unittest.TestCase   ):
	lowercase__  				=			(
	    (OpenLlamaModel, OpenLlamaForCausalLM, OpenLlamaForSequenceClassification) if is_torch_available() else ()
	)
	lowercase__  				=			(OpenLlamaForCausalLM,) if is_torch_available() else ()
	lowercase__  				=			(
	    {
	        """feature-extraction""": OpenLlamaModel,
	        """text-classification""": OpenLlamaForSequenceClassification,
	        """text-generation""": OpenLlamaForCausalLM,
	        """zero-shot""": OpenLlamaForSequenceClassification,
	    }
	    if is_torch_available()
	    else {}
	)
	lowercase__  				=			False
	lowercase__  				=			False





	def 	UpperCamelCase_  ( self					:				str ):







							'''simple docstring'''
							_UpperCamelCase					:		Any 				=   OpenLlamaModelTester(self )
							_UpperCamelCase					:		Dict 				=   ConfigTester(self ,config_class=UpperCamelCase__ ,hidden_size=37 )





	def 	UpperCamelCase_  ( self					:				int ):







							'''simple docstring'''
							self.config_tester.run_common_tests()





	def 	UpperCamelCase_  ( self					:				Dict ):







							'''simple docstring'''
							_UpperCamelCase					:		str 				=   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_model(*UpperCamelCase__ )





	def 	UpperCamelCase_  ( self					:				Optional[Any] ):







							'''simple docstring'''
							_UpperCamelCase					:		List[str] 				=   self.model_tester.prepare_config_and_inputs()
							for type in ["absolute", "relative_key", "relative_key_query"]:
													_UpperCamelCase					:		Dict 				=   type
													self.model_tester.create_and_check_model(*UpperCamelCase__ )





	def 	UpperCamelCase_  ( self					:				int ):







							'''simple docstring'''
							_UpperCamelCase				,			_UpperCamelCase					:		Any 				=   self.model_tester.prepare_config_and_inputs_for_common()
							_UpperCamelCase					:		Optional[Any] 				=   3
							_UpperCamelCase					:		str 				=   input_dict['input_ids']
							_UpperCamelCase					:		Union[str, Any] 				=   input_ids.ne(1 ).to(UpperCamelCase__ )
							_UpperCamelCase					:		List[Any] 				=   ids_tensor([self.model_tester.batch_size] ,self.model_tester.type_sequence_label_size )
							_UpperCamelCase					:		Any 				=   OpenLlamaForSequenceClassification(UpperCamelCase__ )
							model.to(UpperCamelCase__ )
							model.eval()
							_UpperCamelCase					:		Optional[Any] 				=   model(UpperCamelCase__ ,attention_mask=UpperCamelCase__ ,labels=UpperCamelCase__ )
							self.assertEqual(result.logits.shape ,(self.model_tester.batch_size, self.model_tester.num_labels) )





	def 	UpperCamelCase_  ( self					:				List[Any] ):







							'''simple docstring'''
							_UpperCamelCase				,			_UpperCamelCase					:		Union[str, Any] 				=   self.model_tester.prepare_config_and_inputs_for_common()
							_UpperCamelCase					:		List[str] 				=   3
							_UpperCamelCase					:		List[Any] 				=   'single_label_classification'
							_UpperCamelCase					:		str 				=   input_dict['input_ids']
							_UpperCamelCase					:		int 				=   input_ids.ne(1 ).to(UpperCamelCase__ )
							_UpperCamelCase					:		Optional[Any] 				=   ids_tensor([self.model_tester.batch_size] ,self.model_tester.type_sequence_label_size )
							_UpperCamelCase					:		List[str] 				=   OpenLlamaForSequenceClassification(UpperCamelCase__ )
							model.to(UpperCamelCase__ )
							model.eval()
							_UpperCamelCase					:		Optional[Any] 				=   model(UpperCamelCase__ ,attention_mask=UpperCamelCase__ ,labels=UpperCamelCase__ )
							self.assertEqual(result.logits.shape ,(self.model_tester.batch_size, self.model_tester.num_labels) )





	def 	UpperCamelCase_  ( self					:				Optional[int] ):







							'''simple docstring'''
							_UpperCamelCase				,			_UpperCamelCase					:		Any 				=   self.model_tester.prepare_config_and_inputs_for_common()
							_UpperCamelCase					:		Any 				=   3
							_UpperCamelCase					:		Union[str, Any] 				=   'multi_label_classification'
							_UpperCamelCase					:		List[str] 				=   input_dict['input_ids']
							_UpperCamelCase					:		Any 				=   input_ids.ne(1 ).to(UpperCamelCase__ )
							_UpperCamelCase					:		Union[str, Any] 				=   ids_tensor(
							    [self.model_tester.batch_size, config.num_labels] ,self.model_tester.type_sequence_label_size ).to(torch.float )
							_UpperCamelCase					:		Any 				=   OpenLlamaForSequenceClassification(UpperCamelCase__ )
							model.to(UpperCamelCase__ )
							model.eval()
							_UpperCamelCase					:		Any 				=   model(UpperCamelCase__ ,attention_mask=UpperCamelCase__ ,labels=UpperCamelCase__ )
							self.assertEqual(result.logits.shape ,(self.model_tester.batch_size, self.model_tester.num_labels) )





	@unittest.skip('Open-Llama buffers include complex numbers, which breaks this test' )
	def 	UpperCamelCase_  ( self					:				Tuple ):







							'''simple docstring'''
							pass





	@parameterized.expand([('linear',), ('dynamic',)] )
	def 	UpperCamelCase_  ( self					:				Union[str, Any] ,lowerCamelCase__					:				Any ):







							'''simple docstring'''
							_UpperCamelCase				,			_UpperCamelCase					:		List[str] 				=   self.model_tester.prepare_config_and_inputs_for_common()
							_UpperCamelCase					:		Optional[int] 				=   ids_tensor([1, 10] ,config.vocab_size )
							_UpperCamelCase					:		List[str] 				=   ids_tensor([1, int(config.max_position_embeddings * 1.5 )] ,config.vocab_size )

							set_seed(42 )  # Fixed seed at init time so the two models get the same random weights
							_UpperCamelCase					:		Tuple 				=   OpenLlamaModel(UpperCamelCase__ )
							original_model.to(UpperCamelCase__ )
							original_model.eval()
							_UpperCamelCase					:		List[str] 				=   original_model(UpperCamelCase__ ).last_hidden_state
							_UpperCamelCase					:		List[str] 				=   original_model(UpperCamelCase__ ).last_hidden_state

							set_seed(42 )  # Fixed seed at init time so the two models get the same random weights
							_UpperCamelCase					:		Optional[Any] 				=   {'type': scaling_type, 'factor': 10.0}
							_UpperCamelCase					:		List[Any] 				=   OpenLlamaModel(UpperCamelCase__ )
							scaled_model.to(UpperCamelCase__ )
							scaled_model.eval()
							_UpperCamelCase					:		Optional[Any] 				=   scaled_model(UpperCamelCase__ ).last_hidden_state
							_UpperCamelCase					:		Any 				=   scaled_model(UpperCamelCase__ ).last_hidden_state

							# Dynamic scaling does not change the RoPE embeddings until it receives an input longer than the original
							# maximum sequence length, so the outputs for the short input should match.
							if scaling_type == "dynamic":
													self.assertTrue(torch.allclose(UpperCamelCase__ ,UpperCamelCase__ ,atol=1E-5 ) )
							else:
													self.assertFalse(torch.allclose(UpperCamelCase__ ,UpperCamelCase__ ,atol=1E-5 ) )

							# The output should be different for long inputs
							self.assertFalse(torch.allclose(UpperCamelCase__ ,UpperCamelCase__ ,atol=1E-5 ) )







'''simple docstring'''


import json
import os
import tempfile

import datasets
from utils import generate_example_dataset, get_duration


_lowerCamelCase	:       List[str]      	=	5_0000
_lowerCamelCase	:       Optional[int]      	=	5000

_lowerCamelCase	,_lowerCamelCase	:       int      	=	os.path.split(__file__)
_lowerCamelCase	:       str      	=	os.path.join(RESULTS_BASEPATH, "results", RESULTS_FILENAME.replace(".py", ".json"))







@get_duration
def 				__lowerCamelCase				(   A__    ,						A__    )       ->	Any:






   """simple docstring"""
   for i in range(A__    ):
      UpperCamelCase					=  dataset[i]







@get_duration
def 				__lowerCamelCase				(   A__    ,						A__    ,						A__    )       ->	int:






   """simple docstring"""
   for i in range(0    ,						len(A__    )    ,						A__    ):
      UpperCamelCase					=  dataset[i : i + batch_size]







@get_duration
def 				__lowerCamelCase				(   A__    ,						A__    ,						A__    )       ->	List[Any]:






   """simple docstring"""
   with dataset.formatted_as(type=A__    ):
      for i in range(A__    ):
         UpperCamelCase					=  dataset[i]







@get_duration
def 				__lowerCamelCase				(   A__    ,						A__    ,						A__    ,						A__    )       ->	int:






   """simple docstring"""
   with dataset.formatted_as(type=A__    ):
      for i in range(0    ,						A__    ,						A__    ):
         UpperCamelCase					=  dataset[i : i + batch_size]







def 				__lowerCamelCase				(   )       ->	List[str]:






   """simple docstring"""
   UpperCamelCase					=  {'num examples': SPEED_TEST_N_EXAMPLES}
   UpperCamelCase					=  [
       (read, {'length': SMALL_TEST}),
       (read, {'length': SPEED_TEST_N_EXAMPLES}),
       (read_batch, {'length': SPEED_TEST_N_EXAMPLES, 'batch_size': 10}),
       (read_batch, {'length': SPEED_TEST_N_EXAMPLES, 'batch_size': 100}),
       (read_batch, {'length': SPEED_TEST_N_EXAMPLES, 'batch_size': 1_000}),
       (read_formatted, {'type': 'numpy', 'length': SMALL_TEST}),
       (read_formatted, {'type': 'pandas', 'length': SMALL_TEST}),
       (read_formatted, {'type': 'torch', 'length': SMALL_TEST}),
       (read_formatted, {'type': 'tensorflow', 'length': SMALL_TEST}),
       (read_formatted_batch, {'type': 'numpy', 'length': SMALL_TEST, 'batch_size': 10}),
       (read_formatted_batch, {'type': 'numpy', 'length': SMALL_TEST, 'batch_size': 1_000}),
   ]

   UpperCamelCase					=  [
       (read, {'length': SMALL_TEST}),
       (read, {'length': SPEED_TEST_N_EXAMPLES}),
       (read_batch, {'length': SPEED_TEST_N_EXAMPLES, 'batch_size': 10}),
       (read_batch, {'length': SPEED_TEST_N_EXAMPLES, 'batch_size': 100}),
       (read_batch, {'length': SPEED_TEST_N_EXAMPLES, 'batch_size': 1_000}),
       (read_formatted, {'type': 'numpy', 'length': SMALL_TEST}),
       (read_formatted_batch, {'type': 'numpy', 'length': SMALL_TEST, 'batch_size': 10}),
       (read_formatted_batch, {'type': 'numpy', 'length': SMALL_TEST, 'batch_size': 1_000}),
   ]
   with tempfile.TemporaryDirectory() as tmp_dir:
      print('generating dataset'    )
      UpperCamelCase					=  datasets.Features(
          {'list': datasets.Sequence(datasets.Value('float32'    )    ), 'numbers': datasets.Value('float32'    )}    )
      UpperCamelCase					=  generate_example_dataset(
          os.path.join(A__    ,						'dataset.arrow'    )    ,						A__    ,						num_examples=A__    ,						seq_shapes={'list': (100,)}    ,						)
      print('first set of iterations'    )
      for func, kwargs in functions:
         print(func.__name__    ,						str(A__    )    )
         UpperCamelCase					=  func(A__    ,						**A__    )

      print('shuffling dataset'    )
      UpperCamelCase					=  dataset.shuffle()
      print('Second set of iterations (after shuffling'    )
      for func, kwargs in functions_shuffled:
         print('shuffled '    ,						func.__name__    ,						str(A__    )    )
         UpperCamelCase					=  func(
             A__    ,						**A__    )

   with open(A__    ,						'wb'    ) as f:
      f.write(json.dumps(A__    ).encode('utf-8'    )    )


if __name__ == "__main__":  # useful to run the profiler
   benchmark_iterating()

