



"""simple docstring"""





import numpy

# List of input, output pairs
__lowerCAmelCase							:       List[str]          =       (
    ((5, 2, 3), 15),
    ((6, 5, 9), 25),
    ((11, 12, 13), 41),
    ((1, 1, 1), 8),
    ((11, 12, 13), 41),
)
__lowerCAmelCase							:       List[Any]          =       (((515, 22, 13), 555), ((61, 35, 49), 150))
__lowerCAmelCase							:       Union[str, Any]          =       [2, 4, 1, 5]
__lowerCAmelCase							:       Dict          =       len(train_data)
__lowerCAmelCase							:       int          =       0.009
def 						__lowerCAmelCase    (		__UpperCamelCase   :      int       ,			__UpperCamelCase   :      Any="train"     ):


						'''simple docstring'''






						return calculate_hypothesis_value(__UpperCamelCase       ,			__UpperCamelCase     ) - output(
						    __UpperCamelCase       ,			__UpperCamelCase     )
def 						__lowerCAmelCase    (		__UpperCamelCase   :      Dict     ):


						'''simple docstring'''






						snake_case_ :			Optional[Any]            =      0
						for i in range(len(__UpperCamelCase     ) - 1     ):
												hyp_val += data_input_tuple[i] * parameter_vector[i + 1]
						hyp_val += parameter_vector[0]
						return hyp_val
def 						__lowerCAmelCase    (		__UpperCamelCase   :      Tuple       ,			__UpperCamelCase   :      List[Any]     ):


						'''simple docstring'''






						if data_set == "train":
												return train_data[example_no][1]
						elif data_set == "test":
												return test_data[example_no][1]
						return None
def 						__lowerCAmelCase    (		__UpperCamelCase   :      str       ,			__UpperCamelCase   :      Dict     ):


						'''simple docstring'''






						if data_set == "train":
												return _hypothesis_value(train_data[example_no][0]     )
						elif data_set == "test":
												return _hypothesis_value(test_data[example_no][0]     )
						return None
def 						__lowerCAmelCase    (		__UpperCamelCase   :      List[str]       ,			__UpperCamelCase   :      int=m     ):


						'''simple docstring'''






						snake_case_ :			Union[str, Any]            =      0
						for i in range(__UpperCamelCase     ):
												if index == -1:
																		summation_value += _error(__UpperCamelCase     )
												else:
																		summation_value += _error(__UpperCamelCase     ) * train_data[i][0][index]
						return summation_value
def 						__lowerCAmelCase    (		__UpperCamelCase   :      Optional[int]     ):


						'''simple docstring'''






						snake_case_ :			Optional[Any]            =      summation_of_cost_derivative(__UpperCamelCase       ,			__UpperCamelCase     ) / m
						return cost_derivative_value
def 						__lowerCAmelCase    (		):


						'''simple docstring'''






						global parameter_vector
						# Tune these values to set a tolerance value for predicted output
						snake_case_ :			Optional[int]            =      0.000_002
						snake_case_ :			Optional[Any]            =      0
						snake_case_ :			Tuple            =      0
						while True:
												j += 1
												snake_case_ :			str            =      [0, 0, 0, 0]
												for i in range(0       ,			len(__UpperCamelCase     )     ):
																		snake_case_ :			List[str]            =      get_cost_derivative(i - 1     )
																		snake_case_ :			List[str]            =      (
																		    parameter_vector[i] - LEARNING_RATE * cost_derivative
																		)
												if numpy.allclose(
												    __UpperCamelCase       ,			__UpperCamelCase       ,			atol=__UpperCamelCase       ,			rtol=__UpperCamelCase       ,			):
																		break
												snake_case_ :			List[str]            =      temp_parameter_vector
						print(("""Number of iterations:""", j)     )
def 						__lowerCAmelCase    (		):


						'''simple docstring'''






						for i in range(len(__UpperCamelCase     )     ):
												print(("""Actual output value:""", output(__UpperCamelCase       ,			"""test"""     ))     )
												print(("""Hypothesis output:""", calculate_hypothesis_value(__UpperCamelCase       ,			"""test"""     ))     )


if __name__ == "__main__":
					run_gradient_descent()
					print('''\nTesting gradient descent for a linear hypothesis function.\n''')
					test_gradient_descent()




import inspect
import re

from transformers.utils import direct_transformers_import


# All paths are set with the intent you should run this script from the root of the repo with the command
# python utils/check_config_docstrings.py
_lowerCAmelCase  :      int			 ="""src/transformers"""


# This is to make sure the transformers module imported is the one in the repo.
_lowerCAmelCase  :      Dict			 =direct_transformers_import(PATH_TO_TRANSFORMERS)

_lowerCAmelCase  :      List[str]			 =transformers.models.auto.configuration_auto.CONFIG_MAPPING

# Regex pattern used to find the checkpoint mentioned in the docstring of `config_class`.
# For example, `[bert-base-uncased](https://huggingface.co/bert-base-uncased)`
_lowerCAmelCase  :      int			 =re.compile(r"""\[(.+?)\]\((https://huggingface\.co/.+?)\)""")


_lowerCAmelCase  :      Union[str, Any]			 ={
    """DecisionTransformerConfig""",
    """EncoderDecoderConfig""",
    """MusicgenConfig""",
    """RagConfig""",
    """SpeechEncoderDecoderConfig""",
    """TimmBackboneConfig""",
    """VisionEncoderDecoderConfig""",
    """VisionTextDualEncoderConfig""",
    """LlamaConfig""",
}



def 			_A	(      SCREAMING_SNAKE_CASE      ):
	UpperCAmelCase__:	str									= None

	# source code of `config_class`
	UpperCAmelCase__:	Optional[int]									= inspect.getsource(SCREAMING_SNAKE_CASE      )
	UpperCAmelCase__:	List[Any]									= _re_checkpoint.findall(SCREAMING_SNAKE_CASE      )

	# Each `checkpoint` is a tuple of a checkpoint name and a checkpoint link.
	# For example, `('bert-base-uncased', 'https://huggingface.co/bert-base-uncased')`
	for ckpt_name, ckpt_link in checkpoints:
		# allow the link to end with `/`
		if ckpt_link.endswith("/"      ):
			UpperCAmelCase__:	Any									= ckpt_link[:-1]

		# verify the checkpoint name corresponds to the checkpoint link
		UpperCAmelCase__:	int									= f"https://huggingface.co/{ckpt_name}"
		if ckpt_link == ckpt_link_from_name:
			UpperCAmelCase__:	Optional[int]									= ckpt_name
			break

	return checkpoint



def 			_A	(      ):
	UpperCAmelCase__:	List[str]									= []

	for config_class in list(CONFIG_MAPPING.values()      ):
		# Skip deprecated models
		if "models.deprecated" in config_class.__module__:
			continue
		UpperCAmelCase__:	Optional[Any]									= get_checkpoint_from_config_class(SCREAMING_SNAKE_CASE      )

		UpperCAmelCase__:	List[str]									= config_class.__name__
		if checkpoint is None and name not in CONFIG_CLASSES_TO_IGNORE_FOR_DOCSTRING_CHECKPOINT_CHECK:
			configs_without_checkpoint.append(SCREAMING_SNAKE_CASE      )

	if len(SCREAMING_SNAKE_CASE      ) > 0:
		UpperCAmelCase__:	Dict									= "\n".join(sorted(SCREAMING_SNAKE_CASE      )      )
		raise ValueError(f"The following configurations don't contain any valid checkpoint:\n{message}"      )


if __name__ == "__main__":
					check_config_docstrings_have_checkpoints()