



"""simple docstring"""
import unittest

from transformers import EsmConfig, is_torch_available
from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device

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 EsmForMaskedLM, EsmForSequenceClassification, EsmForTokenClassification, EsmModel
					from transformers.models.esm.modeling_esm import (
					    ESM_PRETRAINED_MODEL_ARCHIVE_LIST,
					    EsmEmbeddings,
					    create_position_ids_from_input_ids,
					)




class 			snake_case_						:






							def __init__(   self			,     a_			,     a_=1_3			,     a_=7			,     a_=False			,     a_=True			,     a_=False			,     a_=True			,     a_=3_3			,     a_=3_2			,     a_=5			,     a_=4			,     a_=3_7			,     a_="gelu"			,     a_=0.1			,     a_=0.1			,     a_=5_1_2			,     a_=1_6			,     a_=2			,     a_=0.02			,     a_=3			,     a_=4			,     a_=None			,     ):
									a_     :      Union[str, Any] 						=     parent
									a_     :      Dict 						=     batch_size
									a_     :      Optional[Any] 						=     seq_length
									a_     :      Optional[int] 						=     is_training
									a_     :      List[str] 						=     use_input_mask
									a_     :      Tuple 						=     use_token_type_ids
									a_     :      List[str] 						=     use_labels
									a_     :      str 						=     vocab_size
									a_     :      Union[str, Any] 						=     hidden_size
									a_     :      Optional[Any] 						=     num_hidden_layers
									a_     :      int 						=     num_attention_heads
									a_     :      Dict 						=     intermediate_size
									a_     :      Union[str, Any] 						=     hidden_act
									a_     :      int 						=     hidden_dropout_prob
									a_     :      List[Any] 						=     attention_probs_dropout_prob
									a_     :      List[str] 						=     max_position_embeddings
									a_     :      List[str] 						=     type_vocab_size
									a_     :      Optional[int] 						=     type_sequence_label_size
									a_     :      List[Any] 						=     initializer_range
									a_     :      Tuple 						=     num_labels
									a_     :      Tuple 						=     num_choices
									a_     :      Tuple 						=     scope






							def snake_case_  (   self      ):
									a_     :      Dict 						=     ids_tensor([self.batch_size, self.seq_length]			,     self.vocab_size      )

									a_     :      Any 						=     None
									if self.use_input_mask:
											a_     :      Union[str, Any] 						=     random_attention_mask([self.batch_size, self.seq_length]      )

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

									a_     :      Optional[int] 						=     self.get_config()

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






							def snake_case_  (   self      ):
									return EsmConfig(
									    vocab_size=self.vocab_size			,     hidden_size=self.hidden_size			,     pad_token_id=1			,     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			,     )






							def snake_case_  (   self			,     a_			,     a_			,     a_			,     a_			,     a_			,     a_      ):
									a_     :      List[str] 						=     EsmModel(config=SCREAMING_SNAKE_CASE_      )
									model.to(SCREAMING_SNAKE_CASE_      )
									model.eval()
									a_     :      Dict 						=     model(SCREAMING_SNAKE_CASE_			,     attention_mask=SCREAMING_SNAKE_CASE_      )
									a_     :      Tuple 						=     model(SCREAMING_SNAKE_CASE_      )
									a_     :      str 						=     model(SCREAMING_SNAKE_CASE_      )

									self.parent.assertEqual(result.last_hidden_state.shape			,     (self.batch_size, self.seq_length, self.hidden_size)      )
									self.parent.assertEqual(result.pooler_output.shape			,     (self.batch_size, self.hidden_size)      )






							def snake_case_  (   self			,     a_			,     a_			,     a_			,     a_			,     a_			,     a_      ):
									a_     :      Dict 						=     EsmForMaskedLM(config=SCREAMING_SNAKE_CASE_      )
									model.to(SCREAMING_SNAKE_CASE_      )
									model.eval()
									a_     :      int 						=     model(SCREAMING_SNAKE_CASE_			,     attention_mask=SCREAMING_SNAKE_CASE_			,     labels=SCREAMING_SNAKE_CASE_      )
									self.parent.assertEqual(result.logits.shape			,     (self.batch_size, self.seq_length, self.vocab_size)      )






							def snake_case_  (   self			,     a_			,     a_			,     a_			,     a_			,     a_			,     a_      ):
									a_     :      Union[str, Any] 						=     self.num_labels
									a_     :      Any 						=     EsmForTokenClassification(config=SCREAMING_SNAKE_CASE_      )
									model.to(SCREAMING_SNAKE_CASE_      )
									model.eval()
									a_     :      str 						=     model(SCREAMING_SNAKE_CASE_			,     attention_mask=SCREAMING_SNAKE_CASE_			,     labels=SCREAMING_SNAKE_CASE_      )
									self.parent.assertEqual(result.logits.shape			,     (self.batch_size, self.seq_length, self.num_labels)      )






							def snake_case_  (   self      ):
									a_     :      Union[str, Any] 						=     self.prepare_config_and_inputs()
									(
									    (
									    a_ 
									)						,				(
									    a_ 
									)						,				(
									    a_ 
									)						,				(
									    a_ 
									)						,				(
									    a_ 
									)						,				(
									    a_ 
									)						,				 
									)     :      Union[str, Any] 						=     config_and_inputs
									a_     :      Optional[int] 						=     {"input_ids": input_ids, "attention_mask": input_mask}
									return config, inputs_dict




@require_torch
class 			snake_case_						(						__lowerCamelCase     ,__lowerCamelCase     ,unittest.TestCase				):
							__lowerCAmelCase    					=					False

							__lowerCAmelCase    					=					(
							    (
							        EsmForMaskedLM,
							        EsmModel,
							        EsmForSequenceClassification,
							        EsmForTokenClassification,
							    )
							    if is_torch_available()
							    else ()
							)
							__lowerCAmelCase    					=					()
							__lowerCAmelCase    					=					(
							    {
							        "feature-extraction": EsmModel,
							        "fill-mask": EsmForMaskedLM,
							        "text-classification": EsmForSequenceClassification,
							        "token-classification": EsmForTokenClassification,
							        "zero-shot": EsmForSequenceClassification,
							    }
							    if is_torch_available()
							    else {}
							)
							__lowerCAmelCase    					=					True






							def snake_case_  (   self      ):
									a_     :      Any 						=     EsmModelTester(self      )
									a_     :      Dict 						=     ConfigTester(self			,     config_class=SCREAMING_SNAKE_CASE_			,     hidden_size=3_7      )






							def snake_case_  (   self      ):
									self.config_tester.run_common_tests()






							def snake_case_  (   self      ):
									a_     :      List[Any] 						=     self.model_tester.prepare_config_and_inputs()
									self.model_tester.create_and_check_model(*SCREAMING_SNAKE_CASE_      )






							def snake_case_  (   self      ):
									a_     :      Optional[Any] 						=     self.model_tester.prepare_config_and_inputs()
									for type in ["absolute", "relative_key", "relative_key_query"]:
											a_     :      Dict 						=     type
											self.model_tester.create_and_check_model(*SCREAMING_SNAKE_CASE_      )






							def snake_case_  (   self      ):
									a_     :      int 						=     self.model_tester.prepare_config_and_inputs()
									self.model_tester.create_and_check_for_masked_lm(*SCREAMING_SNAKE_CASE_      )






							def snake_case_  (   self      ):
									a_     :      Any 						=     self.model_tester.prepare_config_and_inputs()
									self.model_tester.create_and_check_for_token_classification(*SCREAMING_SNAKE_CASE_      )






							@slow
							def snake_case_  (   self      ):
									for model_name in ESM_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
											a_     :      str 						=     EsmModel.from_pretrained(SCREAMING_SNAKE_CASE_      )
											self.assertIsNotNone(SCREAMING_SNAKE_CASE_      )






							def snake_case_  (   self      ):
									a_     :      Optional[Any] 						=     self.model_tester.prepare_config_and_inputs()[0]
									a_     :      int 						=     EsmEmbeddings(config=SCREAMING_SNAKE_CASE_      )

									a_     :      int 						=     torch.as_tensor([[1_2, 3_1, 1_3, model.padding_idx]]      )
									a_     :      List[str] 						=     torch.as_tensor(
									    [
									        [
									            0 + model.padding_idx + 1,
									            1 + model.padding_idx + 1,
									            2 + model.padding_idx + 1,
									            model.padding_idx,
									        ]
									    ]      )
									a_     :      Optional[int] 						=     create_position_ids_from_input_ids(SCREAMING_SNAKE_CASE_			,     model.padding_idx      )
									self.assertEqual(position_ids.shape			,     expected_positions.shape      )
									self.assertTrue(torch.all(torch.eq(SCREAMING_SNAKE_CASE_			,     SCREAMING_SNAKE_CASE_      )      )      )






							def snake_case_  (   self      ):
									a_     :      Optional[int] 						=     self.model_tester.prepare_config_and_inputs()[0]
									a_     :      Dict 						=     EsmEmbeddings(config=SCREAMING_SNAKE_CASE_      )

									a_     :      List[Any] 						=     torch.empty(2			,     4			,     3_0      )
									a_     :      Optional[Any] 						=     [
									    0 + embeddings.padding_idx + 1,
									    1 + embeddings.padding_idx + 1,
									    2 + embeddings.padding_idx + 1,
									    3 + embeddings.padding_idx + 1,
									]
									a_     :      Union[str, Any] 						=     torch.as_tensor([expected_single_positions, expected_single_positions]      )
									a_     :      Dict 						=     embeddings.create_position_ids_from_inputs_embeds(SCREAMING_SNAKE_CASE_      )
									self.assertEqual(position_ids.shape			,     expected_positions.shape      )
									self.assertTrue(torch.all(torch.eq(SCREAMING_SNAKE_CASE_			,     SCREAMING_SNAKE_CASE_      )      )      )






							@unittest.skip("Esm does not support embedding resizing"      )
							def snake_case_  (   self      ):
									pass






							@unittest.skip("Esm does not support embedding resizing"      )
							def snake_case_  (   self      ):
									pass






							@unittest.skip("Will be fixed soon by reducing the size of the model used for common tests."      )
							def snake_case_  (   self      ):
									pass




@require_torch
class 			snake_case_						(						__lowerCamelCase				):






							@slow
							def snake_case_  (   self      ):
									with torch.no_grad():
											a_     :      int 						=     EsmForMaskedLM.from_pretrained("facebook/esm2_t6_8M_UR50D"      )
											model.eval()
											a_     :      Optional[Any] 						=     torch.tensor([[0, 1, 2, 3, 4, 5]]      )
											a_     :      Any 						=     model(SCREAMING_SNAKE_CASE_      )[0]

											a_     :      Any 						=     3_3

											a_     :      int 						=     torch.Size((1, 6, vocab_size)      )
											self.assertEqual(output.shape			,     SCREAMING_SNAKE_CASE_      )

											a_     :      Dict 						=     torch.tensor(
											    [[[8.9_215, -10.5_898, -6.4_671], [-6.3_967, -13.9_114, -1.1_212], [-7.7_812, -13.9_516, -3.7_406]]]      )
											self.assertTrue(torch.allclose(output[:, :3, :3]			,     SCREAMING_SNAKE_CASE_			,     atol=1e-4      )      )






							@slow
							def snake_case_  (   self      ):
									with torch.no_grad():
											a_     :      Dict 						=     EsmModel.from_pretrained("facebook/esm2_t6_8M_UR50D"      )
											model.eval()

											a_     :      Union[str, Any] 						=     torch.tensor([[0, 6, 4, 1_3, 5, 4, 1_6, 1_2, 1_1, 7, 2]]      )
											a_     :      int 						=     model(SCREAMING_SNAKE_CASE_      )[0]
											# compare the actual values for a slice.
											a_     :      Dict 						=     torch.tensor(
											    [[[0.1_444, 0.5_413, 0.3_248], [0.3_034, 0.0_053, 0.3_108], [0.3_228, -0.2_499, 0.3_415]]]      )
											self.assertTrue(torch.allclose(output[:, :3, :3]			,     SCREAMING_SNAKE_CASE_			,     atol=1e-4      )      )




"""simple docstring"""
from collections import OrderedDict
from typing import Any, Mapping, Optional

from ... import PreTrainedTokenizer
from ...configuration_utils import PretrainedConfig
from ...file_utils import TensorType, is_torch_available
from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast
from ...onnx.utils import compute_effective_axis_dimension
from ...utils import logging


SCREAMING_SNAKE_CASE_				= logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_				= {
    """facebook/blenderbot_small-90M""": """https://huggingface.co/facebook/blenderbot_small-90M/resolve/main/config.json""",
    # See all BlenderbotSmall models at https://huggingface.co/models?filter=blenderbot_small
}




class 			snake_case_						(						a_				):
							__lowerCAmelCase    					=					"blenderbot-small"
							__lowerCAmelCase    					=					["past_key_values"]
							__lowerCAmelCase    					=					{"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}






							def __init__(   self			,     a_=5_0_2_6_5			,     a_=5_1_2			,     a_=8			,     a_=2_0_4_8			,     a_=1_6			,     a_=8			,     a_=2_0_4_8			,     a_=1_6			,     a_=0.0			,     a_=0.0			,     a_=True			,     a_=True			,     a_="gelu"			,     a_=5_1_2			,     a_=0.1			,     a_=0.0			,     a_=0.0			,     a_=0.02			,     a_=1			,     a_=False			,     a_=0			,     a_=1			,     a_=2			,     a_=2			,     **a_			,     ):
									a_     :      int 						=     vocab_size
									a_     :      Any 						=     max_position_embeddings
									a_     :      Optional[int] 						=     d_model
									a_     :      Tuple 						=     encoder_ffn_dim
									a_     :      List[Any] 						=     encoder_layers
									a_     :      Optional[int] 						=     encoder_attention_heads
									a_     :      Optional[int] 						=     decoder_ffn_dim
									a_     :      List[str] 						=     decoder_layers
									a_     :      Dict 						=     decoder_attention_heads
									a_     :      List[str] 						=     dropout
									a_     :      List[Any] 						=     attention_dropout
									a_     :      List[str] 						=     activation_dropout
									a_     :      Optional[Any] 						=     activation_function
									a_     :      List[Any] 						=     init_std
									a_     :      int 						=     encoder_layerdrop
									a_     :      Optional[int] 						=     decoder_layerdrop
									a_     :      List[str] 						=     use_cache
									a_     :      Optional[int] 						=     encoder_layers
									a_     :      Optional[int] 						=     scale_embedding  # scale factor will be sqrt(d_model) if True

									super().__init__(
									    pad_token_id=a_			,     bos_token_id=a_			,     eos_token_id=a_			,     is_encoder_decoder=a_			,     decoder_start_token_id=a_			,     forced_eos_token_id=a_			,     **a_			,     )




class 			snake_case_						(						a_				):






							@property
							def snake_case_  (   self      ):
									if self.task in ["default", "seq2seq-lm"]:
											a_     :      Optional[int] 						=     OrderedDict(
											    [
											        ("input_ids", {0: "batch", 1: "encoder_sequence"}),
											        ("attention_mask", {0: "batch", 1: "encoder_sequence"}),
											    ]      )

											if self.use_past:
													a_     :      Tuple 						=     {0: "batch"}
													a_     :      int 						=     {0: "batch", 1: "past_decoder_sequence + sequence"}
											else:
													a_     :      List[str] 						=     {0: "batch", 1: "decoder_sequence"}
													a_     :      Optional[int] 						=     {0: "batch", 1: "decoder_sequence"}

											if self.use_past:
													self.fill_with_past_key_values_(a_			,     direction="inputs"      )
									elif self.task == "causal-lm":
											# TODO: figure this case out.
											a_     :      Dict 						=     OrderedDict(
											    [
											        ("input_ids", {0: "batch", 1: "encoder_sequence"}),
											        ("attention_mask", {0: "batch", 1: "encoder_sequence"}),
											    ]      )
											if self.use_past:
													a_						,				a_     :      Optional[int] 						=     self.num_layers
													for i in range(a_      ):
															a_     :      Union[str, Any] 						=     {0: "batch", 2: "past_sequence + sequence"}
															a_     :      List[Any] 						=     {0: "batch", 2: "past_sequence + sequence"}
									else:
											a_     :      List[str] 						=     OrderedDict(
											    [
											        ("input_ids", {0: "batch", 1: "encoder_sequence"}),
											        ("attention_mask", {0: "batch", 1: "encoder_sequence"}),
											        ("decoder_input_ids", {0: "batch", 1: "decoder_sequence"}),
											        ("decoder_attention_mask", {0: "batch", 1: "decoder_sequence"}),
											    ]      )

									return common_inputs






							@property
							def snake_case_  (   self      ):
									if self.task in ["default", "seq2seq-lm"]:
											a_     :      List[Any] 						=     super().outputs
									else:
											a_     :      Tuple 						=     super(a_			,     self      ).outputs
											if self.use_past:
													a_						,				a_     :      Dict 						=     self.num_layers
													for i in range(a_      ):
															a_     :      List[Any] 						=     {0: "batch", 2: "past_sequence + sequence"}
															a_     :      List[Any] 						=     {0: "batch", 2: "past_sequence + sequence"}
									return common_outputs






							def snake_case_  (   self			,     a_			,     a_ = -1			,     a_ = -1			,     a_ = False			,     a_ = None			,     ):
									a_     :      List[str] 						=     self._generate_dummy_inputs_for_sequence_classification_and_question_answering(
									    a_			,     a_			,     a_			,     a_			,     a_      )

									# Generate decoder inputs
									a_     :      Optional[int] 						=     seq_length if not self.use_past else 1
									a_     :      str 						=     self._generate_dummy_inputs_for_sequence_classification_and_question_answering(
									    a_			,     a_			,     a_			,     a_			,     a_      )
									a_     :      int 						=     {F"""decoder_{name}""": tensor for name, tensor in decoder_inputs.items()}
									a_     :      Tuple 						=     dict(**a_			,     **a_      )

									if self.use_past:
											if not is_torch_available():
													raise ValueError("Cannot generate dummy past_keys inputs without PyTorch installed."      )
											else:
													import torch
											a_						,				a_     :      Optional[int] 						=     common_inputs["input_ids"].shape
											a_     :      str 						=     common_inputs["decoder_input_ids"].shape[1]
											a_						,				a_     :      Dict 						=     self.num_attention_heads
											a_     :      List[str] 						=     (
											    batch,
											    num_encoder_attention_heads,
											    encoder_seq_length,
											    self._config.hidden_size // num_encoder_attention_heads,
											)
											a_     :      Optional[Any] 						=     decoder_seq_length + 3
											a_     :      str 						=     (
											    batch,
											    num_decoder_attention_heads,
											    decoder_past_length,
											    self._config.hidden_size // num_decoder_attention_heads,
											)

											a_     :      Dict 						=     torch.cat(
											    [common_inputs["decoder_attention_mask"], torch.ones(a_			,     a_      )]			,     dim=1      )

											a_     :      Optional[int] 						=     []
											# If the number of encoder and decoder layers are present in the model configuration, both are considered
											a_						,				a_     :      Tuple 						=     self.num_layers
											a_     :      str 						=     min(a_			,     a_      )
											a_     :      Dict 						=     max(a_			,     a_      ) - min_num_layers
											a_     :      Union[str, Any] 						=     "encoder" if num_encoder_layers > num_decoder_layers else "decoder"

											for _ in range(a_      ):
													common_inputs["past_key_values"].append(
													    (
													        torch.zeros(a_      ),
													        torch.zeros(a_      ),
													        torch.zeros(a_      ),
													        torch.zeros(a_      ),
													    )      )
											# TODO: test this.
											a_     :      Optional[int] 						=     encoder_shape if remaining_side_name == "encoder" else decoder_shape
											for _ in range(a_			,     a_      ):
													common_inputs["past_key_values"].append((torch.zeros(a_      ), torch.zeros(a_      ))      )
									return common_inputs






							def snake_case_  (   self			,     a_			,     a_ = -1			,     a_ = -1			,     a_ = False			,     a_ = None			,     ):
									a_     :      Optional[int] 						=     self._generate_dummy_inputs_for_sequence_classification_and_question_answering(
									    a_			,     a_			,     a_			,     a_			,     a_      )

									if self.use_past:
											if not is_torch_available():
													raise ValueError("Cannot generate dummy past_keys inputs without PyTorch installed."      )
											else:
													import torch
											a_						,				a_     :      Dict 						=     common_inputs["input_ids"].shape
											# Not using the same length for past_key_values
											a_     :      int 						=     seqlen + 2
											a_						,				a_     :      Optional[int] 						=     self.num_layers
											a_						,				a_     :      Optional[int] 						=     self.num_attention_heads
											a_     :      Optional[Any] 						=     (
											    batch,
											    num_encoder_attention_heads,
											    past_key_values_length,
											    self._config.hidden_size // num_encoder_attention_heads,
											)

											a_     :      str 						=     common_inputs["attention_mask"].dtype
											a_     :      Tuple 						=     torch.cat(
											    [common_inputs["attention_mask"], torch.ones(a_			,     a_			,     dtype=a_      )]			,     dim=1      )
											a_     :      Optional[int] 						=     [
											    (torch.zeros(a_      ), torch.zeros(a_      )) for _ in range(a_      )
											]
									return common_inputs






							def snake_case_  (   self			,     a_			,     a_ = -1			,     a_ = -1			,     a_ = False			,     a_ = None			,     ):
									# Copied from OnnxConfig.generate_dummy_inputs
									# Did not use super(OnnxConfigWithPast, self).generate_dummy_inputs for code clarity.
									# If dynamic axis (-1) we forward with a fixed dimension of 2 samples to avoid optimizations made by ONNX
									a_     :      Optional[Any] 						=     compute_effective_axis_dimension(
									    a_			,     fixed_dimension=OnnxConfig.default_fixed_batch			,     num_token_to_add=0      )

									# If dynamic axis (-1) we forward with a fixed dimension of 8 tokens to avoid optimizations made by ONNX
									a_     :      Tuple 						=     tokenizer.num_special_tokens_to_add(a_      )
									a_     :      Union[str, Any] 						=     compute_effective_axis_dimension(
									    a_			,     fixed_dimension=OnnxConfig.default_fixed_sequence			,     num_token_to_add=a_      )

									# Generate dummy inputs according to compute batch and sequence
									a_     :      Union[str, Any] 						=     [" ".join([tokenizer.unk_token]      ) * seq_length] * batch_size
									a_     :      str 						=     dict(tokenizer(a_			,     return_tensors=a_      )      )
									return common_inputs






							def snake_case_  (   self			,     a_			,     a_ = -1			,     a_ = -1			,     a_ = False			,     a_ = None			,     ):
									if self.task in ["default", "seq2seq-lm"]:
											a_     :      List[str] 						=     self._generate_dummy_inputs_for_default_and_seqaseq_lm(
											    a_			,     batch_size=a_			,     seq_length=a_			,     is_pair=a_			,     framework=a_      )

									elif self.task == "causal-lm":
											a_     :      List[Any] 						=     self._generate_dummy_inputs_for_causal_lm(
											    a_			,     batch_size=a_			,     seq_length=a_			,     is_pair=a_			,     framework=a_      )
									else:
											a_     :      Union[str, Any] 						=     self._generate_dummy_inputs_for_sequence_classification_and_question_answering(
											    a_			,     batch_size=a_			,     seq_length=a_			,     is_pair=a_			,     framework=a_      )

									return common_inputs






							def snake_case_  (   self			,     a_			,     a_			,     a_			,     a_      ):
									if self.task in ["default", "seq2seq-lm"]:
											a_     :      Optional[int] 						=     super()._flatten_past_key_values_(a_			,     a_			,     a_			,     a_      )
									else:
											a_     :      int 						=     super(a_			,     self      )._flatten_past_key_values_(
											    a_			,     a_			,     a_			,     a_      )