



'''simple docstring'''
from collections import OrderedDict
from typing import TYPE_CHECKING, Any, List, Mapping, Optional

from packaging import version


if TYPE_CHECKING:
					from ... import PreTrainedTokenizer, TensorType

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


snake_case_					:      Any    			=    logging.get_logger(__name__)

snake_case_					:      int    			=    {
    'bigscience/bloom': 'https://huggingface.co/bigscience/bloom/resolve/main/config.json',
    'bigscience/bloom-560m': 'https://huggingface.co/bigscience/bloom-560m/blob/main/config.json',
    'bigscience/bloom-1b1': 'https://huggingface.co/bigscience/bloom-1b1/blob/main/config.json',
    'bigscience/bloom-1b7': 'https://huggingface.co/bigscience/bloom-1b7/blob/main/config.json',
    'bigscience/bloom-3b': 'https://huggingface.co/bigscience/bloom-3b/blob/main/config.json',
    'bigscience/bloom-7b1': 'https://huggingface.co/bigscience/bloom-7b1/blob/main/config.json',
}






class 				lowercase__      (				lowercase  ):
	lowercase__    							=     """bloom"""
	lowercase__    							=     ["""past_key_values"""]
	lowercase__    							=     {
	    """num_hidden_layers""": """n_layer""",
	    """num_attention_heads""": """n_head""",
	}





	def __init__(					self   :							Optional[Any]					,lowerCamelCase__   :							Optional[int]=250880					,lowerCamelCase__   :							Any=64					,lowerCamelCase__   :							Optional[Any]=2					,lowerCamelCase__   :							Any=8					,lowerCamelCase__   :							str=1E-5					,lowerCamelCase__   :							Union[str, Any]=0.0_2					,lowerCamelCase__   :							Union[str, Any]=True					,lowerCamelCase__   :							Union[str, Any]=1					,lowerCamelCase__   :							Optional[Any]=2					,lowerCamelCase__   :							int=False					,lowerCamelCase__   :							Optional[int]=0.0					,lowerCamelCase__   :							List[Any]=0.0					,lowerCamelCase__   :							Optional[int]=1					,lowerCamelCase__   :							List[Any]=False					,**lowerCamelCase__   :							int					,):







							'''simple docstring'''
							_UpperCamelCase   :						Tuple												=  vocab_size
							# Backward compatibility with n_embed kwarg
							_UpperCamelCase   :						int												=  kwargs.pop('n_embed'					,lowerCamelCase__					)
							_UpperCamelCase   :						str												=  hidden_size if n_embed is None else n_embed
							_UpperCamelCase   :						str												=  n_layer
							_UpperCamelCase   :						Any												=  n_head
							_UpperCamelCase   :						Optional[int]												=  layer_norm_epsilon
							_UpperCamelCase   :						Any												=  initializer_range
							_UpperCamelCase   :						Optional[int]												=  use_cache
							_UpperCamelCase   :						Optional[int]												=  pretraining_tp
							_UpperCamelCase   :						List[str]												=  apply_residual_connection_post_layernorm
							_UpperCamelCase   :						str												=  hidden_dropout
							_UpperCamelCase   :						Tuple												=  attention_dropout

							_UpperCamelCase   :						Any												=  bos_token_id
							_UpperCamelCase   :						str												=  eos_token_id
							_UpperCamelCase   :						Any												=  slow_but_exact

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






class 				lowercase__      (				lowercase  ):
	lowercase__    							=     version.parse("""1.12"""  )





	def __init__(					self   :							Union[str, Any]					,lowerCamelCase__   :							PretrainedConfig					,lowerCamelCase__   :							str = "default"					,lowerCamelCase__   :							List[PatchingSpec] = None					,lowerCamelCase__   :							bool = False					,):







							'''simple docstring'''
							super().__init__(lowerCamelCase__					,task=lowerCamelCase__					,patching_specs=lowerCamelCase__					,use_past=lowerCamelCase__					)
							if not getattr(self._config					,'pad_token_id'					,lowerCamelCase__					):
													# TODO: how to do that better?
													_UpperCamelCase   :						Optional[int]												=  0





	@property
	def       UpperCamelCase_    (					self   :							Dict					):







							'''simple docstring'''
							_UpperCamelCase   :						int												=  OrderedDict({'input_ids': {0: 'batch', 1: 'sequence'}}					)
							if self.use_past:
													# BLOOM stores values on dynamic axis 2. For more details see: https://github.com/huggingface/transformers/pull/18344
													self.fill_with_past_key_values_(lowerCamelCase__					,direction='inputs'					,inverted_values_shape=lowerCamelCase__					)
													_UpperCamelCase   :						List[str]												=  {0: 'batch', 1: 'past_sequence + sequence'}
							else:
													_UpperCamelCase   :						Optional[int]												=  {0: 'batch', 1: 'sequence'}

							return common_inputs





	@property
	def       UpperCamelCase_    (					self   :							Dict					):







							'''simple docstring'''
							return self._config.n_layer





	@property
	def       UpperCamelCase_    (					self   :							Any					):







							'''simple docstring'''
							return self._config.n_head





	@property
	def       UpperCamelCase_    (					self   :							Optional[Any]					):







							'''simple docstring'''
							return 1E-3





	def       UpperCamelCase_    (					self   :							Tuple					,lowerCamelCase__   :							"PreTrainedTokenizer"					,lowerCamelCase__   :							int = -1					,lowerCamelCase__   :							int = -1					,lowerCamelCase__   :							bool = False					,lowerCamelCase__   :							Optional["TensorType"] = None					,):







							'''simple docstring'''
							_UpperCamelCase   :						List[str]												=  super(lowerCamelCase__					,self					).generate_dummy_inputs(
							    lowerCamelCase__					,batch_size=lowerCamelCase__					,seq_length=lowerCamelCase__					,is_pair=lowerCamelCase__					,framework=lowerCamelCase__					)

							# We need to order the input in the way they appears in the forward()
							_UpperCamelCase   :						Optional[Any]												=  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   :						Union[str, Any]												=  common_inputs['input_ids'].shape
																			# Not using the same length for past_key_values
																			_UpperCamelCase   :						Union[str, Any]												=  seqlen + 2
																			_UpperCamelCase   :						Any												=  self._config.hidden_size // self.num_attention_heads
																			_UpperCamelCase   :						List[str]												=  (
																			    batch * self.num_attention_heads,
																			    head_dim,
																			    past_key_values_length,
																			)
																			_UpperCamelCase   :						int												=  (
																			    batch * self.num_attention_heads,
																			    past_key_values_length,
																			    head_dim,
																			)
																			_UpperCamelCase   :						Tuple												=  [
																			    (torch.zeros(lowerCamelCase__					), torch.zeros(lowerCamelCase__					)) for _ in range(self.num_layers					)
																			]

							_UpperCamelCase   :						str												=  common_inputs['attention_mask']
							if self.use_past:
													_UpperCamelCase   :						Optional[Any]												=  ordered_inputs['attention_mask'].dtype
													_UpperCamelCase   :						Dict												=  torch.cat(
													    [ordered_inputs['attention_mask'], torch.ones(lowerCamelCase__					,lowerCamelCase__					,dtype=lowerCamelCase__					)]					,dim=1					)

							return ordered_inputs





	@property
	def       UpperCamelCase_    (					self   :							Optional[int]					):







							'''simple docstring'''
							return 13







'''simple docstring'''
def A__       (	UpperCAmelCase_    ,    UpperCAmelCase_				):
						return base * power(UpperCAmelCase_    ,    (exponent - 1)				) if exponent else 1


if __name__ == "__main__":
					print('Raise base to the power of exponent using recursion...')
					snake_case_					:      int    			=    int(input('Enter the base: ').strip())
					snake_case_					:      Optional[int]    			=    int(input('Enter the exponent: ').strip())
					snake_case_					:      Optional[int]    			=    power(base, abs(exponent))
					if exponent < 0:  # power() does not properly deal w/ negative exponents
										snake_case_					:      List[Any]    			=    1 / result
					print(F"""{base} to the power of {exponent} is {result}""")


