from __future__ import annotations

from collections.abc import Callable
def 					_snake_case	(  __snake_case  ,     __snake_case  ,     __snake_case  ,     __snake_case = 100  ,     ):
					_UpperCamelCase			     =     x_start
					_UpperCamelCase			     =     fnc(__snake_case						)
					_UpperCamelCase			     =     0.0
					for _ in range(__snake_case						):
										# Approximates small segments of curve as linear and solve
										# for trapezoidal area
										_UpperCamelCase			     =     (x_end - x_start) / steps + xa
										_UpperCamelCase			     =     fnc(__snake_case						)
										area += abs(fxa + fxa						) * (xa - xa) / 2
										# Increment step
										_UpperCamelCase			     =     xa
										_UpperCamelCase			     =     fxa
					return area


if __name__ == "__main__":
					def 					_snake_case	(  __snake_case						):
										return x**3 + x**2

					print("f(x) = x^3 + x^2")
					print("The area between the curve, x = -5, x = 5 and the x axis is:")
					_lowerCAmelCase       =		10
					while i <= 100_000:
										print(f'with {i} steps: {trapezoidal_area(f, -5, 5, i)}')
										i *= 10





'''simple docstring'''



import argparse

from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta
from transformers.utils import logging


logging.set_verbosity_info()
def        UpperCAmelCase (    A	:					Optional[Any]       ,		A	:					Optional[int]       ,		A	:					int					):
							# Initialise PyTorch model
							SCREAMING_SNAKE_CASE       :   str         =      TaConfig.from_json_file(A					)
							print(F"""Building PyTorch model from configuration: {config}"""					)
							SCREAMING_SNAKE_CASE       :   Union[str, Any]         =      TaForConditionalGeneration(A					)

							# Load weights from tf checkpoint
							load_tf_weights_in_ta(A       ,		A       ,		A					)

							# Save pytorch-model
							print(F"""Save PyTorch model to {pytorch_dump_path}"""					)
							model.save_pretrained(A					)


if __name__ == "__main__":
							lowerCAmelCase_  :							Union[str, Any]             =    argparse.ArgumentParser()
							# Required parameters
							parser.add_argument(
							    '--tf_checkpoint_path', default=None, type=str, required=True, help='Path to the TensorFlow checkpoint path.'
							)
							parser.add_argument(
							    '--config_file',
							    default=None,
							    type=str,
							    required=True,
							    help=(
							        'The config json file corresponding to the pre-trained T5 model. \nThis specifies the model architecture.'
							    ),
							)
							parser.add_argument(
							    '--pytorch_dump_path', default=None, type=str, required=True, help='Path to the output PyTorch model.'
							)
							lowerCAmelCase_  :							Tuple             =    parser.parse_args()
							convert_tf_checkpoint_to_pytorch(args.tf_checkpoint_path, args.config_file, args.pytorch_dump_path)




