

'''simple docstring'''
import webbrowser
from sys import argv
from urllib.parse import parse_qs, quote

import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent

if __name__ == "__main__":
     lowerCamelCase					: Union[str, Any]   					=	'''%20'''.join(argv[1:]) if len(argv) > 1 else quote(str(input("Search: ")))

     print("Googling.....")

     lowerCamelCase					: Optional[int]   					=	f'''https://www.google.com/search?q={query}&num=100'''

     lowerCamelCase					: Any   					=	requests.get(
         url,
         headers={"User-Agent": str(UserAgent().random)},
     )

     try:
          lowerCamelCase					: Dict   					=	(
              BeautifulSoup(res.text, "html.parser")
              .find("div", attrs={"class": "yuRUbf"})
              .find("a")
              .get("href")
          )

     except AttributeError:
          lowerCamelCase					: int   					=	parse_qs(
              BeautifulSoup(res.text, "html.parser")
              .find("div", attrs={"class": "kCrYT"})
              .find("a")
              .get("href")
          )['''url'''][0]

     webbrowser.open(link)






import argparse

import torch

from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel
from transformers.utils import logging


logging.set_verbosity_info()





def        __UpperCAmelCase						(							lowerCamelCase_ :     Dict  ,							lowerCamelCase_ :     Any  ,							lowerCamelCase_ :     int  ,							lowerCamelCase_ :     List[Any]  )       ->  int:







			"""simple docstring"""





			SCREAMING_SNAKE_CASE_   : Optional[Any]					  =      FunnelConfig.from_json_file(lowerCamelCase_  )
			print(F'Building PyTorch model from configuration: {config}'  )
			SCREAMING_SNAKE_CASE_   : Union[str, Any]					  =      FunnelBaseModel(lowerCamelCase_  ) if base_model else FunnelModel(lowerCamelCase_  )

			# Load weights from tf checkpoint
			load_tf_weights_in_funnel(lowerCamelCase_  ,							lowerCamelCase_  ,							lowerCamelCase_  )

			# Save pytorch-model
			print(F'Save PyTorch model to {pytorch_dump_path}'  )
			torch.save(model.state_dict()  ,							lowerCamelCase_  )


if __name__ == "__main__":
						UpperCamelCase__ :   Optional[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 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.'''
						)
						parser.add_argument(
						    '''--base_model''', action='''store_true''', help='''Whether you want just the base model (no decoder) or not.'''
						)
						UpperCamelCase__ :   Tuple						=							parser.parse_args()
						convert_tf_checkpoint_to_pytorch(
						    args.tf_checkpoint_path, args.config_file, args.pytorch_dump_path, args.base_model
						)



