


'''simple docstring'''







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


lowerCAmelCase    :     int					=						False
class 	UpperCamelCase__					( unittest.TestCase   ):



     """simple docstring"""






     pass
@nightly
@require_torch_gpu
class 	UpperCamelCase__					( unittest.TestCase   ):



     """simple docstring"""






     def a	( self   ):

            '''simple docstring'''

            super().tearDown()
            gc.collect()
            torch.cuda.empty_cache()







     def a	( self   ):

            '''simple docstring'''

            _lowerCAmelCase    :							Dict   			=       VersatileDiffusionTextToImagePipeline.from_pretrained('shi-labs/versatile-diffusion'   )
            # remove text_unet
            pipe.remove_unused_weights()
            pipe.to(snake_case__   )
            pipe.set_progress_bar_config(disable=snake_case__   )

            _lowerCAmelCase    :							List[Any]   			=       'A painting of a squirrel eating a burger '
            _lowerCAmelCase    :							str   			=       torch.manual_seed(0   )
            _lowerCAmelCase    :							Tuple   			=       pipe(
                prompt=snake_case__      ,	generator=snake_case__      ,	guidance_scale=7.5      ,	num_inference_steps=2      ,	output_type='numpy'   ).images

            with tempfile.TemporaryDirectory() as tmpdirname:
                   pipe.save_pretrained(snake_case__   )
                   _lowerCAmelCase    :							Union[str, Any]   			=       VersatileDiffusionTextToImagePipeline.from_pretrained(snake_case__   )
            pipe.to(snake_case__   )
            pipe.set_progress_bar_config(disable=snake_case__   )

            _lowerCAmelCase    :							int   			=       generator.manual_seed(0   )
            _lowerCAmelCase    :							Any   			=       pipe(
                prompt=snake_case__      ,	generator=snake_case__      ,	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 a	( self   ):

            '''simple docstring'''

            _lowerCAmelCase    :							List[str]   			=       VersatileDiffusionTextToImagePipeline.from_pretrained(
                'shi-labs/versatile-diffusion'      ,	torch_dtype=torch.floataa   )
            pipe.to(snake_case__   )
            pipe.set_progress_bar_config(disable=snake_case__   )

            _lowerCAmelCase    :							str   			=       'A painting of a squirrel eating a burger '
            _lowerCAmelCase    :							Optional[int]   			=       torch.manual_seed(0   )
            _lowerCAmelCase    :							str   			=       pipe(
                prompt=snake_case__      ,	generator=snake_case__      ,	guidance_scale=7.5      ,	num_inference_steps=50      ,	output_type='numpy'   ).images

            _lowerCAmelCase    :							Optional[Any]   			=       image[0, 253:256, 253:256, -1]

            assert image.shape == (1, 512, 512, 3)
            _lowerCAmelCase    :							Optional[int]   			=       np.array([0.3367, 0.3169, 0.2656, 0.3870, 0.4790, 0.3796, 0.4009, 0.4878, 0.4778]   )

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





'''simple docstring'''







import math
from datetime import datetime, timedelta






def 			lowercase				(_A					):







       """simple docstring"""







       _lowerCAmelCase    :							Optional[Any]   			=       year % 1_9
       _lowerCAmelCase    :							Any   			=       year % 4
       _lowerCAmelCase    :							Optional[int]   			=       year % 7
       _lowerCAmelCase    :							int   			=       math.floor(year / 1_0_0					)
       _lowerCAmelCase    :							Dict   			=       math.floor((1_3 + 8 * leap_day_inhibits) / 2_5					)
       _lowerCAmelCase    :							Optional[Any]   			=       leap_day_inhibits / 4
       _lowerCAmelCase    :							Dict   			=       (
           1_5 - lunar_orbit_correction + leap_day_inhibits - leap_day_reinstall_number
       ) % 3_0
       _lowerCAmelCase    :							List[Any]   			=       (4 + leap_day_inhibits - leap_day_reinstall_number) % 7

       # days to be added to March 21
       _lowerCAmelCase    :							Dict   			=       (1_9 * metonic_cycle + secular_moon_shift) % 3_0

       # PHM -> Paschal Full Moon
       _lowerCAmelCase    :							Union[str, Any]   			=       (
           2 * julian_leap_year
           + 4 * non_leap_year
           + 6 * days_to_add
           + century_starting_point
       ) % 7

       if days_to_add == 2_9 and days_from_phm_to_sunday == 6:
              return datetime(_A   ,						4   ,						1_9					)
       elif days_to_add == 2_8 and days_from_phm_to_sunday == 6:
              return datetime(_A   ,						4   ,						1_8					)
       else:
              return datetime(_A   ,						3   ,						2_2					) + timedelta(
                  days=int(days_to_add + days_from_phm_to_sunday					)					)


if __name__ == "__main__":
       for year in (19_94, 20_00, 20_10, 20_21, 20_23):
              lowerCAmelCase    :     List[str]					=						"""will be""" if year > datetime.now().year else """was"""
              print(F'''Easter in {year} {tense} {gauss_easter(year)}''')

