






"""simple docstring"""
import copy
import os
from typing import Union

from ...configuration_utils import PretrainedConfig
from ...utils import logging


_lowerCAmelCase         =							logging.get_logger(__name__)

_lowerCAmelCase         =							{
    "microsoft/git-base": "https://huggingface.co/microsoft/git-base/resolve/main/config.json",
}



class      SCREAMING_SNAKE_CASE  (				_SCREAMING_SNAKE_CASE						):





	"""simple docstring"""




	_A       :				List[Any]    =				"""git_vision_model"""





	def __init__(self     ,     lowerCAmelCase_=768     ,     lowerCAmelCase_=3072     ,     lowerCAmelCase_=12     ,     lowerCAmelCase_=12     ,     lowerCAmelCase_=3     ,     lowerCAmelCase_=224     ,     lowerCAmelCase_=16     ,     lowerCAmelCase_="quick_gelu"     ,     lowerCAmelCase_=1e-5     ,     lowerCAmelCase_=0.0     ,     lowerCAmelCase_=0.02     ,     **lowerCAmelCase_     ,     ):
		super().__init__(**lowerCAmelCase_							)

		A_		:						List[str]	    =   hidden_size
		A_		:						Tuple	    =   intermediate_size
		A_		:						Any	    =   num_hidden_layers
		A_		:						int	    =   num_attention_heads
		A_		:						Union[str, Any]	    =   num_channels
		A_		:						List[str]	    =   patch_size
		A_		:						List[str]	    =   image_size
		A_		:						str	    =   initializer_range
		A_		:						Union[str, Any]	    =   attention_dropout
		A_		:						str	    =   layer_norm_eps
		A_		:						Optional[int]	    =   hidden_act





	@classmethod
	def    lowerCamelCase(cls     ,     lowerCAmelCase_     ,     **lowerCAmelCase_							):
		cls._set_token_in_kwargs(lowerCAmelCase_							)

		A_    ,     A_		:						Dict	    =   cls.get_config_dict(lowerCAmelCase_     ,     **lowerCAmelCase_							)

		# get the vision config dict if we are loading from GITConfig
		if config_dict.get("""model_type"""							) == "git":
			A_		:						str	    =   config_dict["""vision_config"""]

		if "model_type" in config_dict and hasattr(cls     ,     """model_type"""							) and config_dict["model_type"] != cls.model_type:
			logger.warning(
			    f"""You are using a model of type {config_dict["model_type"]} to instantiate a model of type """
			    f"""{cls.model_type}. This is not supported for all configurations of models and can yield errors."""							)

		return cls.from_dict(lowerCAmelCase_     ,     **lowerCAmelCase_							)






class      SCREAMING_SNAKE_CASE  (				_SCREAMING_SNAKE_CASE						):





	"""simple docstring"""




	_A       :				List[str]    =				"""git"""





	def __init__(self     ,     lowerCAmelCase_=None     ,     lowerCAmelCase_=30522     ,     lowerCAmelCase_=768     ,     lowerCAmelCase_=6     ,     lowerCAmelCase_=12     ,     lowerCAmelCase_=3072     ,     lowerCAmelCase_="gelu"     ,     lowerCAmelCase_=0.1     ,     lowerCAmelCase_=0.1     ,     lowerCAmelCase_=1024     ,     lowerCAmelCase_=0.02     ,     lowerCAmelCase_=1e-1_2     ,     lowerCAmelCase_=0     ,     lowerCAmelCase_="absolute"     ,     lowerCAmelCase_=True     ,     lowerCAmelCase_=False     ,     lowerCAmelCase_=101     ,     lowerCAmelCase_=102     ,     lowerCAmelCase_=None     ,     **lowerCAmelCase_     ,     ):
		super().__init__(bos_token_id=lowerCAmelCase_     ,     eos_token_id=lowerCAmelCase_     ,     pad_token_id=lowerCAmelCase_     ,     **lowerCAmelCase_							)

		if vision_config is None:
			A_		:						Tuple	    =   {}
			logger.info("""vision_config is None. initializing the GitVisionConfig with default values."""							)

		A_		:						Optional[int]	    =   GitVisionConfig(**lowerCAmelCase_							)
		A_		:						int	    =   vocab_size
		A_		:						Tuple	    =   hidden_size
		A_		:						List[str]	    =   num_hidden_layers
		A_		:						Optional[int]	    =   num_attention_heads
		A_		:						str	    =   hidden_act
		A_		:						List[Any]	    =   intermediate_size
		A_		:						int	    =   hidden_dropout_prob
		A_		:						Any	    =   attention_probs_dropout_prob
		A_		:						Optional[int]	    =   max_position_embeddings
		A_		:						List[str]	    =   initializer_range
		A_		:						Optional[int]	    =   layer_norm_eps
		A_		:						Optional[int]	    =   position_embedding_type
		A_		:						Optional[Any]	    =   use_cache
		A_		:						Dict	    =   tie_word_embeddings
		A_		:						List[str]	    =   num_image_with_embedding

		A_		:						int	    =   bos_token_id
		A_		:						str	    =   eos_token_id





	def    lowerCamelCase(self							):
		A_		:						Any	    =   copy.deepcopy(self.__dict__							)
		A_		:						Union[str, Any]	    =   self.vision_config.to_dict()
		A_		:						Dict	    =   self.__class__.model_type
		return output









"""simple docstring"""
import sys
import webbrowser

import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent

if __name__ == "__main__":
							print("Googling.....")
							_lowerCAmelCase         =							"https://www.google.com/search?q=" + " ".join(sys.argv[1:])
							_lowerCAmelCase         =							requests.get(url, headers={"UserAgent": UserAgent().random})
							# res.raise_for_status()
							with open("project1a.html", "wb") as out_file:  # only for knowing the class
														for data in res.iter_content(10_000):
																					out_file.write(data)
							_lowerCAmelCase         =							BeautifulSoup(res.text, "html.parser")
							_lowerCAmelCase         =							list(soup.select(".eZt8xd"))[:5]

							print(len(links))
							for link in links:
														if link.text == "Maps":
																					webbrowser.open(link.get("href"))
														else:
																					webbrowser.open(F'https://google.com{link.get("href")}')

