"""simple docstring"""

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

from ... import PreTrainedTokenizer, TensorType, is_torch_available
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfigWithPast, PatchingSpec
from ...utils import logging


__lowercase    =				logging.get_logger(__name__)

__lowercase    =				{
    '''gpt2''': '''https://huggingface.co/gpt2/resolve/main/config.json''',
    '''gpt2-medium''': '''https://huggingface.co/gpt2-medium/resolve/main/config.json''',
    '''gpt2-large''': '''https://huggingface.co/gpt2-large/resolve/main/config.json''',
    '''gpt2-xl''': '''https://huggingface.co/gpt2-xl/resolve/main/config.json''',
    '''distilgpt2''': '''https://huggingface.co/distilgpt2/resolve/main/config.json''',
}






class 		_lowercase (						__a      ):



						"""simple docstring"""




						lowercase__       =  '''gpt2'''
						lowercase__       =  ['''past_key_values''']
						lowercase__       =  {
						    '''hidden_size''': '''n_embd''',
						    '''max_position_embeddings''': '''n_positions''',
						    '''num_attention_heads''': '''n_head''',
						    '''num_hidden_layers''': '''n_layer''',
						}





						def __init__(				self							:    Optional[Any]     , UpperCamelCase__							:    int=50257     , UpperCamelCase__							:    List[Any]=1024     , UpperCamelCase__							:    str=768     , UpperCamelCase__							:    Tuple=12     , UpperCamelCase__							:    List[Any]=12     , UpperCamelCase__							:    Tuple=None     , UpperCamelCase__							:    List[Any]="gelu_new"     , UpperCamelCase__							:    List[str]=0.1     , UpperCamelCase__							:    Union[str, Any]=0.1     , UpperCamelCase__							:    Optional[int]=0.1     , UpperCamelCase__							:    Dict=1E-5     , UpperCamelCase__							:    Tuple=0.02     , UpperCamelCase__							:    Tuple="cls_index"     , UpperCamelCase__							:    Tuple=True     , UpperCamelCase__							:    int=None     , UpperCamelCase__							:    Tuple=True     , UpperCamelCase__							:    List[Any]=0.1     , UpperCamelCase__							:    int=True     , UpperCamelCase__							:    Any=True     , UpperCamelCase__							:    Tuple=50256     , UpperCamelCase__							:    List[Any]=50256     , UpperCamelCase__							:    Optional[int]=False     , UpperCamelCase__							:    Dict=False     , **UpperCamelCase__							:    Optional[int]     , )				->				int:
													'''simple docstring'''



													__UpperCamelCase							=vocab_size
													__UpperCamelCase							=n_positions
													__UpperCamelCase							=n_embd
													__UpperCamelCase							=n_layer
													__UpperCamelCase							=n_head
													__UpperCamelCase							=n_inner
													__UpperCamelCase							=activation_function
													__UpperCamelCase							=resid_pdrop
													__UpperCamelCase							=embd_pdrop
													__UpperCamelCase							=attn_pdrop
													__UpperCamelCase							=layer_norm_epsilon
													__UpperCamelCase							=initializer_range
													__UpperCamelCase							=summary_type
													__UpperCamelCase							=summary_use_proj
													__UpperCamelCase							=summary_activation
													__UpperCamelCase							=summary_first_dropout
													__UpperCamelCase							=summary_proj_to_labels
													__UpperCamelCase							=scale_attn_weights
													__UpperCamelCase							=use_cache
													__UpperCamelCase							=scale_attn_by_inverse_layer_idx
													__UpperCamelCase							=reorder_and_upcast_attn

													__UpperCamelCase							=bos_token_id
													__UpperCamelCase							=eos_token_id

													super().__init__(bos_token_id=UpperCamelCase__     , eos_token_id=UpperCamelCase__     , **UpperCamelCase__				)






class 		_lowercase (						__a      ):



						"""simple docstring"""




						def __init__(				self							:    int     , UpperCamelCase__							:    PretrainedConfig     , UpperCamelCase__							:    str = "default"     , UpperCamelCase__							:    List[PatchingSpec] = None     , UpperCamelCase__							:    bool = False     , )				->				str:
													'''simple docstring'''



													super().__init__(UpperCamelCase__     , task=UpperCamelCase__     , patching_specs=UpperCamelCase__     , use_past=UpperCamelCase__				)
													if not getattr(self._config     , '''pad_token_id'''     , UpperCamelCase__				):
																				# TODO: how to do that better?
																				__UpperCamelCase							=0





						@property
						def   UpperCAmelCase_ (				self							:    Optional[int]				)				->				Mapping[str, Mapping[int, str]]:
													'''simple docstring'''



													__UpperCamelCase							=OrderedDict({'''input_ids''': {0: '''batch''', 1: '''sequence'''}}				)
													if self.use_past:
																				self.fill_with_past_key_values_(UpperCamelCase__     , direction='''inputs'''				)
																				__UpperCamelCase							={0: '''batch''', 1: '''past_sequence + sequence'''}
													else:
																				__UpperCamelCase							={0: '''batch''', 1: '''sequence'''}

													return common_inputs





						@property
						def   UpperCAmelCase_ (				self							:    Any				)				->				int:
													'''simple docstring'''



													return self._config.n_layer





						@property
						def   UpperCAmelCase_ (				self							:    int				)				->				int:
													'''simple docstring'''



													return self._config.n_head





						def   UpperCAmelCase_ (				self							:    List[str]     , UpperCamelCase__							:    PreTrainedTokenizer     , UpperCamelCase__							:    int = -1     , UpperCamelCase__							:    int = -1     , UpperCamelCase__							:    bool = False     , UpperCamelCase__							:    Optional[TensorType] = None     , )				->				Mapping[str, Any]:
													'''simple docstring'''



													__UpperCamelCase							=super(UpperCamelCase__     , self				).generate_dummy_inputs(
													    UpperCamelCase__     , batch_size=UpperCamelCase__     , seq_length=UpperCamelCase__     , is_pair=UpperCamelCase__     , framework=UpperCamelCase__				)

													# We need to order the input in the way they appears in the forward()
													__UpperCamelCase							=OrderedDict({'''input_ids''': common_inputs['''input_ids''']}				)

													# Need to add the past_keys
													if self.use_past:
																				if not is_torch_available():
																											raise ValueError('''Cannot generate dummy past_keys inputs without PyTorch installed.'''				)
																				else:
																											import torch

																											__UpperCamelCase	,      __UpperCamelCase							=common_inputs['''input_ids'''].shape
																											# Not using the same length for past_key_values
																											__UpperCamelCase							=seqlen + 2
																											__UpperCamelCase							=(
																											    batch,
																											    self.num_attention_heads,
																											    past_key_values_length,
																											    self._config.hidden_size // self.num_attention_heads,
																											)
																											__UpperCamelCase							=[
																											    (torch.zeros(UpperCamelCase__				), torch.zeros(UpperCamelCase__				)) for _ in range(self.num_layers				)
																											]

													__UpperCamelCase							=common_inputs['''attention_mask''']
													if self.use_past:
																				__UpperCamelCase							=ordered_inputs['''attention_mask'''].dtype
																				__UpperCamelCase							=torch.cat(
																				    [ordered_inputs['''attention_mask'''], torch.ones(UpperCamelCase__     , UpperCamelCase__     , dtype=UpperCamelCase__				)]     , dim=1				)

													return ordered_inputs





						@property
						def   UpperCAmelCase_ (				self							:    Optional[Any]				)				->				int:
													'''simple docstring'''



													return 13




"""simple docstring"""

from collections import defaultdict


def    lowerCAmelCase			(__UpperCamelCase							:    int = 5			):
							"""simple docstring"""


							__UpperCamelCase							=defaultdict(__UpperCamelCase			)
							__UpperCamelCase							=0

							while True:
														__UpperCamelCase							=get_digits(__UpperCamelCase			)
														freqs[digits].append(__UpperCamelCase			)

														if len(freqs[digits]			) == max_base:
																					__UpperCamelCase							=freqs[digits][0] ** 3
																					return base

														num += 1


def    lowerCAmelCase			(__UpperCamelCase							:    int			):
							"""simple docstring"""


							return "".join(sorted(str(num**3			)			)			)


if __name__ == "__main__":
				print(f'''{solution() = }''')



