




import gc
import tempfile
import unittest

import numpy as np
import torch

from diffusers import VersatileDiffusionTextToImagePipeline
from diffusers.utils.testing_utils import nightly, require_torch_gpu, torch_device


__A        =    False







class     __lowerCAmelCase (       unittest.TestCase ):

			"""simple docstring"""







			pass







@nightly
@require_torch_gpu
class     __lowerCAmelCase (       unittest.TestCase ):

			"""simple docstring"""







			def       lowercase_    (      self							)    ->      int:



							'''simple docstring'''
							# clean up the VRAM after each test
							super().tearDown()
							gc.collect()
							torch.cuda.empty_cache()


			def       lowercase_    (      self							)    ->      str:



							'''simple docstring'''
							__lowerCamelCase		       =    VersatileDiffusionTextToImagePipeline.from_pretrained('shi-labs/versatile-diffusion'							)
							# remove text_unet
							pipe.remove_unused_weights()
							pipe.to(lowerCamelCase__							)
							pipe.set_progress_bar_config(disable=lowerCamelCase__							)

							__lowerCamelCase		       =    'A painting of a squirrel eating a burger '
							__lowerCamelCase		       =    torch.manual_seed(0							)
							__lowerCamelCase		       =    pipe(
							    prompt=lowerCamelCase__			,						generator=lowerCamelCase__			,						guidance_scale=7.5			,						num_inference_steps=2			,						output_type='numpy'							).images

							with tempfile.TemporaryDirectory() as tmpdirname:
											pipe.save_pretrained(lowerCamelCase__							)
											__lowerCamelCase		       =    VersatileDiffusionTextToImagePipeline.from_pretrained(lowerCamelCase__							)
							pipe.to(lowerCamelCase__							)
							pipe.set_progress_bar_config(disable=lowerCamelCase__							)

							__lowerCamelCase		       =    generator.manual_seed(0							)
							__lowerCamelCase		       =    pipe(
							    prompt=lowerCamelCase__			,						generator=lowerCamelCase__			,						guidance_scale=7.5			,						num_inference_steps=2			,						output_type='numpy'							).images

							assert np.abs(image - new_image							).sum() < 1e-5, "Models don't have the same forward pass"






			def       lowercase_    (      self							)    ->      Optional[Any]:



							'''simple docstring'''
							__lowerCamelCase		       =    VersatileDiffusionTextToImagePipeline.from_pretrained(
							    'shi-labs/versatile-diffusion'			,						torch_dtype=torch.floataa							)
							pipe.to(lowerCamelCase__							)
							pipe.set_progress_bar_config(disable=lowerCamelCase__							)

							__lowerCamelCase		       =    'A painting of a squirrel eating a burger '
							__lowerCamelCase		       =    torch.manual_seed(0							)
							__lowerCamelCase		       =    pipe(
							    prompt=lowerCamelCase__			,						generator=lowerCamelCase__			,						guidance_scale=7.5			,						num_inference_steps=50			,						output_type='numpy'							).images

							__lowerCamelCase		       =    image[0, 253:256, 253:256, -1]

							assert image.shape == (1, 512, 512, 3)
							__lowerCamelCase		       =    np.array([0.33_67, 0.31_69, 0.26_56, 0.38_70, 0.47_90, 0.37_96, 0.40_09, 0.48_78, 0.47_78]							)

							assert np.abs(image_slice.flatten() - expected_slice							).max() < 1e-2






'''simple docstring'''
def 			a      (			)  ->	Union[str, Any]:



					'''simple docstring'''






					UpperCamelCase__   :Optional[int]												= []
					UpperCamelCase__   :int												= 1

					while len(__a   ) < 1e6:
										constant.append(str(__a   )   )
										i += 1

					UpperCamelCase__   :Union[str, Any]												= ''''''.join(__a   )

					return (
					    int(constant[0]   )
					    * int(constant[9]   )
					    * int(constant[99]   )
					    * int(constant[999]   )
					    * int(constant[9999]   )
					    * int(constant[99999]   )
					    * int(constant[999999]   )
					)


if __name__ == "__main__":
		print(solution())