

from collections import OrderedDict
from typing import Any, Mapping, Optional

from ... import PreTrainedTokenizer
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast
from ...onnx.utils import compute_effective_axis_dimension
from ...utils import TensorType, is_torch_available, logging


_lowerCamelCase    :       Optional[Any]        =							logging.get_logger(__name__)

_lowerCamelCase    :       Optional[int]        =							{
    "Helsinki-NLP/opus-mt-en-de": "https://huggingface.co/Helsinki-NLP/opus-mt-en-de/resolve/main/config.json",
    # See all Marian models at https://huggingface.co/models?filter=marian
}





class  __UpperCAmelCase					(	_UpperCamelCase						):
			UpperCamelCase       					=					'marian'
			UpperCamelCase       					=					['past_key_values']
			UpperCamelCase       					=					{'num_attention_heads': 'encoder_attention_heads', 'hidden_size': 'd_model'}



			def __init__(							self							:					List[str],		__A							:					Union[str, Any]=5_8_1_0_1,		__A							:					Tuple=None,		__A							:					int=1_0_2_4,		__A							:					Tuple=1_2,		__A							:					Any=4_0_9_6,		__A							:					int=1_6,		__A							:					Any=1_2,		__A							:					Optional[Any]=4_0_9_6,		__A							:					List[str]=1_6,		__A							:					List[str]=0.0,		__A							:					Any=0.0,		__A							:					Dict=True,		__A							:					Union[str, Any]=True,		__A							:					str="gelu",		__A							:					Any=1_0_2_4,		__A							:					Any=0.1,		__A							:					List[str]=0.0,		__A							:					List[Any]=0.0,		__A							:					Tuple=0.0_2,		__A							:					Optional[int]=5_8_1_0_0,		__A							:					Dict=False,		__A							:					str=5_8_1_0_0,		__A							:					Tuple=0,		__A							:					Union[str, Any]=0,		__A							:					List[Any]=True,		**__A							:					Any,		):
					UpperCAmelCase	:							Optional[int]						=			vocab_size
					UpperCAmelCase	:							List[str]						=			decoder_vocab_size or vocab_size
					UpperCAmelCase	:							Optional[Any]						=			max_position_embeddings
					UpperCAmelCase	:							Union[str, Any]						=			d_model
					UpperCAmelCase	:							Any						=			encoder_ffn_dim
					UpperCAmelCase	:							Tuple						=			encoder_layers
					UpperCAmelCase	:							List[Any]						=			encoder_attention_heads
					UpperCAmelCase	:							Dict						=			decoder_ffn_dim
					UpperCAmelCase	:							Dict						=			decoder_layers
					UpperCAmelCase	:							Optional[int]						=			decoder_attention_heads
					UpperCAmelCase	:							Optional[int]						=			dropout
					UpperCAmelCase	:							List[str]						=			attention_dropout
					UpperCAmelCase	:							int						=			activation_dropout
					UpperCAmelCase	:							Optional[int]						=			activation_function
					UpperCAmelCase	:							Tuple						=			init_std
					UpperCAmelCase	:							List[Any]						=			encoder_layerdrop
					UpperCAmelCase	:							List[str]						=			decoder_layerdrop
					UpperCAmelCase	:							Dict						=			use_cache
					UpperCAmelCase	:							Dict						=			encoder_layers
					UpperCAmelCase	:							List[Any]						=			scale_embedding  # scale factor will be sqrt(d_model) if True
					UpperCAmelCase	:							Optional[Any]						=			share_encoder_decoder_embeddings
					super().__init__(
					    pad_token_id=_UpperCAmelCase,		eos_token_id=_UpperCAmelCase,		is_encoder_decoder=_UpperCAmelCase,		decoder_start_token_id=_UpperCAmelCase,		forced_eos_token_id=_UpperCAmelCase,		**_UpperCAmelCase,		)






class  __UpperCAmelCase					(	_UpperCamelCase						):



			@property
			# Copied from transformers.models.bart.configuration_bart.BartOnnxConfig.inputs
			def 	__magic_name__   (							self							:					List[str]						):
					if self.task in ["default", "seq2seq-lm"]:
							UpperCAmelCase	:							List[str]						=			OrderedDict(
							    [
							        ('''input_ids''', {0: '''batch''', 1: '''encoder_sequence'''}),
							        ('''attention_mask''', {0: '''batch''', 1: '''encoder_sequence'''}),
							    ]						)

							if self.use_past:
									UpperCAmelCase	:							List[Any]						=			{0: 'batch'}
									UpperCAmelCase	:							List[str]						=			{0: 'batch', 1: 'past_decoder_sequence + sequence'}
							else:
									UpperCAmelCase	:							Optional[Any]						=			{0: 'batch', 1: 'decoder_sequence'}
									UpperCAmelCase	:							Tuple						=			{0: 'batch', 1: 'decoder_sequence'}

							if self.use_past:
									self.fill_with_past_key_values_(_UpperCAmelCase,		direction='''inputs'''						)
					elif self.task == "causal-lm":
							# TODO: figure this case out.
							UpperCAmelCase	:							Dict						=			OrderedDict(
							    [
							        ('''input_ids''', {0: '''batch''', 1: '''encoder_sequence'''}),
							        ('''attention_mask''', {0: '''batch''', 1: '''encoder_sequence'''}),
							    ]						)
							if self.use_past:
									UpperCAmelCase	:							Tuple						=			self.num_layers
									for i in range(_UpperCAmelCase						):
											UpperCAmelCase	:							int						=			{0: 'batch', 2: 'past_sequence + sequence'}
											UpperCAmelCase	:							int						=			{0: 'batch', 2: 'past_sequence + sequence'}
					else:
							UpperCAmelCase	:							Tuple						=			OrderedDict(
							    [
							        ('''input_ids''', {0: '''batch''', 1: '''encoder_sequence'''}),
							        ('''attention_mask''', {0: '''batch''', 1: '''encoder_sequence'''}),
							        ('''decoder_input_ids''', {0: '''batch''', 1: '''decoder_sequence'''}),
							        ('''decoder_attention_mask''', {0: '''batch''', 1: '''decoder_sequence'''}),
							    ]						)

					return common_inputs



			@property
			# Copied from transformers.models.bart.configuration_bart.BartOnnxConfig.outputs
			def 	__magic_name__   (							self							:					Union[str, Any]						):
					if self.task in ["default", "seq2seq-lm"]:
							UpperCAmelCase	:							int						=			super().outputs
					else:
							UpperCAmelCase	:							int						=			super(_UpperCAmelCase,		self						).outputs
							if self.use_past:
									UpperCAmelCase	:							int						=			self.num_layers
									for i in range(_UpperCAmelCase						):
											UpperCAmelCase	:							Optional[Any]						=			{0: 'batch', 2: 'past_sequence + sequence'}
											UpperCAmelCase	:							Optional[int]						=			{0: 'batch', 2: 'past_sequence + sequence'}
					return common_outputs



			def 	__magic_name__   (							self							:					Any,		__A							:					PreTrainedTokenizer,		__A							:					int = -1,		__A							:					int = -1,		__A							:					bool = False,		__A							:					Optional[TensorType] = None,		):
					UpperCAmelCase	:							int						=			self._generate_dummy_inputs_for_encoder_and_decoder(
					    _UpperCAmelCase,		_UpperCAmelCase,		_UpperCAmelCase,		_UpperCAmelCase,		_UpperCAmelCase						)

					# Generate decoder inputs
					UpperCAmelCase	:							List[str]						=			seq_length if not self.use_past else 1
					UpperCAmelCase	:							List[Any]						=			self._generate_dummy_inputs_for_encoder_and_decoder(
					    _UpperCAmelCase,		_UpperCAmelCase,		_UpperCAmelCase,		_UpperCAmelCase,		_UpperCAmelCase						)
					UpperCAmelCase	:							Dict						=			{F'''decoder_{name}''': tensor for name, tensor in decoder_inputs.items()}
					UpperCAmelCase	:							int						=			dict(**_UpperCAmelCase,		**_UpperCAmelCase						)

					if self.use_past:
							if not is_torch_available():
									raise ValueError('''Cannot generate dummy past_keys inputs without PyTorch installed.'''						)
							else:
									import torch
							UpperCAmelCase	:							str						=			common_inputs['input_ids'].shape
							UpperCAmelCase	:							Tuple						=			common_inputs['decoder_input_ids'].shape[1]
							UpperCAmelCase	:							Optional[int]						=			self.num_attention_heads
							UpperCAmelCase	:							Tuple						=			(
							    batch,
							    num_encoder_attention_heads,
							    encoder_seq_length,
							    self._config.hidden_size // num_encoder_attention_heads,
							)
							UpperCAmelCase	:							Optional[Any]						=			decoder_seq_length + 3
							UpperCAmelCase	:							Union[str, Any]						=			(
							    batch,
							    num_decoder_attention_heads,
							    decoder_past_length,
							    self._config.hidden_size // num_decoder_attention_heads,
							)

							UpperCAmelCase	:							List[Any]						=			torch.cat(
							    [common_inputs['''decoder_attention_mask'''], torch.ones(_UpperCAmelCase,		_UpperCAmelCase						)],		dim=1						)

							UpperCAmelCase	:							Dict						=			[]
							# If the number of encoder and decoder layers are present in the model configuration, both are considered
							UpperCAmelCase	:							Optional[Any]						=			self.num_layers
							UpperCAmelCase	:							List[Any]						=			min(_UpperCAmelCase,		_UpperCAmelCase						)
							UpperCAmelCase	:							Optional[int]						=			max(_UpperCAmelCase,		_UpperCAmelCase						) - min_num_layers
							UpperCAmelCase	:							int						=			'encoder' if num_encoder_layers > num_decoder_layers else 'decoder'

							for _ in range(_UpperCAmelCase						):
									common_inputs["past_key_values"].append(
									    (
									        torch.zeros(_UpperCAmelCase						),
									        torch.zeros(_UpperCAmelCase						),
									        torch.zeros(_UpperCAmelCase						),
									        torch.zeros(_UpperCAmelCase						),
									    )						)
							# TODO: test this.
							UpperCAmelCase	:							Optional[int]						=			encoder_shape if remaining_side_name == 'encoder' else decoder_shape
							for _ in range(_UpperCAmelCase,		_UpperCAmelCase						):
									common_inputs["past_key_values"].append((torch.zeros(_UpperCAmelCase						), torch.zeros(_UpperCAmelCase						))						)
					return common_inputs



			def 	__magic_name__   (							self							:					Union[str, Any],		__A							:					PreTrainedTokenizer,		__A							:					int = -1,		__A							:					int = -1,		__A							:					bool = False,		__A							:					Optional[TensorType] = None,		):
					UpperCAmelCase	:							int						=			self._generate_dummy_inputs_for_encoder_and_decoder(
					    _UpperCAmelCase,		_UpperCAmelCase,		_UpperCAmelCase,		_UpperCAmelCase,		_UpperCAmelCase						)

					if self.use_past:
							if not is_torch_available():
									raise ValueError('''Cannot generate dummy past_keys inputs without PyTorch installed.'''						)
							else:
									import torch
							UpperCAmelCase	:							int						=			common_inputs['input_ids'].shape
							# Not using the same length for past_key_values
							UpperCAmelCase	:							Optional[int]						=			seqlen + 2
							UpperCAmelCase	:							List[str]						=			self.num_layers
							UpperCAmelCase	:							Tuple						=			self.num_attention_heads
							UpperCAmelCase	:							int						=			(
							    batch,
							    num_encoder_attention_heads,
							    past_key_values_length,
							    self._config.hidden_size // num_encoder_attention_heads,
							)

							UpperCAmelCase	:							List[str]						=			common_inputs['attention_mask'].dtype
							UpperCAmelCase	:							Tuple						=			torch.cat(
							    [common_inputs['''attention_mask'''], torch.ones(_UpperCAmelCase,		_UpperCAmelCase,		dtype=_UpperCAmelCase						)],		dim=1						)
							UpperCAmelCase	:							int						=			[
							    (torch.zeros(_UpperCAmelCase						), torch.zeros(_UpperCAmelCase						)) for _ in range(_UpperCAmelCase						)
							]
					return common_inputs



			def 	__magic_name__   (							self							:					int,		__A							:					PreTrainedTokenizer,		__A							:					int = -1,		__A							:					int = -1,		__A							:					bool = False,		__A							:					Optional[TensorType] = None,		):
					# Copied from OnnxConfig.generate_dummy_inputs
					# Did not use super(OnnxConfigWithPast, self).generate_dummy_inputs for code clarity.
					# If dynamic axis (-1) we forward with a fixed dimension of 2 samples to avoid optimizations made by ONNX
					UpperCAmelCase	:							List[str]						=			compute_effective_axis_dimension(
					    _UpperCAmelCase,		fixed_dimension=OnnxConfig.default_fixed_batch,		num_token_to_add=0						)

					# If dynamic axis (-1) we forward with a fixed dimension of 8 tokens to avoid optimizations made by ONNX
					UpperCAmelCase	:							List[Any]						=			tokenizer.num_special_tokens_to_add(_UpperCAmelCase						)
					UpperCAmelCase	:							Union[str, Any]						=			compute_effective_axis_dimension(
					    _UpperCAmelCase,		fixed_dimension=OnnxConfig.default_fixed_sequence,		num_token_to_add=_UpperCAmelCase						)

					# Generate dummy inputs according to compute batch and sequence
					UpperCAmelCase	:							Tuple						=			[' '.join([tokenizer.unk_token]						) * seq_length] * batch_size
					UpperCAmelCase	:							Any						=			dict(tokenizer(_UpperCAmelCase,		return_tensors=_UpperCAmelCase						)						)
					return common_inputs



			def 	__magic_name__   (							self							:					List[str],		__A							:					PreTrainedTokenizer,		__A							:					int = -1,		__A							:					int = -1,		__A							:					bool = False,		__A							:					Optional[TensorType] = None,		):
					if self.task in ["default", "seq2seq-lm"]:
							UpperCAmelCase	:							Any						=			self._generate_dummy_inputs_for_default_and_seqaseq_lm(
							    _UpperCAmelCase,		batch_size=_UpperCAmelCase,		seq_length=_UpperCAmelCase,		is_pair=_UpperCAmelCase,		framework=_UpperCAmelCase						)

					else:
							UpperCAmelCase	:							List[Any]						=			self._generate_dummy_inputs_for_causal_lm(
							    _UpperCAmelCase,		batch_size=_UpperCAmelCase,		seq_length=_UpperCAmelCase,		is_pair=_UpperCAmelCase,		framework=_UpperCAmelCase						)

					return common_inputs



			def 	__magic_name__   (							self							:					Tuple,		__A							:					Union[str, Any],		__A							:					Any,		__A							:					int,		__A							:					List[str]						):
					if self.task in ["default", "seq2seq-lm"]:
							UpperCAmelCase	:							List[str]						=			super()._flatten_past_key_values_(_UpperCAmelCase,		_UpperCAmelCase,		_UpperCAmelCase,		_UpperCAmelCase						)
					else:
							UpperCAmelCase	:							Tuple						=			super(_UpperCAmelCase,		self						)._flatten_past_key_values_(
							    _UpperCAmelCase,		_UpperCAmelCase,		_UpperCAmelCase,		_UpperCAmelCase						)





			@property
			def 	__magic_name__   (							self							:					Optional[int]						):
					return 1E-4








import gc
import random
import unittest

import numpy as np
import torch
from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel

from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline
from diffusers.pipelines.shap_e import ShapERenderer
from diffusers.utils import floats_tensor, load_image, 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  __UpperCAmelCase					(	lowerCamelCase__      ,  unittest.TestCase						):
   UpperCamelCase       					=					ShapEImgaImgPipeline
   UpperCamelCase       					=					["""image"""]
   UpperCamelCase       					=					["""image"""]
   UpperCamelCase       					=					[
       """num_images_per_prompt""",
       """num_inference_steps""",
       """generator""",
       """latents""",
       """guidance_scale""",
       """frame_size""",
       """output_type""",
       """return_dict""",
   ]
   UpperCamelCase       					=					False



   @property
   def 	__magic_name__   (							self							:					Optional[Any]						):
     return 3_2



   @property
   def 	__magic_name__   (							self							:					Optional[int]						):
     return 3_2



   @property
   def 	__magic_name__   (							self							:					Union[str, Any]						):
     return self.time_input_dim * 4



   @property
   def 	__magic_name__   (							self							:					Any						):
     return 8



   @property
   def 	__magic_name__   (							self							:					List[str]						):
     torch.manual_seed(0						)
     UpperCAmelCase	:							str						=			CLIPVisionConfig(
         hidden_size=self.text_embedder_hidden_size,		image_size=6_4,		projection_dim=self.text_embedder_hidden_size,		intermediate_size=3_7,		num_attention_heads=4,		num_channels=3,		num_hidden_layers=5,		patch_size=1,		)

     UpperCAmelCase	:							Any						=			CLIPVisionModel(__A						)
     return model



   @property
   def 	__magic_name__   (							self							:					int						):
     UpperCAmelCase	:							Optional[int]						=			CLIPImageProcessor(
         crop_size=2_2_4,		do_center_crop=__A,		do_normalize=__A,		do_resize=__A,		image_mean=[0.4_8_1_4_5_4_6_6, 0.4_5_7_8_2_7_5, 0.4_0_8_2_1_0_7_3],		image_std=[0.2_6_8_6_2_9_5_4, 0.2_6_1_3_0_2_5_8, 0.2_7_5_7_7_7_1_1],		resample=3,		size=2_2_4,		)

     return image_processor



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

     UpperCAmelCase	:							Any						=			{
         '''num_attention_heads''': 2,
         '''attention_head_dim''': 1_6,
         '''embedding_dim''': self.time_input_dim,
         '''num_embeddings''': 3_2,
         '''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''',
         '''embedding_proj_norm_type''': '''layer''',
         '''encoder_hid_proj_type''': None,
         '''added_emb_type''': None,
     }

     UpperCAmelCase	:							List[Any]						=			PriorTransformer(**__A						)
     return model



   @property
   def 	__magic_name__   (							self							:					Union[str, Any]						):
     torch.manual_seed(0						)

     UpperCAmelCase	:							List[Any]						=			{
         '''param_shapes''': (
             (self.renderer_dim, 9_3),
             (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''': 1_2,
         '''background''': (
             0.1,
             0.1,
             0.1,
         ),
     }
     UpperCAmelCase	:							List[str]						=			ShapERenderer(**__A						)
     return model



   def 	__magic_name__   (							self							:					List[Any]						):
     UpperCAmelCase	:							str						=			self.dummy_prior
     UpperCAmelCase	:							List[str]						=			self.dummy_image_encoder
     UpperCAmelCase	:							List[Any]						=			self.dummy_image_processor
     UpperCAmelCase	:							Dict						=			self.dummy_renderer

     UpperCAmelCase	:							int						=			HeunDiscreteScheduler(
         beta_schedule='''exp''',		num_train_timesteps=1_0_2_4,		prediction_type='''sample''',		use_karras_sigmas=__A,		clip_sample=__A,		clip_sample_range=1.0,		)
     UpperCAmelCase	:							List[str]						=			{
         '''prior''': prior,
         '''image_encoder''': image_encoder,
         '''image_processor''': image_processor,
         '''renderer''': renderer,
         '''scheduler''': scheduler,
     }

     return components



   def 	__magic_name__   (							self							:					List[Any],		__A							:					Dict,		__A							:					List[Any]=0						):
     UpperCAmelCase	:							int						=			floats_tensor((1, 3, 6_4, 6_4),		rng=random.Random(__A						)						).to(__A						)

     if str(__A						).startswith('''mps'''						):
       UpperCAmelCase	:							List[str]						=			torch.manual_seed(__A						)
     else:
       UpperCAmelCase	:							Optional[Any]						=			torch.Generator(device=__A						).manual_seed(__A						)
     UpperCAmelCase	:							Dict						=			{
         '''image''': input_image,
         '''generator''': generator,
         '''num_inference_steps''': 1,
         '''frame_size''': 3_2,
         '''output_type''': '''np''',
     }
     return inputs



   def 	__magic_name__   (							self							:					str						):
     UpperCAmelCase	:							Dict						=			'''cpu'''

     UpperCAmelCase	:							Any						=			self.get_dummy_components()

     UpperCAmelCase	:							Tuple						=			self.pipeline_class(**__A						)
     UpperCAmelCase	:							Dict						=			pipe.to(__A						)

     pipe.set_progress_bar_config(disable=__A						)

     UpperCAmelCase	:							List[Any]						=			pipe(**self.get_dummy_inputs(__A						)						)
     UpperCAmelCase	:							Any						=			output.images[0]
     UpperCAmelCase	:							List[str]						=			image[0, -3:, -3:, -1]

     assert image.shape == (2_0, 3_2, 3_2, 3)

     UpperCAmelCase	:							Optional[int]						=			np.array(
         [
             0.0_0_0_3_9_2_1_6,
             0.0_0_0_3_9_2_1_6,
             0.0_0_0_3_9_2_1_6,
             0.0_0_0_3_9_2_1_6,
             0.0_0_0_3_9_2_1_6,
             0.0_0_0_3_9_2_1_6,
             0.0_0_0_3_9_2_1_6,
             0.0_0_0_3_9_2_1_6,
             0.0_0_0_3_9_2_1_6,
         ]						)

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



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



   def 	__magic_name__   (							self							:					str						):
     UpperCAmelCase	:							Tuple						=			torch_device == '''cpu'''
     UpperCAmelCase	:							List[Any]						=			True
     self._test_inference_batch_single_identical(
         batch_size=2,		test_max_difference=__A,		relax_max_difference=__A,		)





   def 	__magic_name__   (							self							:					Dict						):
     UpperCAmelCase	:							Dict						=			self.get_dummy_components()
     UpperCAmelCase	:							Union[str, Any]						=			self.pipeline_class(**__A						)
     UpperCAmelCase	:							List[str]						=			pipe.to(__A						)
     pipe.set_progress_bar_config(disable=__A						)

     UpperCAmelCase	:							Any						=			1
     UpperCAmelCase	:							Any						=			2

     UpperCAmelCase	:							Optional[int]						=			self.get_dummy_inputs(__A						)

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

     UpperCAmelCase	:							int						=			pipe(**__A,		num_images_per_prompt=__A						)[0]

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






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



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





   def 	__magic_name__   (							self							:					Tuple						):
     UpperCAmelCase	:							List[str]						=			load_image(
         '''https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main''' '''/shap_e/corgi.png'''						)
     UpperCAmelCase	:							Dict						=			load_numpy(
         '''https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main'''
         '''/shap_e/test_shap_e_img2img_out.npy'''						)
     UpperCAmelCase	:							Union[str, Any]						=			ShapEImgaImgPipeline.from_pretrained('''openai/shap-e-img2img'''						)
     UpperCAmelCase	:							int						=			pipe.to(__A						)
     pipe.set_progress_bar_config(disable=__A						)

     UpperCAmelCase	:							Dict						=			torch.Generator(device=__A						).manual_seed(0						)

     UpperCAmelCase	:							List[str]						=			pipe(
         __A,		generator=__A,		guidance_scale=3.0,		num_inference_steps=6_4,		frame_size=6_4,		output_type='''np''',		).images[0]

     assert images.shape == (2_0, 6_4, 6_4, 3)

     assert_mean_pixel_difference(__A,		__A						)





