


'''simple docstring'''



from math import factorial


def 				lowerCamelCase__				(	A       :      int				,       A       :      int				,       A       :      float					):




						'''simple docstring'''






						if successes > trials:
												raise ValueError('''successes must be lower or equal to trials'''					)
						if trials < 0 or successes < 0:
												raise ValueError('''the function is defined for non-negative integers'''					)
						if not isinstance(A				,       A					) or not isinstance(A				,       A					):
												raise ValueError('''the function is defined for non-negative integers'''					)
						if not 0 < prob < 1:
												raise ValueError('''prob has to be in range of 1 - 0'''					)
						UpperCAmelCase					    =     (prob**successes) * ((1 - prob) ** (trials - successes))
						# Calculate the binomial coefficient: n! / k!(n-k)!
						UpperCAmelCase					    =     float(factorial(A					)					)
						coefficient /= factorial(A					) * factorial(trials - successes					)
						return probability * coefficient


if __name__ == "__main__":
	from doctest import testmod

	testmod()
	print("""Probability of 2 successes out of 4 trails""")
	print("""with probability of 0.75 is:""", end=""" """)
	print(binomial_distribution(2, 4, 0.75))









'''simple docstring'''



from ...configuration_utils import PretrainedConfig
from ...utils import logging


_lowercase      :      int            =					logging.get_logger(__name__)

_lowercase      :      Optional[Any]            =					{"""openai-gpt""": """https://huggingface.co/openai-gpt/resolve/main/config.json"""}






class 	UpperCamelCase__(       lowerCAmelCase	):
				__magic_name__    :				Union[str, Any]  		=	"openai-gpt"
				__magic_name__    :				Optional[int]  		=	{
				    "max_position_embeddings": "n_positions",
				    "hidden_size": "n_embd",
				    "num_attention_heads": "n_head",
				    "num_hidden_layers": "n_layer",
				}




				def __init__(		self      :			Optional[int]				,   lowerCAmelCase      :			Optional[Any]=40478				,   lowerCAmelCase      :			str=512				,   lowerCAmelCase      :			List[Any]=768				,   lowerCAmelCase      :			Tuple=12				,   lowerCAmelCase      :			int=12				,   lowerCAmelCase      :			List[str]="gelu"				,   lowerCAmelCase      :			List[str]=0.1				,   lowerCAmelCase      :			List[Any]=0.1				,   lowerCAmelCase      :			Dict=0.1				,   lowerCAmelCase      :			Tuple=1E-5				,   lowerCAmelCase      :			Tuple=0.02				,   lowerCAmelCase      :			Optional[int]="cls_index"				,   lowerCAmelCase      :			Dict=True				,   lowerCAmelCase      :			Optional[int]=None				,   lowerCAmelCase      :			Dict=True				,   lowerCAmelCase      :			int=0.1				,   **lowerCAmelCase      :			Optional[int]				,   )->					str:

										"""simple docstring"""




										UpperCAmelCase					    =     vocab_size
										UpperCAmelCase					    =     n_positions
										UpperCAmelCase					    =     n_embd
										UpperCAmelCase					    =     n_layer
										UpperCAmelCase					    =     n_head
										UpperCAmelCase					    =     afn
										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
										super().__init__(**lowerCAmelCase				)





