



from copy import deepcopy

import torch
import torch.nn.functional as F
from torch.optim import AdamW
from torch.optim.lr_scheduler import LambdaLR
from torch.utils.data import DataLoader

from accelerate.accelerator import Accelerator
from accelerate.state import GradientState
from accelerate.test_utils import RegressionDataset, RegressionModel
from accelerate.utils import DistributedType, is_torch_version, set_seed






def 	lowerCAmelCase__		(    lowerCamelCase_		:		int       ,lowerCamelCase_		:		Union[str, Any]       ,lowerCamelCase_		:		Union[str, Any]       ,lowerCamelCase_		:		Tuple):





				'''simple docstring'''

				for param, grad_param in zip(model_a.parameters()       ,model_b.parameters()):
								if not param.requires_grad:
												continue
								if not did_step:
												# Grads should not be in sync
												assert (
												    torch.allclose(param.grad       ,grad_param.grad) is False
												), f"""Gradients in sync when they should not be at iteration {iteration}:\nmodel_a grad ({param.grad}) == model_b grad ({grad_param.grad})"""
								else:
												# Grads should be in sync
												assert (
												    torch.allclose(param.grad       ,grad_param.grad) is True
												), f"""Gradients not in sync when they should be at iteration {iteration}:\nmodel_a grad ({param.grad}) != model_b grad ({grad_param.grad})"""






def 	lowerCAmelCase__		(    lowerCamelCase_		:		Dict       ,lowerCamelCase_		:		List[Any]       ,lowerCamelCase_		:		int       ,lowerCamelCase_		:		Tuple       ,lowerCamelCase_		:		int=True):





				'''simple docstring'''

				model.train()
				lowerCAmelCase__     :				Tuple												=     model(lowerCamelCase_)
				lowerCAmelCase__     :				Optional[int]												=     F.mse_loss(lowerCamelCase_       ,target.to(output.device))
				if not do_backward:
								loss /= accelerator.gradient_accumulation_steps
								loss.backward()
				else:
								accelerator.backward(lowerCamelCase_)






def 	lowerCAmelCase__		(    lowerCamelCase_		:		int       ,lowerCamelCase_		:		Optional[Any]=False):





				'''simple docstring'''

				set_seed(42)
				lowerCAmelCase__     :				List[Any]												=     RegressionModel()
				lowerCAmelCase__     :				Dict												=     deepcopy(lowerCamelCase_)
				lowerCAmelCase__     :				Optional[int]												=     RegressionDataset(length=80)
				lowerCAmelCase__     :				Optional[int]												=     DataLoader(lowerCamelCase_       ,batch_size=16)
				model.to(accelerator.device)
				if sched:
								lowerCAmelCase__     :				Tuple												=     AdamW(params=model.parameters()       ,lr=1E-3)
								lowerCAmelCase__     :				Tuple												=     AdamW(params=ddp_model.parameters()       ,lr=1E-3)
								lowerCAmelCase__     :				Any												=     LambdaLR(lowerCamelCase_       ,lr_lambda=lambda lowerCamelCase_: epoch**0.65)
								lowerCAmelCase__     :				Any												=     LambdaLR(lowerCamelCase_       ,lr_lambda=lambda lowerCamelCase_: epoch**0.65)
				# Make a copy of `model`
				if sched:
								lowerCAmelCase__						,		lowerCAmelCase__						,		lowerCAmelCase__						,		lowerCAmelCase__     :				Any												=     accelerator.prepare(lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_)
				else:
								lowerCAmelCase__						,		lowerCAmelCase__     :				Tuple												=     accelerator.prepare(lowerCamelCase_       ,lowerCamelCase_)
				if sched:
								return (model, opt, sched, dataloader, ddp_model, ddp_opt, ddp_sched)
				return model, ddp_model, dataloader






def 	lowerCAmelCase__		(    lowerCamelCase_		:		Dict):





				'''simple docstring'''

				lowerCAmelCase__						,		lowerCAmelCase__						,		lowerCAmelCase__     :				Tuple												=     get_training_setup(lowerCamelCase_)
				# Use a single batch
				lowerCAmelCase__						,		lowerCAmelCase__     :				Any												=     next(iter(lowerCamelCase_)).values()
				for iteration in range(3):
								# Gather the distributed inputs and targs for the base model
								lowerCAmelCase__						,		lowerCAmelCase__     :				Any												=     accelerator.gather((ddp_input, ddp_target))
								lowerCAmelCase__						,		lowerCAmelCase__     :				Dict												=     input.to(accelerator.device), target.to(accelerator.device)
								# Perform our initial ground truth step in non "DDP"
								step_model(lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_)
								# Do "gradient accumulation" (noop)
								if iteration % 2 == 0:
												# Accumulate grads locally
												with accelerator.no_sync(lowerCamelCase_):
																step_model(lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_)
								else:
												# Sync grads
												step_model(lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_)

								# Since `no_sync` is a noop, `ddp_model` and `model` grads should always be in sync
								check_model_parameters(lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_)
								for param, ddp_param in zip(model.parameters()       ,ddp_model.parameters()):
												if not param.requires_grad:
																continue
												assert torch.allclose(
												    param.grad       ,ddp_param.grad), f"""Gradients not in sync when they should be:\nModel grad ({param.grad}) != DDP grad ({ddp_param.grad})"""

								# Shuffle ddp_input on each iteration
								torch.manual_seed(1337 + iteration)
								lowerCAmelCase__     :				Tuple												=     ddp_input[torch.randperm(len(lowerCamelCase_))]






def 	lowerCAmelCase__		(    lowerCamelCase_		:		Union[str, Any]):





				'''simple docstring'''

				lowerCAmelCase__						,		lowerCAmelCase__						,		lowerCAmelCase__     :				Dict												=     get_training_setup(lowerCamelCase_)
				# Use a single batch
				lowerCAmelCase__						,		lowerCAmelCase__     :				Union[str, Any]												=     next(iter(lowerCamelCase_)).values()
				for iteration in range(3):
								# Gather the distributed inputs and targs for the base model
								lowerCAmelCase__						,		lowerCAmelCase__     :				str												=     accelerator.gather((ddp_input, ddp_target))
								lowerCAmelCase__						,		lowerCAmelCase__     :				List[str]												=     input.to(accelerator.device), target.to(accelerator.device)
								# Perform our initial ground truth step in non "DDP"
								step_model(lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_)
								# Do "gradient accumulation" (noop)
								if iteration % 2 == 0:
												# Accumulate grads locally
												with accelerator.no_sync(lowerCamelCase_):
																step_model(lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_)
								else:
												# Sync grads
												step_model(lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_)

								# DDP model and model should only be in sync when not (iteration % 2 == 0)
								for param, ddp_param in zip(model.parameters()       ,ddp_model.parameters()):
												if not param.requires_grad:
																continue
												if iteration % 2 == 0:
																# Grads should not be in sync
																assert (
																    torch.allclose(param.grad       ,ddp_param.grad) is False
																), f"""Gradients in sync when they should not be:\nModel grad ({param.grad}) == DDP grad ({ddp_param.grad})"""
												else:
																# Grads should be in sync
																assert (
																    torch.allclose(param.grad       ,ddp_param.grad) is True
																), f"""Gradients not in sync when they should be:\nModel grad ({param.grad}) != DDP grad ({ddp_param.grad})"""

        # Shuffle ddp_input on each iteration
								torch.manual_seed(1337 + iteration)
								lowerCAmelCase__     :				Tuple												=     ddp_input[torch.randperm(len(lowerCamelCase_))]






def 	lowerCAmelCase__		(    lowerCamelCase_		:		Tuple=False       ,lowerCamelCase_		:		Optional[int]=False):





				'''simple docstring'''

				lowerCAmelCase__     :				Dict												=     Accelerator(
				    split_batches=lowerCamelCase_       ,dispatch_batches=lowerCamelCase_       ,gradient_accumulation_steps=2)
				# Test that context manager behaves properly
				lowerCAmelCase__						,		lowerCAmelCase__						,		lowerCAmelCase__     :				Union[str, Any]												=     get_training_setup(lowerCamelCase_)
				for iteration, batch in enumerate(lowerCamelCase_):
								lowerCAmelCase__						,		lowerCAmelCase__     :				Optional[int]												=     batch.values()
								# Gather the distributed inputs and targs for the base model
								lowerCAmelCase__						,		lowerCAmelCase__     :				Union[str, Any]												=     accelerator.gather((ddp_input, ddp_target))
								lowerCAmelCase__						,		lowerCAmelCase__     :				Dict												=     input.to(accelerator.device), target.to(accelerator.device)
								# Perform our initial ground truth step in non "DDP"
								step_model(lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_)
								# Do "gradient accumulation" (noop)
								with accelerator.accumulate(lowerCamelCase_):
												step_model(lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_)

								# DDP model and model should only be in sync when not (iteration % 2 == 0)
								for param, ddp_param in zip(model.parameters()       ,ddp_model.parameters()):
												if not param.requires_grad:
																continue
												if ((iteration + 1) % 2 == 0) or (iteration == len(lowerCamelCase_) - 1):
																# Grads should be in sync
																assert (
																    torch.allclose(param.grad       ,ddp_param.grad) is True
																), f"""Gradients not in sync when they should be at iteration {iteration}:\nModel grad ({param.grad}) != DDP grad ({ddp_param.grad})"""
												else:
																# Grads should not be in sync
																assert (
																    torch.allclose(param.grad       ,ddp_param.grad) is False
																), f"""Gradients in sync when they should not be at iteration {iteration}:\nModel grad ({param.grad}) == DDP grad ({ddp_param.grad})"""

        # Shuffle ddp_input on each iteration
								torch.manual_seed(1337 + iteration)
								lowerCAmelCase__     :				Dict												=     ddp_input[torch.randperm(len(lowerCamelCase_))]
				GradientState._reset_state()






def 	lowerCAmelCase__		(    lowerCamelCase_		:		Tuple=False       ,lowerCamelCase_		:		List[str]=False):





				'''simple docstring'''

				lowerCAmelCase__     :				Any												=     Accelerator(
				    split_batches=lowerCamelCase_       ,dispatch_batches=lowerCamelCase_       ,gradient_accumulation_steps=2)
				# Test that context manager behaves properly
				lowerCAmelCase__						,		lowerCAmelCase__						,		lowerCAmelCase__						,		lowerCAmelCase__						,		lowerCAmelCase__						,		lowerCAmelCase__						,		lowerCAmelCase__     :				List[Any]												=     get_training_setup(lowerCamelCase_       ,lowerCamelCase_)
				for iteration, batch in enumerate(lowerCamelCase_):
								lowerCAmelCase__						,		lowerCAmelCase__     :				str												=     batch.values()
								# Gather the distributed inputs and targs for the base model
								lowerCAmelCase__						,		lowerCAmelCase__     :				Any												=     accelerator.gather((ddp_input, ddp_target))
								lowerCAmelCase__						,		lowerCAmelCase__     :				List[Any]												=     input.to(accelerator.device), target.to(accelerator.device)
								# Perform our initial ground truth step in non "DDP"
								model.train()
								ddp_model.train()
								step_model(lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_)
								opt.step()

								if ((iteration + 1) % 2 == 0) or ((iteration + 1) == len(lowerCamelCase_)):
												if split_batches:
																sched.step()
												else:
																for _ in range(accelerator.num_processes):
																				sched.step()
								opt.zero_grad()
								# Perform gradient accumulation under wrapper
								with accelerator.accumulate(lowerCamelCase_):
												step_model(lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_)
												ddp_opt.step()
												ddp_sched.step()
												ddp_opt.zero_grad()

								# Learning rates should be the same
								assert (
								    opt.param_groups[0]["lr"] == ddp_opt.param_groups[0]["lr"]
								), f"""Learning rates found in each optimizer did not align\nopt: {opt.param_groups[0]['lr']}\nDDP opt: {ddp_opt.param_groups[0]['lr']}\n"""
								lowerCAmelCase__     :				List[Any]												=     (((iteration + 1) % 2) == 0) or ((iteration + 1) == len(lowerCamelCase_))
								if accelerator.num_processes > 1:
												check_model_parameters(lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_       ,lowerCamelCase_)
								# Shuffle ddp_input on each iteration
								torch.manual_seed(1337 + iteration)
				GradientState._reset_state()






def 	lowerCAmelCase__		(    ):





				'''simple docstring'''

				lowerCAmelCase__     :				int												=     Accelerator()

				lowerCAmelCase__     :				Any												=     RegressionDataset(length=80)
				lowerCAmelCase__     :				List[str]												=     DataLoader(lowerCamelCase_       ,batch_size=16)
				lowerCAmelCase__     :				int												=     RegressionDataset(length=96)
				lowerCAmelCase__     :				Any												=     DataLoader(lowerCamelCase_       ,batch_size=16)
				lowerCAmelCase__						,		lowerCAmelCase__     :				int												=     accelerator.prepare(lowerCamelCase_       ,lowerCamelCase_)
				assert accelerator.gradient_state.active_dataloader is None
				for iteration, _ in enumerate(lowerCamelCase_):
								assert id(accelerator.gradient_state.active_dataloader) == id(lowerCamelCase_)
								if iteration < len(lowerCamelCase_) - 1:
												assert not accelerator.gradient_state.end_of_dataloader
												if iteration == 1:
																for batch_num, _ in enumerate(lowerCamelCase_):
																				assert id(accelerator.gradient_state.active_dataloader) == id(lowerCamelCase_)
																				if batch_num < len(lowerCamelCase_) - 1:
																								assert not accelerator.gradient_state.end_of_dataloader
																				else:
																								assert accelerator.gradient_state.end_of_dataloader
								else:
												assert accelerator.gradient_state.end_of_dataloader
				assert accelerator.gradient_state.active_dataloader is None






def 	lowerCAmelCase__		(    ):





				'''simple docstring'''

				lowerCAmelCase__     :				Any												=     Accelerator()
				lowerCAmelCase__     :				Optional[int]												=     accelerator.state
				if state.local_process_index == 0:
								print('''**Test `accumulate` gradient accumulation with dataloader break**''')
				test_dataloader_break()
				if state.distributed_type == DistributedType.NO:
								if state.local_process_index == 0:
												print('''**Test NOOP `no_sync` context manager**''')
								test_noop_sync(lowerCamelCase_)
				if state.distributed_type in (DistributedType.MULTI_GPU, DistributedType.MULTI_CPU):
								if state.local_process_index == 0:
												print('''**Test Distributed `no_sync` context manager**''')
								test_distributed_sync(lowerCamelCase_)
				if state.distributed_type == DistributedType.MULTI_GPU:
								for split_batch in [True, False]:
												for dispatch_batches in [True, False]:
																if state.local_process_index == 0:
																				print(
																				    '''**Test `accumulate` gradient accumulation, '''       ,f"""`split_batches={split_batch}` and `dispatch_batches={dispatch_batches}`**"""       ,)
																test_gradient_accumulation(lowerCamelCase_       ,lowerCamelCase_)

    # Currently will break on torch 2.0 +, need to investigate why
				if is_torch_version('''<'''       ,'''2.0''') or state.distributed_type == DistributedType.NO:
								if state.local_process_index == 0:
												print(
												    '''**Test `accumulate` gradient accumulation with optimizer and scheduler, '''       ,'''`split_batches=False`, `dispatch_batches=False`**'''       ,)
								test_gradient_accumulation_with_opt_and_scheduler()
								if state.distributed_type == DistributedType.MULTI_GPU:
												for split_batch in [True, False]:
																for dispatch_batches in [True, False]:
																				if not split_batch and not dispatch_batches:
																								continue
																				if state.local_process_index == 0:
																								print(
																								    '''**Test `accumulate` gradient accumulation with optimizer and scheduler, '''       ,f"""`split_batches={split_batch}` and `dispatch_batches={dispatch_batches}`**"""       ,)
																				test_gradient_accumulation_with_opt_and_scheduler(lowerCamelCase_       ,lowerCamelCase_)






def 	lowerCAmelCase__		(    lowerCamelCase_		:		Optional[Any]):





				'''simple docstring'''

				main()


if __name__ == "__main__":
							main()





'''simple docstring'''

import unittest

from transformers import TrOCRConfig
from transformers.testing_utils import is_torch_available, require_torch, torch_device

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


if is_torch_available():
 import torch

 from transformers.models.trocr.modeling_trocr import TrOCRDecoder, TrOCRForCausalLM
@require_torch
class   __lowerCAmelCase						:





      '''simple docstring'''






      def __init__(self    :    str   ,						UpperCamelCase    :    Tuple   ,						UpperCamelCase    :    Optional[int]=99   ,						UpperCamelCase    :    Optional[int]=13   ,						UpperCamelCase    :    Tuple=16   ,						UpperCamelCase    :    Union[str, Any]=7   ,						UpperCamelCase    :    List[Any]=True   ,						UpperCamelCase    :    List[str]=True   ,						UpperCamelCase    :    str=True   ,						UpperCamelCase    :    Tuple=False   ,						UpperCamelCase    :    str=True   ,						UpperCamelCase    :    Tuple=2   ,						UpperCamelCase    :    Optional[int]=32   ,						UpperCamelCase    :    Any=4   ,						UpperCamelCase    :    Optional[int]=4   ,						UpperCamelCase    :    Tuple=30   ,						UpperCamelCase    :    str=0   ,						UpperCamelCase    :    Tuple=1   ,						UpperCamelCase    :    List[Any]=2   ,						UpperCamelCase    :    str=None   ,						):

             '''simple docstring'''







             lowercase__      			= parent
             lowercase__      			= batch_size
             lowercase__      			= decoder_seq_length
             # For common tests
             lowercase__      			= self.decoder_seq_length
             lowercase__      			= is_training
             lowercase__      			= use_attention_mask
             lowercase__      			= use_labels

             lowercase__      			= vocab_size
             lowercase__      			= d_model
             lowercase__      			= d_model
             lowercase__      			= decoder_layers
             lowercase__      			= decoder_layers
             lowercase__      			= decoder_ffn_dim
             lowercase__      			= decoder_attention_heads
             lowercase__      			= decoder_attention_heads
             lowercase__      			= eos_token_id
             lowercase__      			= bos_token_id
             lowercase__      			= pad_token_id
             lowercase__      			= decoder_start_token_id
             lowercase__      			= use_cache
             lowercase__      			= max_position_embeddings

             lowercase__      			= None
             lowercase__      			= decoder_seq_length
             lowercase__      			= 2
             lowercase__      			= 1



      def       UpperCamelCase__		(self    :    str ):

             '''simple docstring'''







             lowercase__      			= ids_tensor([self.batch_size, self.decoder_seq_length]   ,						self.vocab_size )

             lowercase__      			= None
             if self.use_attention_mask:
                    lowercase__      			= ids_tensor([self.batch_size, self.decoder_seq_length]   ,						vocab_size=2 )

             lowercase__      			= None
             if self.use_labels:
                    lowercase__      			= ids_tensor([self.batch_size, self.decoder_seq_length]   ,						self.vocab_size )

             lowercase__      			= TrOCRConfig(
                 vocab_size=self.vocab_size   ,						d_model=self.d_model   ,						decoder_layers=self.decoder_layers   ,						decoder_ffn_dim=self.decoder_ffn_dim   ,						decoder_attention_heads=self.decoder_attention_heads   ,						eos_token_id=self.eos_token_id   ,						bos_token_id=self.bos_token_id   ,						use_cache=self.use_cache   ,						pad_token_id=self.pad_token_id   ,						decoder_start_token_id=self.decoder_start_token_id   ,						max_position_embeddings=self.max_position_embeddings   ,						)

             return (config, input_ids, attention_mask, lm_labels)



      def       UpperCamelCase__		(self    :    Tuple   ,						UpperCamelCase    :    List[Any]   ,						UpperCamelCase    :    Optional[Any]   ,						UpperCamelCase    :    Tuple   ,						UpperCamelCase    :    List[str]   ,						):

             '''simple docstring'''







             lowercase__      			= True
             lowercase__      			= TrOCRDecoder(config=UpperCamelCase ).to(UpperCamelCase ).eval()
             lowercase__      			= input_ids[:2]

             input_ids[input_ids == 0] += 1
             # first forward pass
             lowercase__      			= model(UpperCamelCase   ,						use_cache=UpperCamelCase )
             lowercase__      			= model(UpperCamelCase )
             lowercase__      			= model(UpperCamelCase   ,						use_cache=UpperCamelCase )

             self.parent.assertTrue(len(UpperCamelCase ) == len(UpperCamelCase ) )
             self.parent.assertTrue(len(UpperCamelCase ) == len(UpperCamelCase ) + 1 )

             lowercase__      			= outputs['''past_key_values''']

             # create hypothetical next token and extent to next_input_ids
             lowercase__      			= ids_tensor((2, 1)   ,						config.vocab_size - 1 ) + 1

             # append to next input_ids and
             lowercase__      			= torch.cat([input_ids, next_tokens]   ,						dim=-1 )

             lowercase__      			= model(UpperCamelCase )['''last_hidden_state''']
             lowercase__      			= model(UpperCamelCase   ,						past_key_values=UpperCamelCase )['''last_hidden_state''']

             # select random slice
             lowercase__      			= ids_tensor((1,)   ,						output_from_past.shape[-1] ).item()
             lowercase__      			= output_from_no_past[:, next_input_ids.shape[-1] - 1, random_slice_idx].detach()
             lowercase__      			= output_from_past[:, 0, random_slice_idx].detach()

             # test that outputs are equal for slice
             assert torch.allclose(UpperCamelCase   ,						UpperCamelCase   ,						atol=1E-3 )






      def       UpperCamelCase__		(self    :    Optional[Any] ):

             '''simple docstring'''







             lowercase__      			= self.prepare_config_and_inputs()
             lowercase__			,lowercase__			,lowercase__			,lowercase__      			= config_and_inputs

             lowercase__      			= {'''input_ids''': input_ids, '''attention_mask''': attention_mask}
             return config, inputs_dict






@require_torch
class   __lowerCAmelCase						(lowercase_  ,     lowercase_  ,     lowercase_  ,     unittest.TestCase     ):





      '''simple docstring'''






      lowerCAmelCase__					:     List[str]  					=							(TrOCRDecoder, TrOCRForCausalLM) if is_torch_available() else ()
      lowerCAmelCase__					:     List[Any]  					=							(TrOCRForCausalLM,) if is_torch_available() else ()
      lowerCAmelCase__					:     Optional[Any]  					=							{"""text-generation""": TrOCRForCausalLM} if is_torch_available() else {}
      lowerCAmelCase__					:     Optional[Any]  					=							True
      lowerCAmelCase__					:     List[str]  					=							False



      def       UpperCamelCase__		(self    :    Any ):

             '''simple docstring'''







             lowercase__      			= TrOCRStandaloneDecoderModelTester(self   ,						is_training=UpperCamelCase )
             lowercase__      			= ConfigTester(self   ,						config_class=UpperCamelCase )



      def       UpperCamelCase__		(self    :    List[str] ):

             '''simple docstring'''







             pass



      def       UpperCamelCase__		(self    :    Optional[int] ):

             '''simple docstring'''







             pass



      def       UpperCamelCase__		(self    :    Any ):

             '''simple docstring'''







             pass



      def       UpperCamelCase__		(self    :    Any ):

             '''simple docstring'''







             self.config_tester.run_common_tests()



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

             '''simple docstring'''







             lowercase__      			= self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_decoder_model_past(*UpperCamelCase )



      def       UpperCamelCase__		(self    :    Optional[int] ):

             '''simple docstring'''







             return






      @unittest.skip('''The model doesn\'t support left padding''' )  # and it's not used enough to be worth fixing :)
      def       UpperCamelCase__		(self    :    List[str] ):

             '''simple docstring'''







             pass




