

'''simple docstring'''

import inspect
import unittest

from transformers import ViTConfig
from transformers.testing_utils import (
    require_accelerate,
    require_torch,
    require_torch_gpu,
    require_vision,
    slow,
    torch_device,
)
from transformers.utils import cached_property, is_torch_available, is_vision_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
				import torch
				from torch import nn

				from transformers import ViTForImageClassification, ViTForMaskedImageModeling, ViTModel
				from transformers.models.vit.modeling_vit import VIT_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
				from PIL import Image

				from transformers import ViTImageProcessor







class   UpperCamelCase__    :


		"""simple docstring"""

		def __init__( self    ,			snake_case    ,			snake_case=1_3    ,			snake_case=3_0    ,			snake_case=2    ,			snake_case=3    ,			snake_case=True    ,			snake_case=True    ,			snake_case=3_2    ,			snake_case=5    ,			snake_case=4    ,			snake_case=3_7    ,			snake_case="gelu"    ,			snake_case=0.1    ,			snake_case=0.1    ,			snake_case=1_0    ,			snake_case=0.02    ,			snake_case=None    ,			snake_case=2    ,			):


							'''simple docstring'''

							UpperCAmelCase		:							str   					=   parent
							UpperCAmelCase		:							Optional[Any]   					=   batch_size
							UpperCAmelCase		:							str   					=   image_size
							UpperCAmelCase		:							Tuple   					=   patch_size
							UpperCAmelCase		:							int   					=   num_channels
							UpperCAmelCase		:							List[str]   					=   is_training
							UpperCAmelCase		:							str   					=   use_labels
							UpperCAmelCase		:							int   					=   hidden_size
							UpperCAmelCase		:							List[Any]   					=   num_hidden_layers
							UpperCAmelCase		:							Union[str, Any]   					=   num_attention_heads
							UpperCAmelCase		:							Any   					=   intermediate_size
							UpperCAmelCase		:							str   					=   hidden_act
							UpperCAmelCase		:							str   					=   hidden_dropout_prob
							UpperCAmelCase		:							List[str]   					=   attention_probs_dropout_prob
							UpperCAmelCase		:							int   					=   type_sequence_label_size
							UpperCAmelCase		:							Dict   					=   initializer_range
							UpperCAmelCase		:							Dict   					=   scope
							UpperCAmelCase		:							Dict   					=   encoder_stride

							# in ViT, the seq length equals the number of patches + 1 (we add 1 for the [CLS] token)
							UpperCAmelCase		:							List[Any]   					=   (image_size // patch_size) ** 2
							UpperCAmelCase		:							Dict   					=   num_patches + 1







		def       A_       ( self			):


							'''simple docstring'''

							UpperCAmelCase		:							Optional[int]   					=   floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]			)

							UpperCAmelCase		:							str   					=   None
							if self.use_labels:
												UpperCAmelCase		:							Union[str, Any]   					=   ids_tensor([self.batch_size]    ,			self.type_sequence_label_size			)

							UpperCAmelCase		:							Optional[Any]   					=   self.get_config()

							return config, pixel_values, labels







		def       A_       ( self			):


							'''simple docstring'''

							return ViTConfig(
							    image_size=self.image_size    ,			patch_size=self.patch_size    ,			num_channels=self.num_channels    ,			hidden_size=self.hidden_size    ,			num_hidden_layers=self.num_hidden_layers    ,			num_attention_heads=self.num_attention_heads    ,			intermediate_size=self.intermediate_size    ,			hidden_act=self.hidden_act    ,			hidden_dropout_prob=self.hidden_dropout_prob    ,			attention_probs_dropout_prob=self.attention_probs_dropout_prob    ,			is_decoder=lowerCAmelCase__    ,			initializer_range=self.initializer_range    ,			encoder_stride=self.encoder_stride    ,			)







		def       A_       ( self    ,			snake_case    ,			snake_case    ,			snake_case			):


							'''simple docstring'''

							UpperCAmelCase		:							Union[str, Any]   					=   ViTModel(config=lowerCAmelCase__			)
							model.to(lowerCAmelCase__			)
							model.eval()
							UpperCAmelCase		:							Optional[int]   					=   model(lowerCAmelCase__			)
							self.parent.assertEqual(result.last_hidden_state.shape    ,			(self.batch_size, self.seq_length, self.hidden_size)			)







		def       A_       ( self    ,			snake_case    ,			snake_case    ,			snake_case			):


							'''simple docstring'''

							UpperCAmelCase		:							Optional[int]   					=   ViTForMaskedImageModeling(config=lowerCAmelCase__			)
							model.to(lowerCAmelCase__			)
							model.eval()
							UpperCAmelCase		:							str   					=   model(lowerCAmelCase__			)
							self.parent.assertEqual(
							    result.reconstruction.shape    ,			(self.batch_size, self.num_channels, self.image_size, self.image_size)			)

							# test greyscale images
							UpperCAmelCase		:							Dict   					=   1
							UpperCAmelCase		:							List[str]   					=   ViTForMaskedImageModeling(lowerCAmelCase__			)
							model.to(lowerCAmelCase__			)
							model.eval()

							UpperCAmelCase		:							List[str]   					=   floats_tensor([self.batch_size, 1, self.image_size, self.image_size]			)
							UpperCAmelCase		:							str   					=   model(lowerCAmelCase__			)
							self.parent.assertEqual(result.reconstruction.shape    ,			(self.batch_size, 1, self.image_size, self.image_size)			)







		def       A_       ( self    ,			snake_case    ,			snake_case    ,			snake_case			):


							'''simple docstring'''

							UpperCAmelCase		:							Tuple   					=   self.type_sequence_label_size
							UpperCAmelCase		:							List[str]   					=   ViTForImageClassification(lowerCAmelCase__			)
							model.to(lowerCAmelCase__			)
							model.eval()
							UpperCAmelCase		:							Any   					=   model(lowerCAmelCase__    ,			labels=lowerCAmelCase__			)
							self.parent.assertEqual(result.logits.shape    ,			(self.batch_size, self.type_sequence_label_size)			)

							# test greyscale images
							UpperCAmelCase		:							Union[str, Any]   					=   1
							UpperCAmelCase		:							List[str]   					=   ViTForImageClassification(lowerCAmelCase__			)
							model.to(lowerCAmelCase__			)
							model.eval()

							UpperCAmelCase		:							Union[str, Any]   					=   floats_tensor([self.batch_size, 1, self.image_size, self.image_size]			)
							UpperCAmelCase		:							Dict   					=   model(lowerCAmelCase__			)
							self.parent.assertEqual(result.logits.shape    ,			(self.batch_size, self.type_sequence_label_size)			)







		def       A_       ( self			):


							'''simple docstring'''

							UpperCAmelCase		:							Union[str, Any]   					=   self.prepare_config_and_inputs()
							(
							    UpperCAmelCase    
							)		:							List[str]   					=   config_and_inputs
							UpperCAmelCase		:							Optional[Any]   					=   {"pixel_values": pixel_values}
							return config, inputs_dict







@require_torch
class   UpperCamelCase__    (   UpperCAmelCase_							,							UpperCAmelCase_							,							unittest.TestCase   ):


		"""simple docstring"""

		SCREAMING_SNAKE_CASE__  :	List[Any]   =							(
		    (
		        ViTModel,
		        ViTForImageClassification,
		        ViTForMaskedImageModeling,
		    )
		    if is_torch_available()
		    else ()
		)
		SCREAMING_SNAKE_CASE__  :	Tuple   =							(
		    {'''feature-extraction''': ViTModel, '''image-classification''': ViTForImageClassification}
		    if is_torch_available()
		    else {}
		)
		SCREAMING_SNAKE_CASE__  :	List[str]   =							True

		SCREAMING_SNAKE_CASE__  :	List[Any]   =							False
		SCREAMING_SNAKE_CASE__  :	Optional[Any]   =							False
		SCREAMING_SNAKE_CASE__  :	Tuple   =							False







		def       A_       ( self			):


							'''simple docstring'''

							UpperCAmelCase		:							List[str]   					=   ViTModelTester(self			)
							UpperCAmelCase		:							Union[str, Any]   					=   ConfigTester(self    ,			config_class=lowerCAmelCase__    ,			has_text_modality=lowerCAmelCase__    ,			hidden_size=3_7			)







		def       A_       ( self			):


							'''simple docstring'''

							self.config_tester.run_common_tests()







		@unittest.skip(reason="ViT does not use inputs_embeds"			)
		def       A_       ( self			):


							'''simple docstring'''

							pass







		def       A_       ( self			):


							'''simple docstring'''

							UpperCAmelCase		:							Union[str, Any]   					=   self.model_tester.prepare_config_and_inputs_for_common()

							for model_class in self.all_model_classes:
												UpperCAmelCase		:							Dict   					=   model_class(lowerCAmelCase__			)
												self.assertIsInstance(model.get_input_embeddings()    ,			(nn.Module)			)
												UpperCAmelCase		:							List[Any]   					=   model.get_output_embeddings()
												self.assertTrue(x is None or isinstance(lowerCAmelCase__    ,			nn.Linear			)			)







		def       A_       ( self			):


							'''simple docstring'''

							UpperCAmelCase		:							Optional[Any]   					=   self.model_tester.prepare_config_and_inputs_for_common()

							for model_class in self.all_model_classes:
												UpperCAmelCase		:							List[Any]   					=   model_class(lowerCAmelCase__			)
												UpperCAmelCase		:							int   					=   inspect.signature(model.forward			)
												# signature.parameters is an OrderedDict => so arg_names order is deterministic
												UpperCAmelCase		:							Optional[Any]   					=   [*signature.parameters.keys()]

												UpperCAmelCase		:							Optional[int]   					=   ["pixel_values"]
												self.assertListEqual(arg_names[:1]    ,			lowerCAmelCase__			)







		def       A_       ( self			):


							'''simple docstring'''

							UpperCAmelCase		:							Tuple   					=   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_model(*lowerCAmelCase__			)







		def       A_       ( self			):


							'''simple docstring'''

							UpperCAmelCase		:							Union[str, Any]   					=   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_masked_image_modeling(*lowerCAmelCase__			)







		def       A_       ( self			):


							'''simple docstring'''

							UpperCAmelCase		:							int   					=   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_image_classification(*lowerCAmelCase__			)







		@slow
		def       A_       ( self			):


							'''simple docstring'''

							for model_name in VIT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
												UpperCAmelCase		:							Union[str, Any]   					=   ViTModel.from_pretrained(lowerCAmelCase__			)
												self.assertIsNotNone(lowerCAmelCase__			)





def       lowercase					(     ):



					'''simple docstring'''







					UpperCAmelCase		:							List[Any]   					=   Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png"							)
					return image







@require_torch
@require_vision
class   UpperCamelCase__    (   unittest.TestCase   ):


		"""simple docstring"""

		@cached_property
		def       A_       ( self			):


							'''simple docstring'''

							return ViTImageProcessor.from_pretrained("google/vit-base-patch16-224"			) if is_vision_available() else None







		@slow
		def       A_       ( self			):


							'''simple docstring'''

							UpperCAmelCase		:							int   					=   ViTForImageClassification.from_pretrained("google/vit-base-patch16-224"			).to(lowerCAmelCase__			)

							UpperCAmelCase		:							Optional[Any]   					=   self.default_image_processor
							UpperCAmelCase		:							str   					=   prepare_img()
							UpperCAmelCase		:							Optional[Any]   					=   image_processor(images=lowerCAmelCase__    ,			return_tensors="pt"			).to(lowerCAmelCase__			)

							# forward pass
							with torch.no_grad():
												UpperCAmelCase		:							Optional[int]   					=   model(**lowerCAmelCase__			)

							# verify the logits
							UpperCAmelCase		:							Any   					=   torch.Size((1, 1_0_0_0)			)
							self.assertEqual(outputs.logits.shape    ,			lowerCAmelCase__			)

							UpperCAmelCase		:							List[Any]   					=   torch.tensor([-0.2744, 0.8215, -0.0836]			).to(lowerCAmelCase__			)

							self.assertTrue(torch.allclose(outputs.logits[0, :3]    ,			lowerCAmelCase__    ,			atol=1e-4			)			)







		@slow
		def       A_       ( self			):


							'''simple docstring'''

							UpperCAmelCase		:							str   					=   ViTModel.from_pretrained("facebook/dino-vits8"			).to(lowerCAmelCase__			)

							UpperCAmelCase		:							List[Any]   					=   ViTImageProcessor.from_pretrained("facebook/dino-vits8"    ,			size=4_8_0			)
							UpperCAmelCase		:							List[Any]   					=   prepare_img()
							UpperCAmelCase		:							List[Any]   					=   image_processor(images=lowerCAmelCase__    ,			return_tensors="pt"			)
							UpperCAmelCase		:							int   					=   inputs.pixel_values.to(lowerCAmelCase__			)

							# forward pass
							with torch.no_grad():
												UpperCAmelCase		:							Optional[int]   					=   model(lowerCAmelCase__    ,			interpolate_pos_encoding=lowerCAmelCase__			)

							# verify the logits
							UpperCAmelCase		:							Tuple   					=   torch.Size((1, 3_6_0_1, 3_8_4)			)
							self.assertEqual(outputs.last_hidden_state.shape    ,			lowerCAmelCase__			)

							UpperCAmelCase		:							Union[str, Any]   					=   torch.tensor(
							    [[4.2340, 4.3906, -6.6692], [4.5463, 1.8928, -6.7257], [4.4429, 0.8496, -5.8585]]			).to(lowerCAmelCase__			)

							self.assertTrue(torch.allclose(outputs.last_hidden_state[0, :3, :3]    ,			lowerCAmelCase__    ,			atol=1e-4			)			)







		@slow
		@require_accelerate
		@require_torch_gpu
		def       A_       ( self			):


							'''simple docstring'''

							UpperCAmelCase		:							Dict   					=   ViTModel.from_pretrained("facebook/dino-vits8"    ,			torch_dtype=torch.floataa    ,			device_map="auto"			)
							UpperCAmelCase		:							int   					=   self.default_image_processor

							UpperCAmelCase		:							Union[str, Any]   					=   prepare_img()
							UpperCAmelCase		:							Dict   					=   image_processor(images=lowerCAmelCase__    ,			return_tensors="pt"			)
							UpperCAmelCase		:							str   					=   inputs.pixel_values.to(lowerCAmelCase__			)

							# forward pass to make sure inference works in fp16
							with torch.no_grad():
												UpperCAmelCase		:							str   					=   model(lowerCAmelCase__			)



import gc
import unittest

import numpy as np
import torch
from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer

from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEPipeline
from diffusers.pipelines.shap_e import ShapERenderer
from diffusers.utils import load_numpy, slow
from diffusers.utils.testing_utils import require_torch_gpu, torch_device

from ..test_pipelines_common import PipelineTesterMixin, assert_mean_pixel_difference



class   __lowercase				( UpperCAmelCase_		,       unittest.TestCase	):




			"""simple docstring"""







			_UpperCAmelCase   :							List[str]										=     ShapEPipeline
			_UpperCAmelCase   :							Tuple										=     ['''prompt''']
			_UpperCAmelCase   :							Dict										=     ['''prompt''']
			_UpperCAmelCase   :							Any										=     [
			    '''num_images_per_prompt''',
			    '''num_inference_steps''',
			    '''generator''',
			    '''latents''',
			    '''guidance_scale''',
			    '''frame_size''',
			    '''output_type''',
			    '''return_dict''',
			]
			_UpperCAmelCase   :							Optional[int]										=     False



			@property
			def        _SCREAMING_SNAKE_CASE			( self  :     List[str]):
									return 32



			@property
			def        _SCREAMING_SNAKE_CASE			( self  :     List[str]):
									return 32



			@property
			def        _SCREAMING_SNAKE_CASE			( self  :     int):
									return self.time_input_dim * 4



			@property
			def        _SCREAMING_SNAKE_CASE			( self  :     Optional[int]):
									return 8



			@property
			def        _SCREAMING_SNAKE_CASE			( self  :     int):
									SCREAMING_SNAKE_CASE_: str  		=       CLIPTokenizer.from_pretrained("hf-internal-testing/tiny-random-clip")
									return tokenizer



			@property
			def        _SCREAMING_SNAKE_CASE			( self  :     Union[str, Any]):
									torch.manual_seed(0)
									SCREAMING_SNAKE_CASE_: Optional[int]  		=       CLIPTextConfig(
									    bos_token_id=0   ,						eos_token_id=2   ,						hidden_size=self.text_embedder_hidden_size   ,						projection_dim=self.text_embedder_hidden_size   ,						intermediate_size=37   ,						layer_norm_eps=1E-05   ,						num_attention_heads=4   ,						num_hidden_layers=5   ,						pad_token_id=1   ,						vocab_size=1000   ,						)
									return CLIPTextModelWithProjection(lowerCAmelCase__)



			@property
			def        _SCREAMING_SNAKE_CASE			( self  :     Optional[Any]):
									torch.manual_seed(0)

									SCREAMING_SNAKE_CASE_: Tuple  		=       {
									    "num_attention_heads": 2,
									    "attention_head_dim": 16,
									    "embedding_dim": self.time_input_dim,
									    "num_embeddings": 32,
									    "embedding_proj_dim": self.text_embedder_hidden_size,
									    "time_embed_dim": self.time_embed_dim,
									    "num_layers": 1,
									    "clip_embed_dim": self.time_input_dim * 2,
									    "additional_embeddings": 0,
									    "time_embed_act_fn": "gelu",
									    "norm_in_type": "layer",
									    "encoder_hid_proj_type": None,
									    "added_emb_type": None,
									}

									SCREAMING_SNAKE_CASE_: Any  		=       PriorTransformer(**lowerCAmelCase__)
									return model



			@property
			def        _SCREAMING_SNAKE_CASE			( self  :     Dict):
									torch.manual_seed(0)

									SCREAMING_SNAKE_CASE_: Union[str, Any]  		=       {
									    "param_shapes": (
									        (self.renderer_dim, 93),
									        (self.renderer_dim, 8),
									        (self.renderer_dim, 8),
									        (self.renderer_dim, 8),
									    ),
									    "d_latent": self.time_input_dim,
									    "d_hidden": self.renderer_dim,
									    "n_output": 12,
									    "background": (
									        0.1,
									        0.1,
									        0.1,
									    ),
									}
									SCREAMING_SNAKE_CASE_: Optional[int]  		=       ShapERenderer(**lowerCAmelCase__)
									return model



			def        _SCREAMING_SNAKE_CASE			( self  :     List[str]):
									SCREAMING_SNAKE_CASE_: Dict  		=       self.dummy_prior
									SCREAMING_SNAKE_CASE_: Optional[Any]  		=       self.dummy_text_encoder
									SCREAMING_SNAKE_CASE_: Union[str, Any]  		=       self.dummy_tokenizer
									SCREAMING_SNAKE_CASE_: List[str]  		=       self.dummy_renderer

									SCREAMING_SNAKE_CASE_: Any  		=       HeunDiscreteScheduler(
									    beta_schedule="exp"   ,						num_train_timesteps=1024   ,						prediction_type="sample"   ,						use_karras_sigmas=lowerCAmelCase__   ,						clip_sample=lowerCAmelCase__   ,						clip_sample_range=1.0   ,						)
									SCREAMING_SNAKE_CASE_: Optional[int]  		=       {
									    "prior": prior,
									    "text_encoder": text_encoder,
									    "tokenizer": tokenizer,
									    "renderer": renderer,
									    "scheduler": scheduler,
									}

									return components



			def        _SCREAMING_SNAKE_CASE			( self  :     Any   ,						lowerCAmelCase__  :     Optional[int]   ,						lowerCAmelCase__  :     List[Any]=0):
									if str(lowerCAmelCase__).startswith("mps"):
															SCREAMING_SNAKE_CASE_: Optional[Any]  		=       torch.manual_seed(lowerCAmelCase__)
									else:
															SCREAMING_SNAKE_CASE_: Any  		=       torch.Generator(device=lowerCAmelCase__).manual_seed(lowerCAmelCase__)
									SCREAMING_SNAKE_CASE_: Union[str, Any]  		=       {
									    "prompt": "horse",
									    "generator": generator,
									    "num_inference_steps": 1,
									    "frame_size": 32,
									    "output_type": "np",
									}
									return inputs



			def        _SCREAMING_SNAKE_CASE			( self  :     Dict):
									SCREAMING_SNAKE_CASE_: str  		=       "cpu"

									SCREAMING_SNAKE_CASE_: Tuple  		=       self.get_dummy_components()

									SCREAMING_SNAKE_CASE_: Dict  		=       self.pipeline_class(**lowerCAmelCase__)
									SCREAMING_SNAKE_CASE_: Any  		=       pipe.to(lowerCAmelCase__)

									pipe.set_progress_bar_config(disable=lowerCAmelCase__)

									SCREAMING_SNAKE_CASE_: Optional[int]  		=       pipe(**self.get_dummy_inputs(lowerCAmelCase__))
									SCREAMING_SNAKE_CASE_: Optional[Any]  		=       output.images[0]
									SCREAMING_SNAKE_CASE_: Any  		=       image[0, -3:, -3:, -1]

									assert image.shape == (20, 32, 32, 3)

									SCREAMING_SNAKE_CASE_: Union[str, Any]  		=       np.array(
									    [
									        0.0003_9216,
									        0.0003_9216,
									        0.0003_9216,
									        0.0003_9216,
									        0.0003_9216,
									        0.0003_9216,
									        0.0003_9216,
									        0.0003_9216,
									        0.0003_9216,
									    ])

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



			def        _SCREAMING_SNAKE_CASE			( self  :     Union[str, Any]):
									# NOTE: Larger batch sizes cause this test to timeout, only test on smaller batches
									self._test_inference_batch_consistent(batch_sizes=[1, 2])



			def        _SCREAMING_SNAKE_CASE			( self  :     Any):
									SCREAMING_SNAKE_CASE_: Dict  		=       torch_device == "cpu"
									SCREAMING_SNAKE_CASE_: List[Any]  		=       True

									self._test_inference_batch_single_identical(
									    batch_size=2   ,						test_max_difference=lowerCAmelCase__   ,						relax_max_difference=lowerCAmelCase__   ,						)




			def        _SCREAMING_SNAKE_CASE			( self  :     int):
									SCREAMING_SNAKE_CASE_: Dict  		=       self.get_dummy_components()
									SCREAMING_SNAKE_CASE_: str  		=       self.pipeline_class(**lowerCAmelCase__)
									SCREAMING_SNAKE_CASE_: Tuple  		=       pipe.to(lowerCAmelCase__)
									pipe.set_progress_bar_config(disable=lowerCAmelCase__)

									SCREAMING_SNAKE_CASE_: List[Any]  		=       1
									SCREAMING_SNAKE_CASE_: Any  		=       2

									SCREAMING_SNAKE_CASE_: Dict  		=       self.get_dummy_inputs(lowerCAmelCase__)

									for key in inputs.keys():
															if key in self.batch_params:
																					SCREAMING_SNAKE_CASE_: List[Any]  		=       batch_size * [inputs[key]]

									SCREAMING_SNAKE_CASE_: Tuple  		=       pipe(**lowerCAmelCase__   ,						num_images_per_prompt=lowerCAmelCase__)[0]

									assert images.shape[0] == batch_size * num_images_per_prompt







@slow
@require_torch_gpu
class   __lowercase				( unittest.TestCase	):




			"""simple docstring"""







			def        _SCREAMING_SNAKE_CASE			( self  :     Any):
									# clean up the VRAM after each test
									super().tearDown()
									gc.collect()
									torch.cuda.empty_cache()




			def        _SCREAMING_SNAKE_CASE			( self  :     str):
									SCREAMING_SNAKE_CASE_: List[str]  		=       load_numpy(
									    "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main"
									    "/shap_e/test_shap_e_np_out.npy")
									SCREAMING_SNAKE_CASE_: List[str]  		=       ShapEPipeline.from_pretrained("openai/shap-e")
									SCREAMING_SNAKE_CASE_: Optional[int]  		=       pipe.to(lowerCAmelCase__)
									pipe.set_progress_bar_config(disable=lowerCAmelCase__)

									SCREAMING_SNAKE_CASE_: int  		=       torch.Generator(device=lowerCAmelCase__).manual_seed(0)

									SCREAMING_SNAKE_CASE_: int  		=       pipe(
									    "a shark"   ,						generator=lowerCAmelCase__   ,						guidance_scale=15.0   ,						num_inference_steps=64   ,						frame_size=64   ,						output_type="np"   ,						).images[0]

									assert images.shape == (20, 64, 64, 3)

									assert_mean_pixel_difference(lowerCAmelCase__   ,						lowerCAmelCase__)






