




import argparse

import torch

from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert
from transformers.utils import logging


logging.set_verbosity_info()

def 			a   (_lowerCAmelCase  ,    _lowerCAmelCase  ,    _lowerCAmelCase     ):
							# Initialise PyTorch model
							SCREAMING_SNAKE_CASE_   	=    MobileBertConfig.from_json_file(_lowerCAmelCase     )
							print(F"Building PyTorch model from configuration: {config}"     )
							SCREAMING_SNAKE_CASE_   	=    MobileBertForPreTraining(_lowerCAmelCase     )
							# Load weights from tf checkpoint
							SCREAMING_SNAKE_CASE_   	=    load_tf_weights_in_mobilebert(_lowerCAmelCase  ,    _lowerCAmelCase  ,    _lowerCAmelCase     )
							# Save pytorch-model
							print(F"Save PyTorch model to {pytorch_dump_path}"     )
							torch.save(model.state_dict()  ,    _lowerCAmelCase     )


if __name__ == "__main__":
			__SCREAMING_SNAKE_CASE 						=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(
			    """--mobilebert_config_file""",
			    default=None,
			    type=str,
			    required=True,
			    help=(
			        """The config json file corresponding to the pre-trained MobileBERT model. \n"""
			        """This specifies the model architecture."""
			    ),
			)
			parser.add_argument(
			    """--pytorch_dump_path""", default=None, type=str, required=True, help="""Path to the output PyTorch model."""
			)
			__SCREAMING_SNAKE_CASE 						=parser.parse_args()
			convert_tf_checkpoint_to_pytorch(args.tf_checkpoint_path, args.mobilebert_config_file, args.pytorch_dump_path)












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__":
			__SCREAMING_SNAKE_CASE 						="""%20""".join(argv[1:]) if len(argv) > 1 else quote(str(input("""Search: """)))

			print("""Googling.....""")

			__SCREAMING_SNAKE_CASE 						=f"""https://www.google.com/search?q={query}&num=100"""

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

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

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

			webbrowser.open(link)


