





'''simple docstring'''






import unittest

import torch

from diffusers import VQModel
from diffusers.utils import floats_tensor, torch_device
from diffusers.utils.testing_utils import enable_full_determinism

from .test_modeling_common import ModelTesterMixin, UNetTesterMixin


enable_full_determinism()







class 			lowerCamelCase       (						__UpperCAmelCase     ,							__UpperCAmelCase     ,							unittest.TestCase  ):
					_SCREAMING_SNAKE_CASE							   =    VQModel
					_SCREAMING_SNAKE_CASE							   =    "sample"


					@property
					def    SCREAMING_SNAKE_CASE_		(					self	:  List[Any]       ,     __snake_case	:  Tuple=(32, 32)       ):





											'''simple docstring'''





											_snake_case:   Dict  					=		4
											_snake_case:   str  					=		3

											_snake_case:   int  					=		floats_tensor((batch_size, num_channels) + sizes       ).to(__snake_case       )

											return {"sample": image}


					@property
					def    SCREAMING_SNAKE_CASE_		(					self	:  Optional[Any]       ):





											'''simple docstring'''





											return (3, 32, 32)


					@property
					def    SCREAMING_SNAKE_CASE_		(					self	:  List[str]       ):





											'''simple docstring'''





											return (3, 32, 32)


					def    SCREAMING_SNAKE_CASE_		(					self	:  str       ):





											'''simple docstring'''





											_snake_case:   str  					=		{
											    'block_out_channels': [32, 64],
											    'in_channels': 3,
											    'out_channels': 3,
											    'down_block_types': ['DownEncoderBlock2D', 'DownEncoderBlock2D'],
											    'up_block_types': ['UpDecoderBlock2D', 'UpDecoderBlock2D'],
											    'latent_channels': 3,
											}
											_snake_case:   Union[str, Any]  					=		self.dummy_input
											return init_dict, inputs_dict


					def    SCREAMING_SNAKE_CASE_		(					self	:  str       ):





											'''simple docstring'''





											pass


					def    SCREAMING_SNAKE_CASE_		(					self	:  Any       ):





											'''simple docstring'''





											pass


					def    SCREAMING_SNAKE_CASE_		(					self	:  Dict       ):





											'''simple docstring'''





											_snake_case:   str  					=		VQModel.from_pretrained('fusing/vqgan-dummy'       ,     output_loading_info=__snake_case       )
											self.assertIsNotNone(__snake_case       )
											self.assertEqual(len(loading_info['missing_keys']       )       ,     0       )

											model.to(__snake_case       )
											_snake_case:   List[Any]  					=		model(**self.dummy_input       )

											assert image is not None, "Make sure output is not None"




					def    SCREAMING_SNAKE_CASE_		(					self	:  Optional[int]       ):





											'''simple docstring'''





											_snake_case:   str  					=		VQModel.from_pretrained('fusing/vqgan-dummy'       )
											model.to(__snake_case       ).eval()

											torch.manual_seed(0       )
											if torch.cuda.is_available():
																	torch.cuda.manual_seed_all(0       )

											_snake_case:   Tuple  					=		torch.randn(1       ,     model.config.in_channels       ,     model.config.sample_size       ,     model.config.sample_size       )
											_snake_case:   Tuple  					=		image.to(__snake_case       )
											with torch.no_grad():
																	_snake_case:   Dict  					=		model(__snake_case       ).sample

											_snake_case:   int  					=		output[0, -1, -3:, -3:].flatten().cpu()
											# fmt: off
											_snake_case:   List[str]  					=		torch.tensor([-0.0_153, -0.4_044, -0.1_880, -0.5_161, -0.2_418, -0.4_072, -0.1_612, -0.0_633, -0.0_143]       )
											# fmt: on
											self.assertTrue(torch.allclose(__snake_case       ,     __snake_case       ,     atol=1e-3       )       )












'''simple docstring'''






import sys
import webbrowser

import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent

if __name__ == "__main__":
		print('Googling.....')
		A   : Optional[int]             =			'https://www.google.com/search?q=' + ' '.join(sys.argv[1:])
		A   : Dict             =			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)
		A   : List[Any]             =			BeautifulSoup(res.text, 'html.parser')
		A   : List[Any]             =			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")}')





