





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


_lowerCamelCase   				=			logging.get_logger(__name__)

_lowerCamelCase   				=			{
    'bigcode/gpt_bigcode-santacoder': 'https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json',
}




class   UpperCamelCase_       (     UpperCamelCase__    ):
							lowerCamelCase_           =					"gpt_bigcode"
							lowerCamelCase_           =					["past_key_values"]
							lowerCamelCase_           =					{
							    "hidden_size": "n_embd",
							    "max_position_embeddings": "n_positions",
							    "num_attention_heads": "n_head",
							    "num_hidden_layers": "n_layer",
							}


							def __init__(							self    :Optional[Any]							,				__A    :List[str]=5_0257							,				__A    :int=1024							,				__A    :Any=768							,				__A    :Optional[int]=12							,				__A    :Optional[int]=12							,				__A    :str=None							,				__A    :Optional[Any]="gelu_pytorch_tanh"							,				__A    :Dict=0.1							,				__A    :Optional[int]=0.1							,				__A    :List[Any]=0.1							,				__A    :Dict=1E-5							,				__A    :List[str]=0.0_2							,				__A    :Union[str, Any]=True							,				__A    :int=True							,				__A    :str=5_0256							,				__A    :List[str]=5_0256							,				__A    :List[str]=True							,				__A    :List[Any]=True							,				__A    :Optional[Any]=True							,				**__A    :Optional[int]							,				)   ->   int:



									"""simple docstring"""



									SCREAMING_SNAKE_CASE__			=      vocab_size
									SCREAMING_SNAKE_CASE__			=      n_positions
									SCREAMING_SNAKE_CASE__			=      n_embd
									SCREAMING_SNAKE_CASE__			=      n_layer
									SCREAMING_SNAKE_CASE__			=      n_head
									SCREAMING_SNAKE_CASE__			=      n_inner
									SCREAMING_SNAKE_CASE__			=      activation_function
									SCREAMING_SNAKE_CASE__			=      resid_pdrop
									SCREAMING_SNAKE_CASE__			=      embd_pdrop
									SCREAMING_SNAKE_CASE__			=      attn_pdrop
									SCREAMING_SNAKE_CASE__			=      layer_norm_epsilon
									SCREAMING_SNAKE_CASE__			=      initializer_range
									SCREAMING_SNAKE_CASE__			=      scale_attn_weights
									SCREAMING_SNAKE_CASE__			=      use_cache
									SCREAMING_SNAKE_CASE__			=      attention_softmax_in_fpaa
									SCREAMING_SNAKE_CASE__			=      scale_attention_softmax_in_fpaa
									SCREAMING_SNAKE_CASE__			=      multi_query

									SCREAMING_SNAKE_CASE__			=      bos_token_id
									SCREAMING_SNAKE_CASE__			=      eos_token_id

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






def 				SCREAMING_SNAKE_CASE__							(       UpperCamelCase__:							list[list[float]]    ):
		SCREAMING_SNAKE_CASE__			=      []
		for data in source_data:
				for i, el in enumerate(UpperCamelCase__    ):
						if len(UpperCamelCase__    ) < i + 1:
								data_lists.append([]    )
						data_lists[i].append(float(UpperCamelCase__    )    )
		return data_lists






def 				SCREAMING_SNAKE_CASE__							(       UpperCamelCase__:							list[list[float]]					,   UpperCamelCase__:							list[int]    ):
		SCREAMING_SNAKE_CASE__			=      []
		for dlist, weight in zip(UpperCamelCase__					,   UpperCamelCase__    ):
				SCREAMING_SNAKE_CASE__			=      min(UpperCamelCase__    )
				SCREAMING_SNAKE_CASE__			=      max(UpperCamelCase__    )

				SCREAMING_SNAKE_CASE__			=      []
				# for weight 0 score is 1 - actual score
				if weight == 0:
						for item in dlist:
								try:
										score.append(1 - ((item - mind) / (maxd - mind))    )
								except ZeroDivisionError:
										score.append(1    )

				elif weight == 1:
						for item in dlist:
								try:
										score.append((item - mind) / (maxd - mind)    )
								except ZeroDivisionError:
										score.append(0    )

        # weight not 0 or 1
				else:
						SCREAMING_SNAKE_CASE__			=      f'''Invalid weight of {weight:f} provided'''
						raise ValueError(UpperCamelCase__    )

				score_lists.append(UpperCamelCase__    )

		return score_lists






def 				SCREAMING_SNAKE_CASE__							(       UpperCamelCase__:							list[list[float]]    ):
		SCREAMING_SNAKE_CASE__			=      [0 for i in range(len(score_lists[0]    )    )]

		for slist in score_lists:
				for j, ele in enumerate(UpperCamelCase__    ):
						SCREAMING_SNAKE_CASE__			=      final_scores[j] + ele

		return final_scores






def 				SCREAMING_SNAKE_CASE__							(       UpperCamelCase__:							list[list[float]]					,   UpperCamelCase__:							list[int]    ):
		SCREAMING_SNAKE_CASE__			=      get_data(UpperCamelCase__    )
		SCREAMING_SNAKE_CASE__			=      calculate_each_score(UpperCamelCase__					,   UpperCamelCase__    )
		SCREAMING_SNAKE_CASE__			=      generate_final_scores(UpperCamelCase__    )

		# append scores to source data
		for i, ele in enumerate(UpperCamelCase__    ):
				source_data[i].append(UpperCamelCase__    )

		return source_data