





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


UpperCamelCase_												=	logging.get_logger(__name__)

UpperCamelCase_												=	{
    '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     snake_case_		(   a							):






 '''simple docstring'''





 __UpperCamelCase       =      'bloom'
 __UpperCamelCase       =      ['past_key_values']
 __UpperCamelCase       =      {
     'num_hidden_layers': 'n_layer',
     'num_attention_heads': 'n_head',
 }

 def __init__(  self,		A_=25_0880,		A_=64,		A_=2,		A_=8,		A_=1E-5,		A_=0.02,		A_=True,		A_=1,		A_=2,		A_=False,		A_=0.0,		A_=0.0,		A_=1,		A_=False,		**A_,		)	->       Union[str, Any]:
    UpperCAmelCase__						=vocab_size
    # Backward compatibility with n_embed kwarg
    UpperCAmelCase__						=kwargs.pop("n_embed",		A_		)
    UpperCAmelCase__						=hidden_size if n_embed is None else n_embed
    UpperCAmelCase__						=n_layer
    UpperCAmelCase__						=n_head
    UpperCAmelCase__						=layer_norm_epsilon
    UpperCAmelCase__						=initializer_range
    UpperCAmelCase__						=use_cache
    UpperCAmelCase__						=pretraining_tp
    UpperCAmelCase__						=apply_residual_connection_post_layernorm
    UpperCAmelCase__						=hidden_dropout
    UpperCAmelCase__						=attention_dropout

    UpperCAmelCase__						=bos_token_id
    UpperCAmelCase__						=eos_token_id
    UpperCAmelCase__						=slow_but_exact

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

class     snake_case_		(   a							):






 '''simple docstring'''





 __UpperCamelCase       =      version.parse('1.12'							)

 def __init__(  self,		A_,		A_ = "default",		A_ = None,		A_ = False,		)	->       Any:
    super().__init__(A_,		task=A_,		patching_specs=A_,		use_past=A_		)
    if not getattr(self._config,		"pad_token_id",		A_		):
       # TODO: how to do that better?
       UpperCAmelCase__						=0

 @property
 def  __UpperCAmelCase						(  self		)	->       Mapping[str, Mapping[int, str]]:
    UpperCAmelCase__						=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_(A_,		direction="inputs",		inverted_values_shape=A_		)
       UpperCAmelCase__						={0: "batch", 1: "past_sequence + sequence"}
    else:
       UpperCAmelCase__						={0: "batch", 1: "sequence"}

    return common_inputs

 @property
 def  __UpperCAmelCase						(  self		)	->       int:
    return self._config.n_layer

 @property
 def  __UpperCAmelCase						(  self		)	->       int:
    return self._config.n_head

 @property
 def  __UpperCAmelCase						(  self		)	->       float:
    return 1E-3

 def  __UpperCAmelCase						(  self,		A_,		A_ = -1,		A_ = -1,		A_ = False,		A_ = None,		)	->       Mapping[str, Any]:
    UpperCAmelCase__						=super(A_,		self		).generate_dummy_inputs(
        A_,		batch_size=A_,		seq_length=A_,		is_pair=A_,		framework=A_		)

    # 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__						=self._config.hidden_size // self.num_attention_heads
          UpperCAmelCase__						=(
              batch * self.num_attention_heads,
              head_dim,
              past_key_values_length,
          )
          UpperCAmelCase__						=(
              batch * self.num_attention_heads,
              past_key_values_length,
              head_dim,
          )
          UpperCAmelCase__						=[
              (torch.zeros(A_		), torch.zeros(A_		)) 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(A_,		A_,		dtype=A_		)],		dim=1		)

    return ordered_inputs






 @property
 def  __UpperCAmelCase						(  self		)	->       int:
    return 13










from math import factorial






def 				_UpperCAmelCase			(    A = 20     ):




   '''simple docstring'''

   UpperCAmelCase__						=2 * n  # middle entry of odd rows starting at row 3 is the solution for n = 1,
   # 2, 3,...
   UpperCAmelCase__						=n // 2

   return int(factorial(A     ) / (factorial(A     ) * factorial(n - k     ))     )


if __name__ == "__main__":
    import sys

    if len(sys.argv) == 1:
        print(solution(20))
    else:
        try:
            UpperCamelCase_												=	int(sys.argv[1])
            print(solution(n))
        except ValueError:
            print('Invalid entry - please enter a number.')



