

import os
import unittest

from transformers import RealmTokenizerFast
from transformers.models.bert.tokenization_bert import (
    VOCAB_FILES_NAMES,
    BasicTokenizer,
    WordpieceTokenizer,
    _is_control,
    _is_punctuation,
    _is_whitespace,
)
from transformers.models.realm.tokenization_realm import RealmTokenizer
from transformers.testing_utils import require_tokenizers, slow

from ...test_tokenization_common import TokenizerTesterMixin, filter_non_english






@require_tokenizers
class 			__magic_name__					(    lowerCAmelCase_						,					unittest.TestCase   ):
			SCREAMING_SNAKE_CASE							     =		RealmTokenizer
			SCREAMING_SNAKE_CASE							     =		RealmTokenizerFast
			SCREAMING_SNAKE_CASE							     =		True
			SCREAMING_SNAKE_CASE							     =		True
			SCREAMING_SNAKE_CASE							     =		filter_non_english





			def 	__magic_name__					(	self      )     ->				Optional[int]:




						'''simple docstring'''
						super().setUp()

						__a						   =[
						    '[UNK]',
						    '[CLS]',
						    '[SEP]',
						    '[PAD]',
						    '[MASK]',
						    'want',
						    '##want',
						    '##ed',
						    'wa',
						    'un',
						    'runn',
						    '##ing',
						    ',',
						    'low',
						    'lowest',
						]
						__a						   =os.path.join(self.tmpdirname      ,						VOCAB_FILES_NAMES['vocab_file']      )
						with open(self.vocab_file      ,						'w'      ,						encoding='utf-8'      ) as vocab_writer:
									vocab_writer.write(''.join([x + '\n' for x in vocab_tokens]      )      )





			def 	__magic_name__					(	self      ,						__snake_case      )     ->				Any:




						'''simple docstring'''
						__a						   ='UNwant\u00E9d,running'
						__a						   ='unwanted, running'
						return input_text, output_text





			def 	__magic_name__					(	self      )     ->				Any:




						'''simple docstring'''
						__a						   =self.tokenizer_class(self.vocab_file      )

						__a						   =tokenizer.tokenize('UNwant\u00E9d,running'      )
						self.assertListEqual(__snake_case      ,						['un', '##want', '##ed', ',', 'runn', '##ing']      )
						self.assertListEqual(tokenizer.convert_tokens_to_ids(__snake_case      )      ,						[9, 6, 7, 12, 10, 11]      )





			def 	__magic_name__					(	self      )     ->				List[str]:




						'''simple docstring'''
						if not self.test_rust_tokenizer:
									return

						__a						   =self.get_tokenizer()
						__a						   =self.get_rust_tokenizer()

						__a						   ='UNwant\u00E9d,running'

						__a						   =tokenizer.tokenize(__snake_case      )
						__a						   =rust_tokenizer.tokenize(__snake_case      )
						self.assertListEqual(__snake_case      ,						__snake_case      )

						__a						   =tokenizer.encode(__snake_case      ,						add_special_tokens=__snake_case      )
						__a						   =rust_tokenizer.encode(__snake_case      ,						add_special_tokens=__snake_case      )
						self.assertListEqual(__snake_case      ,						__snake_case      )

						__a						   =self.get_rust_tokenizer()
						__a						   =tokenizer.encode(__snake_case      )
						__a						   =rust_tokenizer.encode(__snake_case      )
						self.assertListEqual(__snake_case      ,						__snake_case      )

						# With lower casing
						__a						   =self.get_tokenizer(do_lower_case=__snake_case      )
						__a						   =self.get_rust_tokenizer(do_lower_case=__snake_case      )

						__a						   ='UNwant\u00E9d,running'

						__a						   =tokenizer.tokenize(__snake_case      )
						__a						   =rust_tokenizer.tokenize(__snake_case      )
						self.assertListEqual(__snake_case      ,						__snake_case      )

						__a						   =tokenizer.encode(__snake_case      ,						add_special_tokens=__snake_case      )
						__a						   =rust_tokenizer.encode(__snake_case      ,						add_special_tokens=__snake_case      )
						self.assertListEqual(__snake_case      ,						__snake_case      )

						__a						   =self.get_rust_tokenizer()
						__a						   =tokenizer.encode(__snake_case      )
						__a						   =rust_tokenizer.encode(__snake_case      )
						self.assertListEqual(__snake_case      ,						__snake_case      )





			def 	__magic_name__					(	self      )     ->				List[Any]:




						'''simple docstring'''
						__a						   =BasicTokenizer()

						self.assertListEqual(tokenizer.tokenize('ah\u535A\u63A8zz'      )      ,						['ah', '\u535A', '\u63A8', 'zz']      )





			def 	__magic_name__					(	self      )     ->				int:




						'''simple docstring'''
						__a						   =BasicTokenizer(do_lower_case=__snake_case      )

						self.assertListEqual(
						    tokenizer.tokenize(' \tHeLLo!how  \n Are yoU?  '      )      ,						['hello', '!', 'how', 'are', 'you', '?']      )
						self.assertListEqual(tokenizer.tokenize('H\u00E9llo'      )      ,						['hello']      )





			def 	__magic_name__					(	self      )     ->				Optional[int]:




						'''simple docstring'''
						__a						   =BasicTokenizer(do_lower_case=__snake_case      ,						strip_accents=__snake_case      )

						self.assertListEqual(
						    tokenizer.tokenize(' \tHäLLo!how  \n Are yoU?  '      )      ,						['hällo', '!', 'how', 'are', 'you', '?']      )
						self.assertListEqual(tokenizer.tokenize('H\u00E9llo'      )      ,						['h\u00E9llo']      )





			def 	__magic_name__					(	self      )     ->				Optional[Any]:




						'''simple docstring'''
						__a						   =BasicTokenizer(do_lower_case=__snake_case      ,						strip_accents=__snake_case      )

						self.assertListEqual(
						    tokenizer.tokenize(' \tHäLLo!how  \n Are yoU?  '      )      ,						['hallo', '!', 'how', 'are', 'you', '?']      )
						self.assertListEqual(tokenizer.tokenize('H\u00E9llo'      )      ,						['hello']      )





			def 	__magic_name__					(	self      )     ->				int:




						'''simple docstring'''
						__a						   =BasicTokenizer(do_lower_case=__snake_case      )

						self.assertListEqual(
						    tokenizer.tokenize(' \tHäLLo!how  \n Are yoU?  '      )      ,						['hallo', '!', 'how', 'are', 'you', '?']      )
						self.assertListEqual(tokenizer.tokenize('H\u00E9llo'      )      ,						['hello']      )





			def 	__magic_name__					(	self      )     ->				List[str]:




						'''simple docstring'''
						__a						   =BasicTokenizer(do_lower_case=__snake_case      )

						self.assertListEqual(
						    tokenizer.tokenize(' \tHeLLo!how  \n Are yoU?  '      )      ,						['HeLLo', '!', 'how', 'Are', 'yoU', '?']      )





			def 	__magic_name__					(	self      )     ->				Tuple:




						'''simple docstring'''
						__a						   =BasicTokenizer(do_lower_case=__snake_case      ,						strip_accents=__snake_case      )

						self.assertListEqual(
						    tokenizer.tokenize(' \tHäLLo!how  \n Are yoU?  '      )      ,						['HäLLo', '!', 'how', 'Are', 'yoU', '?']      )





			def 	__magic_name__					(	self      )     ->				List[str]:




						'''simple docstring'''
						__a						   =BasicTokenizer(do_lower_case=__snake_case      ,						strip_accents=__snake_case      )

						self.assertListEqual(
						    tokenizer.tokenize(' \tHäLLo!how  \n Are yoU?  '      )      ,						['HaLLo', '!', 'how', 'Are', 'yoU', '?']      )





			def 	__magic_name__					(	self      )     ->				Optional[int]:




						'''simple docstring'''
						__a						   =BasicTokenizer(do_lower_case=__snake_case      ,						never_split=['[UNK]']      )

						self.assertListEqual(
						    tokenizer.tokenize(' \tHeLLo!how  \n Are yoU? [UNK]'      )      ,						['HeLLo', '!', 'how', 'Are', 'yoU', '?', '[UNK]']      )





			def 	__magic_name__					(	self      )     ->				int:




						'''simple docstring'''
						__a						   =['[UNK]', '[CLS]', '[SEP]', 'want', '##want', '##ed', 'wa', 'un', 'runn', '##ing']

						__a						   ={}
						for i, token in enumerate(__snake_case      ):
									__a						   =i
						__a						   =WordpieceTokenizer(vocab=__snake_case      ,						unk_token='[UNK]'      )

						self.assertListEqual(tokenizer.tokenize(''      )      ,						[]      )

						self.assertListEqual(tokenizer.tokenize('unwanted running'      )      ,						['un', '##want', '##ed', 'runn', '##ing']      )

						self.assertListEqual(tokenizer.tokenize('unwantedX running'      )      ,						['[UNK]', 'runn', '##ing']      )





			def 	__magic_name__					(	self      )     ->				Union[str, Any]:




						'''simple docstring'''
						self.assertTrue(_is_whitespace(' '      )      )
						self.assertTrue(_is_whitespace('\t'      )      )
						self.assertTrue(_is_whitespace('\r'      )      )
						self.assertTrue(_is_whitespace('\n'      )      )
						self.assertTrue(_is_whitespace('\u00A0'      )      )

						self.assertFalse(_is_whitespace('A'      )      )
						self.assertFalse(_is_whitespace('-'      )      )





			def 	__magic_name__					(	self      )     ->				Union[str, Any]:




						'''simple docstring'''
						self.assertTrue(_is_control('\u0005'      )      )

						self.assertFalse(_is_control('A'      )      )
						self.assertFalse(_is_control(' '      )      )
						self.assertFalse(_is_control('\t'      )      )
						self.assertFalse(_is_control('\r'      )      )





			def 	__magic_name__					(	self      )     ->				Tuple:




						'''simple docstring'''
						self.assertTrue(_is_punctuation('-'      )      )
						self.assertTrue(_is_punctuation('$'      )      )
						self.assertTrue(_is_punctuation('`'      )      )
						self.assertTrue(_is_punctuation('.'      )      )

						self.assertFalse(_is_punctuation('A'      )      )
						self.assertFalse(_is_punctuation(' '      )      )





			def 	__magic_name__					(	self      )     ->				int:




						'''simple docstring'''
						__a						   =self.get_tokenizer()

						# Example taken from the issue https://github.com/huggingface/tokenizers/issues/340
						self.assertListEqual([tokenizer.tokenize(__snake_case      ) for t in ['Test', '\xad', 'test']]      ,						[['[UNK]'], [], ['[UNK]']]      )

						if self.test_rust_tokenizer:
									__a						   =self.get_rust_tokenizer()
									self.assertListEqual(
									    [rust_tokenizer.tokenize(__snake_case      ) for t in ['Test', '\xad', 'test']]      ,						[['[UNK]'], [], ['[UNK]']]      )





			@slow
			def 	__magic_name__					(	self      )     ->				Dict:




						'''simple docstring'''
						__a						   =self.tokenizer_class.from_pretrained('bert-base-uncased'      )

						__a						   =tokenizer.encode('sequence builders'      ,						add_special_tokens=__snake_case      )
						__a						   =tokenizer.encode('multi-sequence build'      ,						add_special_tokens=__snake_case      )

						__a						   =tokenizer.build_inputs_with_special_tokens(__snake_case      )
						__a						   =tokenizer.build_inputs_with_special_tokens(__snake_case      ,						__snake_case      )

						assert encoded_sentence == [101] + text + [102]
						assert encoded_pair == [101] + text + [102] + text_a + [102]





			def 	__magic_name__					(	self      )     ->				Tuple:




						'''simple docstring'''
						for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
									with self.subTest(f'{tokenizer.__class__.__name__} ({pretrained_name})'      ):
												__a						   =self.rust_tokenizer_class.from_pretrained(__snake_case      ,						**__snake_case      )

												__a						   =f'A, naïve {tokenizer_r.mask_token} AllenNLP sentence.'
												__a						   =tokenizer_r.encode_plus(
												    __snake_case      ,						return_attention_mask=__snake_case      ,						return_token_type_ids=__snake_case      ,						return_offsets_mapping=__snake_case      ,						add_special_tokens=__snake_case      ,						)

												__a						   =tokenizer_r.do_lower_case if hasattr(__snake_case      ,						'do_lower_case'      ) else False
												__a						   =(
												    [
												        ((0, 0), tokenizer_r.cls_token),
												        ((0, 1), 'A'),
												        ((1, 2), ','),
												        ((3, 5), 'na'),
												        ((5, 6), '##ï'),
												        ((6, 8), '##ve'),
												        ((9, 15), tokenizer_r.mask_token),
												        ((16, 21), 'Allen'),
												        ((21, 23), '##NL'),
												        ((23, 24), '##P'),
												        ((25, 33), 'sentence'),
												        ((33, 34), '.'),
												        ((0, 0), tokenizer_r.sep_token),
												    ]
												    if not do_lower_case
												    else [
												        ((0, 0), tokenizer_r.cls_token),
												        ((0, 1), 'a'),
												        ((1, 2), ','),
												        ((3, 8), 'naive'),
												        ((9, 15), tokenizer_r.mask_token),
												        ((16, 21), 'allen'),
												        ((21, 23), '##nl'),
												        ((23, 24), '##p'),
												        ((25, 33), 'sentence'),
												        ((33, 34), '.'),
												        ((0, 0), tokenizer_r.sep_token),
												    ]
												)

												self.assertEqual(
												    [e[1] for e in expected_results]      ,						tokenizer_r.convert_ids_to_tokens(tokens['input_ids']      )      )
												self.assertEqual([e[0] for e in expected_results]      ,						tokens['offset_mapping']      )





			@slow
			def 	__magic_name__					(	self      )     ->				Union[str, Any]:




						'''simple docstring'''
						for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
									with self.subTest(f'{tokenizer.__class__.__name__} ({pretrained_name})'      ):
												__a						   =self.rust_tokenizer_class.from_pretrained(__snake_case      ,						**__snake_case      )
												__a						   =self.tokenizer_class.from_pretrained(__snake_case      ,						**__snake_case      )
												__a						   =[['Hello world!', 'Nice to meet you!'], ['The cute cat.', 'The adorable dog.']]

												__a						   =tokenizer_r.batch_encode_candidates(__snake_case      ,						max_length=10      ,						return_tensors='np'      )
												__a						   =tokenizer_p.batch_encode_candidates(__snake_case      ,						max_length=10      ,						return_tensors='np'      )

												__a						   =(2, 2, 10)

												self.assertEqual(encoded_sentence_r['input_ids'].shape      ,						__snake_case      )
												self.assertEqual(encoded_sentence_r['attention_mask'].shape      ,						__snake_case      )
												self.assertEqual(encoded_sentence_r['token_type_ids'].shape      ,						__snake_case      )

												self.assertEqual(encoded_sentence_p['input_ids'].shape      ,						__snake_case      )
												self.assertEqual(encoded_sentence_p['attention_mask'].shape      ,						__snake_case      )
												self.assertEqual(encoded_sentence_p['token_type_ids'].shape      ,						__snake_case      )









from collections import OrderedDict
from typing import Any, Mapping, Optional

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


_lowerCAmelCase      :    str						       =    logging.get_logger(__name__)

_lowerCAmelCase      :    List[str]						       =    {
    "facebook/mbart-large-cc25": "https://huggingface.co/facebook/mbart-large-cc25/resolve/main/config.json",
    # See all MBART models at https://huggingface.co/models?filter=mbart
}






class 			__magic_name__					(    lowerCAmelCase_   ):
			SCREAMING_SNAKE_CASE							     =		'mbart'
			SCREAMING_SNAKE_CASE							     =		['past_key_values']
			SCREAMING_SNAKE_CASE							     =		{'num_attention_heads': 'encoder_attention_heads', 'hidden_size': 'd_model'}





			def __init__(	self      ,						__snake_case=5_0265      ,						__snake_case=1024      ,						__snake_case=12      ,						__snake_case=4096      ,						__snake_case=16      ,						__snake_case=12      ,						__snake_case=4096      ,						__snake_case=16      ,						__snake_case=0.0      ,						__snake_case=0.0      ,						__snake_case=True      ,						__snake_case=True      ,						__snake_case="gelu"      ,						__snake_case=1024      ,						__snake_case=0.1      ,						__snake_case=0.0      ,						__snake_case=0.0      ,						__snake_case=0.02      ,						__snake_case=0.0      ,						__snake_case=False      ,						__snake_case=1      ,						__snake_case=0      ,						__snake_case=2      ,						__snake_case=2      ,						**__snake_case      ,						)     ->				Optional[Any]:




						'''simple docstring'''
						__a						   =vocab_size
						__a						   =max_position_embeddings
						__a						   =d_model
						__a						   =encoder_ffn_dim
						__a						   =encoder_layers
						__a						   =encoder_attention_heads
						__a						   =decoder_ffn_dim
						__a						   =decoder_layers
						__a						   =decoder_attention_heads
						__a						   =dropout
						__a						   =attention_dropout
						__a						   =activation_dropout
						__a						   =activation_function
						__a						   =init_std
						__a						   =encoder_layerdrop
						__a						   =decoder_layerdrop
						__a						   =classifier_dropout
						__a						   =use_cache
						__a						   =encoder_layers
						__a						   =scale_embedding  # scale factor will be sqrt(d_model) if True
						super().__init__(
						    pad_token_id=__snake_case      ,						bos_token_id=__snake_case      ,						eos_token_id=__snake_case      ,						is_encoder_decoder=__snake_case      ,						forced_eos_token_id=__snake_case      ,						**__snake_case      ,						)






class 			__magic_name__					(    lowerCAmelCase_   ):





			@property
			def 	__magic_name__					(	self      )     ->				Mapping[str, Mapping[int, str]]:




						'''simple docstring'''
						if self.task in ["default", "seq2seq-lm"]:
									__a						   =OrderedDict(
									    [
									        ('input_ids', {0: 'batch', 1: 'encoder_sequence'}),
									        ('attention_mask', {0: 'batch', 1: 'encoder_sequence'}),
									    ]      )

									if self.use_past:
												__a						   ={0: 'batch'}
												__a						   ={0: 'batch', 1: 'past_decoder_sequence + sequence'}
									else:
												__a						   ={0: 'batch', 1: 'decoder_sequence'}
												__a						   ={0: 'batch', 1: 'decoder_sequence'}

									if self.use_past:
												self.fill_with_past_key_values_(__snake_case      ,						direction='inputs'      )
						elif self.task == "causal-lm":
									# TODO: figure this case out.
									__a						   =OrderedDict(
									    [
									        ('input_ids', {0: 'batch', 1: 'encoder_sequence'}),
									        ('attention_mask', {0: 'batch', 1: 'encoder_sequence'}),
									    ]      )
									if self.use_past:
												__a   ,					__a						   =self.num_layers
												for i in range(__snake_case      ):
															__a						   ={0: 'batch', 2: 'past_sequence + sequence'}
															__a						   ={0: 'batch', 2: 'past_sequence + sequence'}
						else:
									__a						   =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 	__magic_name__					(	self      )     ->				Mapping[str, Mapping[int, str]]:




						'''simple docstring'''
						if self.task in ["default", "seq2seq-lm"]:
									__a						   =super().outputs
						else:
									__a						   =super(__snake_case      ,						self      ).outputs
									if self.use_past:
												__a   ,					__a						   =self.num_layers
												for i in range(__snake_case      ):
															__a						   ={0: 'batch', 2: 'past_sequence + sequence'}
															__a						   ={0: 'batch', 2: 'past_sequence + sequence'}
						return common_outputs





			def 	__magic_name__					(	self      ,						__snake_case      ,						__snake_case = -1      ,						__snake_case = -1      ,						__snake_case = False      ,						__snake_case = None      ,						)     ->				Mapping[str, Any]:




						'''simple docstring'''
						__a						   =self._generate_dummy_inputs_for_sequence_classification_and_question_answering(
						    __snake_case      ,						__snake_case      ,						__snake_case      ,						__snake_case      ,						__snake_case      )

						# Generate decoder inputs
						__a						   =seq_length if not self.use_past else 1
						__a						   =self._generate_dummy_inputs_for_sequence_classification_and_question_answering(
						    __snake_case      ,						__snake_case      ,						__snake_case      ,						__snake_case      ,						__snake_case      )
						__a						   ={f'decoder_{name}': tensor for name, tensor in decoder_inputs.items()}
						__a						   =dict(**__snake_case      ,						**__snake_case      )

						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						   =common_inputs['input_ids'].shape
									__a						   =common_inputs['decoder_input_ids'].shape[1]
									__a   ,					__a						   =self.num_attention_heads
									__a						   =(
									    batch,
									    num_encoder_attention_heads,
									    encoder_seq_length,
									    self._config.hidden_size // num_encoder_attention_heads,
									)
									__a						   =decoder_seq_length + 3
									__a						   =(
									    batch,
									    num_decoder_attention_heads,
									    decoder_past_length,
									    self._config.hidden_size // num_decoder_attention_heads,
									)

									__a						   =torch.cat(
									    [common_inputs['decoder_attention_mask'], torch.ones(__snake_case      ,						__snake_case      )]      ,						dim=1      )

									__a						   =[]
									# If the number of encoder and decoder layers are present in the model configuration, both are considered
									__a   ,					__a						   =self.num_layers
									__a						   =min(__snake_case      ,						__snake_case      )
									__a						   =max(__snake_case      ,						__snake_case      ) - min_num_layers
									__a						   ='encoder' if num_encoder_layers > num_decoder_layers else 'decoder'

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





			def 	__magic_name__					(	self      ,						__snake_case      ,						__snake_case = -1      ,						__snake_case = -1      ,						__snake_case = False      ,						__snake_case = None      ,						)     ->				Mapping[str, Any]:




						'''simple docstring'''
						__a						   =self._generate_dummy_inputs_for_sequence_classification_and_question_answering(
						    __snake_case      ,						__snake_case      ,						__snake_case      ,						__snake_case      ,						__snake_case      )

						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						   =common_inputs['input_ids'].shape
									# Not using the same length for past_key_values
									__a						   =seqlen + 2
									__a   ,					__a						   =self.num_layers
									__a   ,					__a						   =self.num_attention_heads
									__a						   =(
									    batch,
									    num_encoder_attention_heads,
									    past_key_values_length,
									    self._config.hidden_size // num_encoder_attention_heads,
									)

									__a						   =common_inputs['attention_mask'].dtype
									__a						   =torch.cat(
									    [common_inputs['attention_mask'], torch.ones(__snake_case      ,						__snake_case      ,						dtype=__snake_case      )]      ,						dim=1      )
									__a						   =[
									    (torch.zeros(__snake_case      ), torch.zeros(__snake_case      )) for _ in range(__snake_case      )
									]
						return common_inputs





			def 	__magic_name__					(	self      ,						__snake_case      ,						__snake_case = -1      ,						__snake_case = -1      ,						__snake_case = False      ,						__snake_case = None      ,						)     ->				Mapping[str, Any]:




						'''simple docstring'''
						# 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						   =compute_effective_axis_dimension(
						    __snake_case      ,						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						   =tokenizer.num_special_tokens_to_add(__snake_case      )
						__a						   =compute_effective_axis_dimension(
						    __snake_case      ,						fixed_dimension=OnnxConfig.default_fixed_sequence      ,						num_token_to_add=__snake_case      )

						# Generate dummy inputs according to compute batch and sequence
						__a						   =[' '.join([tokenizer.unk_token]      ) * seq_length] * batch_size
						__a						   =dict(tokenizer(__snake_case      ,						return_tensors=__snake_case      )      )
						return common_inputs





			def 	__magic_name__					(	self      ,						__snake_case      ,						__snake_case = -1      ,						__snake_case = -1      ,						__snake_case = False      ,						__snake_case = None      ,						)     ->				Mapping[str, Any]:




						'''simple docstring'''
						if self.task in ["default", "seq2seq-lm"]:
									__a						   =self._generate_dummy_inputs_for_default_and_seqaseq_lm(
									    __snake_case      ,						batch_size=__snake_case      ,						seq_length=__snake_case      ,						is_pair=__snake_case      ,						framework=__snake_case      )

						elif self.task == "causal-lm":
									__a						   =self._generate_dummy_inputs_for_causal_lm(
									    __snake_case      ,						batch_size=__snake_case      ,						seq_length=__snake_case      ,						is_pair=__snake_case      ,						framework=__snake_case      )
						else:
									__a						   =self._generate_dummy_inputs_for_sequence_classification_and_question_answering(
									    __snake_case      ,						batch_size=__snake_case      ,						seq_length=__snake_case      ,						is_pair=__snake_case      ,						framework=__snake_case      )

						return common_inputs





			def 	__magic_name__					(	self      ,						__snake_case      ,						__snake_case      ,						__snake_case      ,						__snake_case      )     ->				str:




						'''simple docstring'''
						if self.task in ["default", "seq2seq-lm"]:
									__a						   =super()._flatten_past_key_values_(__snake_case      ,						__snake_case      ,						__snake_case      ,						__snake_case      )
						else:
									__a						   =super(__snake_case      ,						self      )._flatten_past_key_values_(
									    __snake_case      ,						__snake_case      ,						__snake_case      ,						__snake_case      )






