




'''simple docstring'''


import unittest

from parameterized import parameterized

from transformers import AutoTokenizer, GPTNeoXConfig, is_torch_available, set_seed
from transformers.testing_utils import require_torch, slow, torch_device

from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
  import torch

  from transformers import (
      GPTNeoXForCausalLM,
      GPTNeoXForQuestionAnswering,
      GPTNeoXForSequenceClassification,
      GPTNeoXForTokenClassification,
      GPTNeoXModel,
  )





class    __lowercase						:







   def __init__(	self      ,							UpperCamelCase      ,							UpperCamelCase=13      ,							UpperCamelCase=7      ,							UpperCamelCase=True      ,							UpperCamelCase=True      ,							UpperCamelCase=True      ,							UpperCamelCase=True      ,							UpperCamelCase=99      ,							UpperCamelCase=64      ,							UpperCamelCase=5      ,							UpperCamelCase=4      ,							UpperCamelCase=37      ,							UpperCamelCase="gelu"      ,							UpperCamelCase=0.1      ,							UpperCamelCase=0.1      ,							UpperCamelCase=512      ,							UpperCamelCase=16      ,							UpperCamelCase=2      ,							UpperCamelCase=0.02      ,							UpperCamelCase=3      ,							UpperCamelCase=4      ,							UpperCamelCase=None      ,							)				->    int:
     __a			=					parent
     __a			=					batch_size
     __a			=					seq_length
     __a			=					is_training
     __a			=					use_input_mask
     __a			=					use_token_type_ids
     __a			=					use_labels
     __a			=					vocab_size
     __a			=					hidden_size
     __a			=					num_hidden_layers
     __a			=					num_attention_heads
     __a			=					intermediate_size
     __a			=					hidden_act
     __a			=					hidden_dropout_prob
     __a			=					attention_probs_dropout_prob
     __a			=					max_position_embeddings
     __a			=					type_vocab_size
     __a			=					type_sequence_label_size
     __a			=					initializer_range
     __a			=					num_labels
     __a			=					num_choices
     __a			=					scope
     __a			=					vocab_size - 1







   def 		UpperCamelCase__			(	self      )				->    List[str]:
     __a			=					ids_tensor([self.batch_size, self.seq_length]      ,							self.vocab_size      )

     __a			=					None
     if self.use_input_mask:
       __a			=					random_attention_mask([self.batch_size, self.seq_length]      )

     __a			=					None
     if self.use_labels:
       __a			=					ids_tensor([self.batch_size, self.seq_length]      ,							self.num_labels      )

     __a			=					self.get_config()

     return config, input_ids, input_mask, token_labels







   def 		UpperCamelCase__			(	self      )				->    Optional[int]:
     return GPTNeoXConfig(
         vocab_size=self.vocab_size      ,							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      ,							max_position_embeddings=self.max_position_embeddings      ,							type_vocab_size=self.type_vocab_size      ,							is_decoder=UpperCamelCase      ,							initializer_range=self.initializer_range      ,							pad_token_id=self.pad_token_id      ,							)







   def 		UpperCamelCase__			(	self      )				->    Dict:
     __a	,       __a	,       __a	,       __a			=					self.prepare_config_and_inputs()

     __a			=					True

     return config, input_ids, input_mask, token_labels







   def 		UpperCamelCase__			(	self      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      )				->    Optional[int]:
     __a			=					GPTNeoXModel(config=UpperCamelCase      )
     model.to(UpperCamelCase      )
     model.eval()
     __a			=					model(UpperCamelCase      ,							attention_mask=UpperCamelCase      )
     __a			=					model(UpperCamelCase      )
     self.parent.assertEqual(result.last_hidden_state.shape      ,							(self.batch_size, self.seq_length, self.hidden_size)      )







   def 		UpperCamelCase__			(	self      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      )				->    Dict:
     __a			=					True
     __a			=					GPTNeoXModel(UpperCamelCase      )
     model.to(UpperCamelCase      )
     model.eval()
     __a			=					model(UpperCamelCase      ,							attention_mask=UpperCamelCase      )
     self.parent.assertEqual(result.last_hidden_state.shape      ,							(self.batch_size, self.seq_length, self.hidden_size)      )







   def 		UpperCamelCase__			(	self      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      )				->    List[str]:
     __a			=					GPTNeoXForCausalLM(config=UpperCamelCase      )
     model.to(UpperCamelCase      )
     model.eval()
     __a			=					model(UpperCamelCase      ,							attention_mask=UpperCamelCase      ,							labels=UpperCamelCase      )
     self.parent.assertEqual(result.logits.shape      ,							(self.batch_size, self.seq_length, self.vocab_size)      )







   def 		UpperCamelCase__			(	self      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      )				->    Optional[Any]:
     __a			=					self.num_labels
     __a			=					GPTNeoXForQuestionAnswering(UpperCamelCase      )
     model.to(UpperCamelCase      )
     model.eval()
     __a			=					model(UpperCamelCase      ,							attention_mask=UpperCamelCase      )
     self.parent.assertEqual(result.start_logits.shape      ,							(self.batch_size, self.seq_length)      )
     self.parent.assertEqual(result.end_logits.shape      ,							(self.batch_size, self.seq_length)      )







   def 		UpperCamelCase__			(	self      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      )				->    Tuple:
     __a			=					self.num_labels
     __a			=					GPTNeoXForSequenceClassification(UpperCamelCase      )
     model.to(UpperCamelCase      )
     model.eval()
     __a			=					ids_tensor([self.batch_size]      ,							self.type_sequence_label_size      )
     __a			=					model(UpperCamelCase      ,							attention_mask=UpperCamelCase      ,							labels=UpperCamelCase      )
     self.parent.assertEqual(result.logits.shape      ,							(self.batch_size, self.num_labels)      )







   def 		UpperCamelCase__			(	self      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      )				->    Union[str, Any]:
     __a			=					self.num_labels
     __a			=					GPTNeoXForTokenClassification(UpperCamelCase      )
     model.to(UpperCamelCase      )
     model.eval()
     __a			=					model(UpperCamelCase      ,							attention_mask=UpperCamelCase      ,							labels=UpperCamelCase      )
     self.parent.assertEqual(result.logits.shape      ,							(self.batch_size, self.seq_length, self.num_labels)      )







   def 		UpperCamelCase__			(	self      ,							UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      )				->    Any:
     __a			=					True
     __a			=					GPTNeoXForCausalLM(config=UpperCamelCase      )
     model.to(UpperCamelCase      )
     model.eval()

     # first forward pass
     __a			=					model(UpperCamelCase      ,							attention_mask=UpperCamelCase      ,							use_cache=UpperCamelCase      )
     __a			=					outputs.past_key_values

     # create hypothetical multiple next token and extent to next_input_ids
     __a			=					ids_tensor((self.batch_size, 3)      ,							config.vocab_size      )
     __a			=					ids_tensor((self.batch_size, 3)      ,							vocab_size=2      )

     # append to next input_ids and
     __a			=					torch.cat([input_ids, next_tokens]      ,							dim=-1      )
     __a			=					torch.cat([input_mask, next_mask]      ,							dim=-1      )

     __a			=					model(UpperCamelCase      ,							attention_mask=UpperCamelCase      ,							output_hidden_states=UpperCamelCase      )
     __a			=					output_from_no_past['hidden_states'][0]
     __a			=					model(
         UpperCamelCase      ,							attention_mask=UpperCamelCase      ,							past_key_values=UpperCamelCase      ,							output_hidden_states=UpperCamelCase      ,							)['hidden_states'][0]

     # select random slice
     __a			=					ids_tensor((1,)      ,							output_from_past.shape[-1]      ).item()
     __a			=					output_from_no_past[:, -3:, random_slice_idx].detach()
     __a			=					output_from_past[:, :, random_slice_idx].detach()

     self.parent.assertTrue(output_from_past_slice.shape[1] == next_tokens.shape[1]      )

     # test that outputs are equal for slice
     self.parent.assertTrue(torch.allclose(UpperCamelCase      ,							UpperCamelCase      ,							atol=1e-3      )      )







   def 		UpperCamelCase__			(	self      )				->    List[Any]:
     __a			=					self.prepare_config_and_inputs()
     __a	,       __a	,       __a	,       __a			=					config_and_inputs
     __a			=					{'input_ids': input_ids, 'attention_mask': input_mask}
     return config, inputs_dict





@require_torch
class    __lowercase						(  __magic_name__       ,							__magic_name__       ,							__magic_name__       ,							unittest.TestCase ):
   _a							=      (
       (
           GPTNeoXModel,
           GPTNeoXForCausalLM,
           GPTNeoXForQuestionAnswering,
           GPTNeoXForSequenceClassification,
           GPTNeoXForTokenClassification,
       )
       if is_torch_available()
       else ()
   )
   _a							=      (GPTNeoXForCausalLM,) if is_torch_available() else ()
   _a							=      (
       {
           """feature-extraction""": GPTNeoXModel,
           """question-answering""": GPTNeoXForQuestionAnswering,
           """text-classification""": GPTNeoXForSequenceClassification,
           """text-generation""": GPTNeoXForCausalLM,
           """token-classification""": GPTNeoXForTokenClassification,
           """zero-shot""": GPTNeoXForSequenceClassification,
       }
       if is_torch_available()
       else {}
   )
   _a							=      False
   _a							=      False
   _a							=      False
   _a							=      False







   def 		UpperCamelCase__			(	self      )				->    List[str]:
     __a			=					GPTNeoXModelTester(self      )
     __a			=					ConfigTester(self      ,							config_class=UpperCamelCase      ,							hidden_size=64      ,							num_attention_heads=8      )







   def 		UpperCamelCase__			(	self      )				->    List[str]:
     self.config_tester.run_common_tests()







   def 		UpperCamelCase__			(	self      )				->    List[str]:
     __a	,       __a	,       __a	,       __a			=					self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_model(UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      )







   def 		UpperCamelCase__			(	self      )				->    Dict:
     __a	,       __a	,       __a	,       __a			=					self.model_tester.prepare_config_and_inputs_for_decoder()
     self.model_tester.create_and_check_model_as_decoder(UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      )







   def 		UpperCamelCase__			(	self      )				->    Optional[int]:
     # This regression test was failing with PyTorch < 1.3
     __a	,       __a	,       __a	,       __a			=					self.model_tester.prepare_config_and_inputs_for_decoder()

     __a			=					None

     self.model_tester.create_and_check_model_as_decoder(UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      )







   def 		UpperCamelCase__			(	self      )				->    str:
     __a	,       __a	,       __a	,       __a			=					self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_decoder_model_past_large_inputs(UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      )







   def 		UpperCamelCase__			(	self      )				->    List[Any]:
     __a			=					self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_for_causal_lm(*UpperCamelCase      )







   def 		UpperCamelCase__			(	self      )				->    Union[str, Any]:
     __a			=					self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_for_question_answering(*UpperCamelCase      )







   def 		UpperCamelCase__			(	self      )				->    List[Any]:
     __a			=					self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_for_sequence_classification(*UpperCamelCase      )







   def 		UpperCamelCase__			(	self      )				->    Optional[int]:
     __a			=					self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_for_token_classification(*UpperCamelCase      )







   @unittest.skip(reason='Feed forward chunking is not implemented'      )
   def 		UpperCamelCase__			(	self      )				->    Tuple:
     pass







   @parameterized.expand([('linear',), ('dynamic',)]      )
   def 		UpperCamelCase__			(	self      ,							UpperCamelCase      )				->    List[Any]:
     __a	,       __a			=					self.model_tester.prepare_config_and_inputs_for_common()
     __a			=					ids_tensor([1, 10]      ,							config.vocab_size      )
     __a			=					ids_tensor([1, int(config.max_position_embeddings * 1.5      )]      ,							config.vocab_size      )

     set_seed(42      )  # Fixed seed at init time so the two models get the same random weights
     __a			=					GPTNeoXModel(UpperCamelCase      )
     original_model.to(UpperCamelCase      )
     original_model.eval()
     __a			=					original_model(UpperCamelCase      ).last_hidden_state
     __a			=					original_model(UpperCamelCase      ).last_hidden_state

     set_seed(42      )  # Fixed seed at init time so the two models get the same random weights
     __a			=					{'type': scaling_type, 'factor': 10.0}
     __a			=					GPTNeoXModel(UpperCamelCase      )
     scaled_model.to(UpperCamelCase      )
     scaled_model.eval()
     __a			=					scaled_model(UpperCamelCase      ).last_hidden_state
     __a			=					scaled_model(UpperCamelCase      ).last_hidden_state

     # Dynamic scaling does not change the RoPE embeddings until it receives an input longer than the original
     # maximum sequence length, so the outputs for the short input should match.
     if scaling_type == "dynamic":
       self.assertTrue(torch.allclose(UpperCamelCase      ,							UpperCamelCase      ,							atol=1e-5      )      )
     else:
       self.assertFalse(torch.allclose(UpperCamelCase      ,							UpperCamelCase      ,							atol=1e-5      )      )

     # The output should be different for long inputs
     self.assertFalse(torch.allclose(UpperCamelCase      ,							UpperCamelCase      ,							atol=1e-5      )      )





@require_torch
class    __lowercase						(  unittest.TestCase ):







   @slow
   def 		UpperCamelCase__			(	self      )				->    Dict:
     __a			=					AutoTokenizer.from_pretrained('EleutherAI/pythia-410m-deduped'      )
     for checkpointing in [True, False]:
       __a			=					GPTNeoXForCausalLM.from_pretrained('EleutherAI/pythia-410m-deduped'      )

       if checkpointing:
         model.gradient_checkpointing_enable()
       else:
         model.gradient_checkpointing_disable()
       model.to(UpperCamelCase      )

       __a			=					tokenizer('My favorite food is'      ,							return_tensors='pt'      ).to(UpperCamelCase      )
       # The hub repo. is updated on 2023-04-04, resulting in poor outputs.
       # See: https://github.com/huggingface/transformers/pull/24193
       __a			=					'My favorite food is a good old-fashioned, old-fashioned, old-fashioned.\n\nI\'m not sure'

       __a			=					model.generate(**UpperCamelCase      ,							do_sample=UpperCamelCase      ,							max_new_tokens=20      )
       __a			=					tokenizer.batch_decode(UpperCamelCase      )[0]

       self.assertEqual(UpperCamelCase      ,							UpperCamelCase      )









'''simple docstring'''


import tempfile

import numpy as np
import torch
from transformers import AutoTokenizer, TaEncoderModel

from diffusers import DDPMScheduler, UNetaDConditionModel
from diffusers.models.attention_processor import AttnAddedKVProcessor
from diffusers.pipelines.deepfloyd_if import IFWatermarker
from diffusers.utils.testing_utils import torch_device

from ..test_pipelines_common import to_np





class    __lowercase						:







   def 		UpperCamelCase__			(	self      )				->    List[Any]:
     torch.manual_seed(0      )
     __a			=					TaEncoderModel.from_pretrained('hf-internal-testing/tiny-random-t5'      )

     torch.manual_seed(0      )
     __a			=					AutoTokenizer.from_pretrained('hf-internal-testing/tiny-random-t5'      )

     torch.manual_seed(0      )
     __a			=					UNetaDConditionModel(
         sample_size=32      ,							layers_per_block=1      ,							block_out_channels=[32, 64]      ,							down_block_types=[
             'ResnetDownsampleBlock2D',
             'SimpleCrossAttnDownBlock2D',
         ]      ,							mid_block_type='UNetMidBlock2DSimpleCrossAttn'      ,							up_block_types=['SimpleCrossAttnUpBlock2D', 'ResnetUpsampleBlock2D']      ,							in_channels=3      ,							out_channels=6      ,							cross_attention_dim=32      ,							encoder_hid_dim=32      ,							attention_head_dim=8      ,							addition_embed_type='text'      ,							addition_embed_type_num_heads=2      ,							cross_attention_norm='group_norm'      ,							resnet_time_scale_shift='scale_shift'      ,							act_fn='gelu'      ,							)
     unet.set_attn_processor(AttnAddedKVProcessor()      )  # For reproducibility tests

     torch.manual_seed(0      )
     __a			=					DDPMScheduler(
         num_train_timesteps=1000      ,							beta_schedule='squaredcos_cap_v2'      ,							beta_start=0.0_001      ,							beta_end=0.02      ,							thresholding=UpperCamelCase      ,							dynamic_thresholding_ratio=0.95      ,							sample_max_value=1.0      ,							prediction_type='epsilon'      ,							variance_type='learned_range'      ,							)

     torch.manual_seed(0      )
     __a			=					IFWatermarker()

     return {
         "text_encoder": text_encoder,
         "tokenizer": tokenizer,
         "unet": unet,
         "scheduler": scheduler,
         "watermarker": watermarker,
         "safety_checker": None,
         "feature_extractor": None,
     }







   def 		UpperCamelCase__			(	self      )				->    Tuple:
     torch.manual_seed(0      )
     __a			=					TaEncoderModel.from_pretrained('hf-internal-testing/tiny-random-t5'      )

     torch.manual_seed(0      )
     __a			=					AutoTokenizer.from_pretrained('hf-internal-testing/tiny-random-t5'      )

     torch.manual_seed(0      )
     __a			=					UNetaDConditionModel(
         sample_size=32      ,							layers_per_block=[1, 2]      ,							block_out_channels=[32, 64]      ,							down_block_types=[
             'ResnetDownsampleBlock2D',
             'SimpleCrossAttnDownBlock2D',
         ]      ,							mid_block_type='UNetMidBlock2DSimpleCrossAttn'      ,							up_block_types=['SimpleCrossAttnUpBlock2D', 'ResnetUpsampleBlock2D']      ,							in_channels=6      ,							out_channels=6      ,							cross_attention_dim=32      ,							encoder_hid_dim=32      ,							attention_head_dim=8      ,							addition_embed_type='text'      ,							addition_embed_type_num_heads=2      ,							cross_attention_norm='group_norm'      ,							resnet_time_scale_shift='scale_shift'      ,							act_fn='gelu'      ,							class_embed_type='timestep'      ,							mid_block_scale_factor=1.414      ,							time_embedding_act_fn='gelu'      ,							time_embedding_dim=32      ,							)
     unet.set_attn_processor(AttnAddedKVProcessor()      )  # For reproducibility tests

     torch.manual_seed(0      )
     __a			=					DDPMScheduler(
         num_train_timesteps=1000      ,							beta_schedule='squaredcos_cap_v2'      ,							beta_start=0.0_001      ,							beta_end=0.02      ,							thresholding=UpperCamelCase      ,							dynamic_thresholding_ratio=0.95      ,							sample_max_value=1.0      ,							prediction_type='epsilon'      ,							variance_type='learned_range'      ,							)

     torch.manual_seed(0      )
     __a			=					DDPMScheduler(
         num_train_timesteps=1000      ,							beta_schedule='squaredcos_cap_v2'      ,							beta_start=0.0_001      ,							beta_end=0.02      ,							)

     torch.manual_seed(0      )
     __a			=					IFWatermarker()

     return {
         "text_encoder": text_encoder,
         "tokenizer": tokenizer,
         "unet": unet,
         "scheduler": scheduler,
         "image_noising_scheduler": image_noising_scheduler,
         "watermarker": watermarker,
         "safety_checker": None,
         "feature_extractor": None,
     }







   def 		UpperCamelCase__			(	self      )				->    Tuple:
     __a			=					self.get_dummy_components()
     __a			=					self.pipeline_class(**UpperCamelCase      )
     pipe.to(UpperCamelCase      )
     pipe.set_progress_bar_config(disable=UpperCamelCase      )

     __a			=					self.get_dummy_inputs(UpperCamelCase      )

     __a			=					inputs['prompt']
     __a			=					inputs['generator']
     __a			=					inputs['num_inference_steps']
     __a			=					inputs['output_type']

     if "image" in inputs:
       __a			=					inputs['image']
     else:
       __a			=					None

     if "mask_image" in inputs:
       __a			=					inputs['mask_image']
     else:
       __a			=					None

     if "original_image" in inputs:
       __a			=					inputs['original_image']
     else:
       __a			=					None

     __a	,       __a			=					pipe.encode_prompt(UpperCamelCase      )

     # inputs with prompt converted to embeddings
     __a			=					{
         'prompt_embeds': prompt_embeds,
         'negative_prompt_embeds': negative_prompt_embeds,
         'generator': generator,
         'num_inference_steps': num_inference_steps,
         'output_type': output_type,
     }

     if image is not None:
       __a			=					image

     if mask_image is not None:
       __a			=					mask_image

     if original_image is not None:
       __a			=					original_image

     # set all optional components to None
     for optional_component in pipe._optional_components:
       setattr(UpperCamelCase      ,							UpperCamelCase      ,							UpperCamelCase      )

     __a			=					pipe(**UpperCamelCase      )[0]

     with tempfile.TemporaryDirectory() as tmpdir:
       pipe.save_pretrained(UpperCamelCase      )
       __a			=					self.pipeline_class.from_pretrained(UpperCamelCase      )
       pipe_loaded.to(UpperCamelCase      )
       pipe_loaded.set_progress_bar_config(disable=UpperCamelCase      )

     pipe_loaded.unet.set_attn_processor(AttnAddedKVProcessor()      )  # For reproducibility tests

     for optional_component in pipe._optional_components:
       self.assertTrue(
           getattr(UpperCamelCase      ,							UpperCamelCase      ) is None      ,							f"`{optional_component}` did not stay set to None after loading."      ,							)

     __a			=					self.get_dummy_inputs(UpperCamelCase      )

     __a			=					inputs['generator']
     __a			=					inputs['num_inference_steps']
     __a			=					inputs['output_type']

     # inputs with prompt converted to embeddings
     __a			=					{
         'prompt_embeds': prompt_embeds,
         'negative_prompt_embeds': negative_prompt_embeds,
         'generator': generator,
         'num_inference_steps': num_inference_steps,
         'output_type': output_type,
     }

     if image is not None:
       __a			=					image

     if mask_image is not None:
       __a			=					mask_image

     if original_image is not None:
       __a			=					original_image

     __a			=					pipe_loaded(**UpperCamelCase      )[0]

     __a			=					np.abs(to_np(UpperCamelCase      ) - to_np(UpperCamelCase      )      ).max()
     self.assertLess(UpperCamelCase      ,							1e-4      )







   def 		UpperCamelCase__			(	self      )				->    str:
     __a			=					self.get_dummy_components()
     __a			=					self.pipeline_class(**UpperCamelCase      )
     pipe.to(UpperCamelCase      )
     pipe.set_progress_bar_config(disable=UpperCamelCase      )

     __a			=					self.get_dummy_inputs(UpperCamelCase      )
     __a			=					pipe(**UpperCamelCase      )[0]

     with tempfile.TemporaryDirectory() as tmpdir:
       pipe.save_pretrained(UpperCamelCase      )
       __a			=					self.pipeline_class.from_pretrained(UpperCamelCase      )
       pipe_loaded.to(UpperCamelCase      )
       pipe_loaded.set_progress_bar_config(disable=UpperCamelCase      )

     pipe_loaded.unet.set_attn_processor(AttnAddedKVProcessor()      )  # For reproducibility tests

     __a			=					self.get_dummy_inputs(UpperCamelCase      )
     __a			=					pipe_loaded(**UpperCamelCase      )[0]

     __a			=					np.abs(to_np(UpperCamelCase      ) - to_np(UpperCamelCase      )      ).max()
     self.assertLess(UpperCamelCase      ,							1e-4      )



