


'''simple docstring'''



def 				lowerCamelCase__				(	A       :      Tuple				,       A       :      str					):




						'''simple docstring'''






						UpperCAmelCase					    =     0
						UpperCAmelCase					    =     len(__A					) - 1

						while left <= right:
												# avoid divided by 0 during interpolation
												if sorted_collection[left] == sorted_collection[right]:
																		if sorted_collection[left] == item:
																								return left
																		else:
																								return None

												UpperCAmelCase					    =     left + ((item - sorted_collection[left]) * (right - left)) // (
												    sorted_collection[right] - sorted_collection[left]
												)

												# out of range check
												if point < 0 or point >= len(__A					):
																		return None

												UpperCAmelCase					    =     sorted_collection[point]
												if current_item == item:
																		return point
												else:
																		if point < left:
																								UpperCAmelCase					    =     left
																								UpperCAmelCase					    =     point
																		elif point > right:
																								UpperCAmelCase					    =     right
																								UpperCAmelCase					    =     point
																		else:
																								if item < current_item:
																														UpperCAmelCase					    =     point - 1
																								else:
																														UpperCAmelCase					    =     point + 1
						return None


def 				lowerCamelCase__				(	A       :      str				,       A       :      str				,       A       :      List[Any]				,       A       :      str					):




						'''simple docstring'''






						if sorted_collection[left] == sorted_collection[right]:
												if sorted_collection[left] == item:
																		return left
												else:
																		return None

						UpperCAmelCase					    =     left + ((item - sorted_collection[left]) * (right - left)) // (
						    sorted_collection[right] - sorted_collection[left]
						)

						# out of range check
						if point < 0 or point >= len(__A					):
												return None

						if sorted_collection[point] == item:
												return point
						elif point < left:
												return interpolation_search_by_recursion(__A				,       __A				,       __A				,       __A					)
						elif point > right:
												return interpolation_search_by_recursion(__A				,       __A				,       __A				,       __A					)
						else:
												if sorted_collection[point] > item:
																		return interpolation_search_by_recursion(
																		    __A				,       __A				,       __A				,       point - 1					)
												else:
																		return interpolation_search_by_recursion(
																		    __A				,       __A				,       point + 1				,       __A					)


def 				lowerCamelCase__				(	A       :      Optional[Any]					):




						'''simple docstring'''






						if collection != sorted(__A					):
												raise ValueError('''Collection must be ascending sorted'''					)
						return True


if __name__ == "__main__":
	import sys
	_lowercase      :      Any            =					0
	if debug == 1:
		_lowercase      :      Dict            =					[10, 30, 40, 45, 50, 66, 77, 93]
		try:
			__assert_sorted(collection)
		except ValueError:
			sys.exit("""Sequence must be ascending sorted to apply interpolation search""")
		_lowercase      :      Dict            =					67

	_lowercase      :      Dict            =					interpolation_search(collection, target)
	if result is not None:
		print(F"""{target} found at positions: {result}""")
	else:
		print("""Not found""")









'''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				)





