





import argparse

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


logging.set_verbosity_info()





def  __lowerCamelCase     (			UpperCamelCase__       ,							UpperCamelCase__       ,							UpperCamelCase__				):







							'''simple docstring'''






							snake_case_          =   TaConfig.from_json_file(__snake_case				)
							print(F'''Building PyTorch model from configuration: {config}'''				)
							snake_case_          =   TaForConditionalGeneration(__snake_case				)

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

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


if __name__ == "__main__":
					_UpperCAmelCase		:       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."""
					)
					_UpperCAmelCase		:       Tuple						    =	parser.parse_args()
					convert_tf_checkpoint_to_pytorch(args.tf_checkpoint_path, args.config_file, args.pytorch_dump_path)







import requests

_UpperCAmelCase		:       Union[str, Any]						    =	"""https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey="""





def  __lowerCamelCase     (			UpperCamelCase__				):







							'''simple docstring'''






							snake_case_          =   requests.get(_NEWS_API + bbc_news_api_key				).json()
							# each article in the list is a dict
							for i, article in enumerate(bbc_news_page['articles']       ,							1				):
														print(F'''{i}.) {article["title"]}'''				)


if __name__ == "__main__":
					fetch_bbc_news(bbc_news_api_key="""<Your BBC News API key goes here>""")




