




'''simple docstring'''





class  _snake_case		:




			def __init__(					self							)				->				Optional[int]:

										'''simple docstring'''




										snake_case_						=      ""
										snake_case_						=      ""
										snake_case_						=      []




			def    lowerCAmelCase__				(					self				,							a__				,							a__							)				->				int:

										'''simple docstring'''




										if m == -1:
																	return n + 1
										elif n == -1:
																	return m + 1
										elif self.dp[m][n] > -1:
																	return self.dp[m][n]
										else:
																	if self.worda[m] == self.worda[n]:
																								snake_case_						=      self.__min_dist_top_down_dp(m - 1				,							n - 1							)
																	else:
																								snake_case_						=      self.__min_dist_top_down_dp(a__				,							n - 1							)
																								snake_case_						=      self.__min_dist_top_down_dp(m - 1				,							a__							)
																								snake_case_						=      self.__min_dist_top_down_dp(m - 1				,							n - 1							)
																								snake_case_						=      1 + min(a__				,							a__				,							a__							)

																	return self.dp[m][n]




			def    lowerCAmelCase__				(					self				,							a__				,							a__							)				->				int:

										'''simple docstring'''




										snake_case_						=      worda
										snake_case_						=      worda
										snake_case_						=      [[-1 for _ in range(len(a__							)							)] for _ in range(len(a__							)							)]

										return self.__min_dist_top_down_dp(len(a__							) - 1				,							len(a__							) - 1							)




			def    lowerCAmelCase__				(					self				,							a__				,							a__							)				->				int:

										'''simple docstring'''




										snake_case_						=      worda
										snake_case_						=      worda
										snake_case_						=      len(a__							)
										snake_case_						=      len(a__							)
										snake_case_						=      [[0 for _ in range(n + 1							)] for _ in range(m + 1							)]

										for i in range(m + 1							):
																	for j in range(n + 1							):
																								if i == 0:  # first string is empty
																															snake_case_						=      j
																								elif j == 0:  # second string is empty
																															snake_case_						=      i
																								elif worda[i - 1] == worda[j - 1]:  # last characters are equal
																															snake_case_						=      self.dp[i - 1][j - 1]
																								else:
																															snake_case_						=      self.dp[i][j - 1]
																															snake_case_						=      self.dp[i - 1][j]
																															snake_case_						=      self.dp[i - 1][j - 1]
																															snake_case_						=      1 + min(a__				,							a__				,							a__							)
										return self.dp[m][n]


if __name__ == "__main__":
		_SCREAMING_SNAKE_CASE							:   str      		= EditDistance()

		print("****************** Testing Edit Distance DP Algorithm ******************")
		print()

		_SCREAMING_SNAKE_CASE							:   int      		= input("Enter the first string: ").strip()
		_SCREAMING_SNAKE_CASE							:   List[str]      		= input("Enter the second string: ").strip()

		print()
		print(F"The minimum edit distance is: {solver.min_dist_top_down(Sa, Sa)}")
		print(F"The minimum edit distance is: {solver.min_dist_bottom_up(Sa, Sa)}")
		print()
		print("*************** End of Testing Edit Distance DP Algorithm ***************")








"""simple docstring"""







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


lowerCAmelCase__      				=   logging.get_logger(__name__)

lowerCAmelCase__      				=   {}


class       SCREAMING_SNAKE_CASE__				(		lowercase				):
       """simple docstring"""


       a  :				str   ="llama"
       a  :				List[str]   =["past_key_values"]

       def __init__(						self		,     snake_case__=32_000		,     snake_case__=4_096		,     snake_case__=11_008		,     snake_case__=32		,     snake_case__=32		,     snake_case__=None		,     snake_case__="silu"		,     snake_case__=2_048		,     snake_case__=0.02		,     snake_case__=1e-6		,     snake_case__=True		,     snake_case__=0		,     snake_case__=1		,     snake_case__=2		,     snake_case__=1		,     snake_case__=False		,     snake_case__=None		,     **snake_case__		,     ):






         """simple docstring"""





         lowerCAmelCase     :     Optional[Any]								=							vocab_size
         lowerCAmelCase     :     str								=							max_position_embeddings
         lowerCAmelCase     :     str								=							hidden_size
         lowerCAmelCase     :     Optional[int]								=							intermediate_size
         lowerCAmelCase     :     Any								=							num_hidden_layers
         lowerCAmelCase     :     List[str]								=							num_attention_heads

         # for backward compatibility
         if num_key_value_heads is None:
           lowerCAmelCase     :     Tuple								=							num_attention_heads

         lowerCAmelCase     :     Dict								=							num_key_value_heads
         lowerCAmelCase     :     Optional[Any]								=							hidden_act
         lowerCAmelCase     :     Optional[Any]								=							initializer_range
         lowerCAmelCase     :     Any								=							rms_norm_eps
         lowerCAmelCase     :     List[Any]								=							pretraining_tp
         lowerCAmelCase     :     int								=							use_cache
         lowerCAmelCase     :     List[str]								=							rope_scaling
         self._rope_scaling_validation()

         super().__init__(
             pad_token_id=snake_case__		,     bos_token_id=snake_case__		,     eos_token_id=snake_case__		,     tie_word_embeddings=snake_case__		,     **snake_case__		,     )







       def        lowercase__							(						self						):






         """simple docstring"""





         if self.rope_scaling is None:
           return

         if not isinstance(self.rope_scaling		,     snake_case__						) or len(self.rope_scaling						) != 2:
           raise ValueError(
               "`rope_scaling` must be a dictionary with with two fields, `name` and `factor`, "
               f"""got {self.rope_scaling}"""						)
         lowerCAmelCase     :     Optional[Any]								=							self.rope_scaling.get("type"		,     snake_case__						)
         lowerCAmelCase     :     int								=							self.rope_scaling.get("factor"		,     snake_case__						)
         if rope_scaling_type is None or rope_scaling_type not in ["linear", "dynamic"]:
           raise ValueError(
               f"""`rope_scaling`'s name field must be one of ['linear', 'dynamic'], got {rope_scaling_type}"""						)
         if rope_scaling_factor is None or not isinstance(snake_case__		,     snake_case__						) or rope_scaling_factor <= 1.0:
           raise ValueError(f"""`rope_scaling`'s factor field must be an float > 1, got {rope_scaling_factor}"""						)





