import gc
import random
import unittest

import numpy as np
import torch
from PIL import Image

from diffusers import (
    DDIMScheduler,
    KandinskyVaaControlnetImgaImgPipeline,
    KandinskyVaaPriorEmbaEmbPipeline,
    UNetaDConditionModel,
    VQModel,
)
from diffusers.utils import floats_tensor, load_image, load_numpy, slow, torch_device
from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu

from ..test_pipelines_common import PipelineTesterMixin, assert_mean_pixel_difference


enable_full_determinism()






class 		a__						(					A__    ,		unittest.TestCase					):
					A	       =							KandinskyVaaControlnetImgaImgPipeline
					A	       =							['image_embeds', 'negative_image_embeds', 'image', 'hint']
					A	       =							['image_embeds', 'negative_image_embeds', 'image', 'hint']
					A	       =							[
					    'generator',
					    'height',
					    'width',
					    'strength',
					    'guidance_scale',
					    'num_inference_steps',
					    'return_dict',
					    'guidance_scale',
					    'num_images_per_prompt',
					    'output_type',
					    'return_dict',
					]
					A	       =							False

					@property
					def 				__UpperCamelCase   (    self      :       Optional[Any]    ):







							"""simple docstring"""






							return 32

					@property
					def 				__UpperCamelCase   (    self      :       Optional[Any]    ):







							"""simple docstring"""






							return 32

					@property
					def 				__UpperCamelCase   (    self      :       int    ):







							"""simple docstring"""






							return self.time_input_dim

					@property
					def 				__UpperCamelCase   (    self      :       List[Any]    ):







							"""simple docstring"""






							return self.time_input_dim * 4

					@property
					def 				__UpperCamelCase   (    self      :       List[Any]    ):







							"""simple docstring"""






							return 100

					@property
					def 				__UpperCamelCase   (    self      :       Union[str, Any]    ):







							"""simple docstring"""






							torch.manual_seed(0    )

							SCREAMING_SNAKE_CASE_  :		List[str]				      =    {
							    "in_channels": 8,
							    # Out channels is double in channels because predicts mean and variance
							    "out_channels": 8,
							    "addition_embed_type": "image_hint",
							    "down_block_types": ("ResnetDownsampleBlock2D", "SimpleCrossAttnDownBlock2D"),
							    "up_block_types": ("SimpleCrossAttnUpBlock2D", "ResnetUpsampleBlock2D"),
							    "mid_block_type": "UNetMidBlock2DSimpleCrossAttn",
							    "block_out_channels": (self.block_out_channels_a, self.block_out_channels_a * 2),
							    "layers_per_block": 1,
							    "encoder_hid_dim": self.text_embedder_hidden_size,
							    "encoder_hid_dim_type": "image_proj",
							    "cross_attention_dim": self.cross_attention_dim,
							    "attention_head_dim": 4,
							    "resnet_time_scale_shift": "scale_shift",
							    "class_embed_type": None,
							}

							SCREAMING_SNAKE_CASE_  :		Optional[int]				      =    UNetaDConditionModel(**_A    )
							return model

					@property
					def 				__UpperCamelCase   (    self      :       Any    ):







							"""simple docstring"""






							return {
							    "block_out_channels": [32, 32, 64, 64],
							    "down_block_types": [
							        "DownEncoderBlock2D",
							        "DownEncoderBlock2D",
							        "DownEncoderBlock2D",
							        "AttnDownEncoderBlock2D",
							    ],
							    "in_channels": 3,
							    "latent_channels": 4,
							    "layers_per_block": 1,
							    "norm_num_groups": 8,
							    "norm_type": "spatial",
							    "num_vq_embeddings": 12,
							    "out_channels": 3,
							    "up_block_types": ["AttnUpDecoderBlock2D", "UpDecoderBlock2D", "UpDecoderBlock2D", "UpDecoderBlock2D"],
							    "vq_embed_dim": 4,
							}

					@property
					def 				__UpperCamelCase   (    self      :       Dict    ):







							"""simple docstring"""






							torch.manual_seed(0    )
							SCREAMING_SNAKE_CASE_  :		Optional[Any]				      =    VQModel(**self.dummy_movq_kwargs    )
							return model

					def 				__UpperCamelCase   (    self      :       Tuple    ):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_  :		Tuple				      =    self.dummy_unet
							SCREAMING_SNAKE_CASE_  :		Dict				      =    self.dummy_movq

							SCREAMING_SNAKE_CASE_  :		List[str]				      =    {
							    "num_train_timesteps": 1000,
							    "beta_schedule": "linear",
							    "beta_start": 0.00085,
							    "beta_end": 0.012,
							    "clip_sample": False,
							    "set_alpha_to_one": False,
							    "steps_offset": 0,
							    "prediction_type": "epsilon",
							    "thresholding": False,
							}

							SCREAMING_SNAKE_CASE_  :		Optional[Any]				      =    DDIMScheduler(**_A    )

							SCREAMING_SNAKE_CASE_  :		Optional[Any]				      =    {
							    "unet": unet,
							    "scheduler": scheduler,
							    "movq": movq,
							}

							return components

					def 				__UpperCamelCase   (    self      :       Dict,_A      :       Any,_A      :       str=0    ):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_  :		str				      =    floats_tensor((1, self.text_embedder_hidden_size),rng=random.Random(_A    )    ).to(_A    )
							SCREAMING_SNAKE_CASE_  :		str				      =    floats_tensor((1, self.text_embedder_hidden_size),rng=random.Random(seed + 1    )    ).to(
							    _A    )
							# create init_image
							SCREAMING_SNAKE_CASE_  :		Union[str, Any]				      =    floats_tensor((1, 3, 64, 64),rng=random.Random(_A    )    ).to(_A    )
							SCREAMING_SNAKE_CASE_  :		Tuple				      =    image.cpu().permute(0,2,3,1    )[0]
							SCREAMING_SNAKE_CASE_  :		Any				      =    Image.fromarray(np.uinta(_A    )    ).convert("RGB"    ).resize((256, 256)    )
							# create hint
							SCREAMING_SNAKE_CASE_  :		str				      =    floats_tensor((1, 3, 64, 64),rng=random.Random(_A    )    ).to(_A    )

							if str(_A    ).startswith("mps"    ):
									SCREAMING_SNAKE_CASE_  :		Optional[int]				      =    torch.manual_seed(_A    )
							else:
									SCREAMING_SNAKE_CASE_  :		str				      =    torch.Generator(device=_A    ).manual_seed(_A    )
							SCREAMING_SNAKE_CASE_  :		Tuple				      =    {
							    "image": init_image,
							    "image_embeds": image_embeds,
							    "negative_image_embeds": negative_image_embeds,
							    "hint": hint,
							    "generator": generator,
							    "height": 64,
							    "width": 64,
							    "num_inference_steps": 10,
							    "guidance_scale": 7.0,
							    "strength": 0.2,
							    "output_type": "np",
							}
							return inputs






					def 				__UpperCamelCase   (    self      :       str    ):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_  :		Dict				      =    "cpu"

							SCREAMING_SNAKE_CASE_  :		Dict				      =    self.get_dummy_components()

							SCREAMING_SNAKE_CASE_  :		List[Any]				      =    self.pipeline_class(**_A    )
							SCREAMING_SNAKE_CASE_  :		Optional[int]				      =    pipe.to(_A    )

							pipe.set_progress_bar_config(disable=_A    )

							SCREAMING_SNAKE_CASE_  :		Optional[int]				      =    pipe(**self.get_dummy_inputs(_A    )    )
							SCREAMING_SNAKE_CASE_  :		Tuple				      =    output.images

							SCREAMING_SNAKE_CASE_  :		int				      =    pipe(
							    **self.get_dummy_inputs(_A    ),return_dict=_A,)[0]

							SCREAMING_SNAKE_CASE_  :		Tuple				      =    image[0, -3:, -3:, -1]
							SCREAMING_SNAKE_CASE_  :		str				      =    image_from_tuple[0, -3:, -3:, -1]

							assert image.shape == (1, 64, 64, 3)

							SCREAMING_SNAKE_CASE_  :		Dict				      =    np.array(
							    [0.54985034, 0.55509365, 0.52561504, 0.5570494, 0.5593818, 0.5263979, 0.50285643, 0.5069846, 0.51196736]    )
							assert (
							    np.abs(image_slice.flatten() - expected_slice    ).max() < 1E-2
							), F' expected_slice {expected_slice}, but got {image_slice.flatten()}'
							assert (
							    np.abs(image_from_tuple_slice.flatten() - expected_slice    ).max() < 1E-2
							), F' expected_slice {expected_slice}, but got {image_from_tuple_slice.flatten()}'







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

					def 				__UpperCamelCase   (    self      :       int    ):







							"""simple docstring"""






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






					def 				__UpperCamelCase   (    self      :       Union[str, Any]    ):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_  :		Dict				      =    load_numpy(
							    "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main"
							    "/kandinskyv22/kandinskyv22_controlnet_img2img_robotcat_fp16.npy"    )

							SCREAMING_SNAKE_CASE_  :		Any				      =    load_image(
							    "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main" "/kandinsky/cat.png"    )
							SCREAMING_SNAKE_CASE_  :		int				      =    init_image.resize((512, 512)    )

							SCREAMING_SNAKE_CASE_  :		List[Any]				      =    load_image(
							    "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main"
							    "/kandinskyv22/hint_image_cat.png"    )
							SCREAMING_SNAKE_CASE_  :		Tuple				      =    torch.from_numpy(np.array(_A    )    ).float() / 255.0
							SCREAMING_SNAKE_CASE_  :		str				      =    hint.permute(2,0,1    ).unsqueeze(0    )

							SCREAMING_SNAKE_CASE_  :		int				      =    "A robot, 4k photo"

							SCREAMING_SNAKE_CASE_  :		List[Any]				      =    KandinskyVaaPriorEmbaEmbPipeline.from_pretrained(
							    "kandinsky-community/kandinsky-2-2-prior",torch_dtype=torch.floataa    )
							pipe_prior.to(_A    )

							SCREAMING_SNAKE_CASE_  :		Union[str, Any]				      =    KandinskyVaaControlnetImgaImgPipeline.from_pretrained(
							    "kandinsky-community/kandinsky-2-2-controlnet-depth",torch_dtype=torch.floataa    )
							SCREAMING_SNAKE_CASE_  :		Union[str, Any]				      =    pipeline.to(_A    )

							pipeline.set_progress_bar_config(disable=_A    )

							SCREAMING_SNAKE_CASE_  :		Dict				      =    torch.Generator(device="cpu"    ).manual_seed(0    )

							SCREAMING_SNAKE_CASE_      ,    SCREAMING_SNAKE_CASE_  :		int				      =    pipe_prior(
							    _A,image=_A,strength=0.85,generator=_A,negative_prompt="",).to_tuple()

							SCREAMING_SNAKE_CASE_  :		str				      =    pipeline(
							    image=_A,image_embeds=_A,negative_image_embeds=_A,hint=_A,generator=_A,num_inference_steps=100,height=512,width=512,strength=0.5,output_type="np",)

							SCREAMING_SNAKE_CASE_  :		Tuple				      =    output.images[0]

							assert image.shape == (512, 512, 3)

							assert_mean_pixel_difference(_A,_A    )






import itertools
import json
import linecache
import os
import pickle
import re
import socket
import string
from collections import Counter
from logging import getLogger
from pathlib import Path
from typing import Callable, Dict, Iterable, List

import git
import torch
from torch.utils.data import Dataset

from transformers import BartTokenizer, RagTokenizer, TaTokenizer

def 					UpperCAmelCase_							(      __UpperCAmelCase						:	Dict			,			__UpperCAmelCase						:	Dict			,			__UpperCAmelCase						:	Union[str, Any]			,			__UpperCAmelCase						:	int			,			__UpperCAmelCase						:	Optional[Any]=True			,			__UpperCAmelCase						:	Any="pt"							)					-> List[str]:
      SCREAMING_SNAKE_CASE_							=			{'add_prefix_space': True} if isinstance(__UpperCAmelCase			,			__UpperCAmelCase							) and not line.startswith(' '							) else {}
      SCREAMING_SNAKE_CASE_							=			padding_side
      return tokenizer(
          [line]			,			max_length=__UpperCAmelCase			,			padding='max_length' if pad_to_max_length else None			,			truncation=__UpperCAmelCase			,			return_tensors=__UpperCAmelCase			,			add_special_tokens=__UpperCAmelCase			,			**__UpperCAmelCase			,			)

def 					UpperCAmelCase_							(      __UpperCAmelCase						:	Union[str, Any]			,			__UpperCAmelCase						:	Optional[Any]			,			__UpperCAmelCase						:	Dict=None			,			)					-> Optional[Any]:
      SCREAMING_SNAKE_CASE_							=			input_ids.ne(__UpperCAmelCase							).any(dim=0							)
      if attention_mask is None:
            return input_ids[:, keep_column_mask]
      else:
            return (input_ids[:, keep_column_mask], attention_mask[:, keep_column_mask])





class        lowerCamelCase_							(      _SCREAMING_SNAKE_CASE					):


 '''simple docstring'''







 def __init__(							self  :		List[Any]				,				_lowerCAmelCase  :		Tuple				,				_lowerCAmelCase  :		int				,				_lowerCAmelCase  :		int				,				_lowerCAmelCase  :		Dict				,				_lowerCAmelCase  :		Union[str, Any]="train"				,				_lowerCAmelCase  :		Optional[Any]=None				,				_lowerCAmelCase  :		List[str]=None				,				_lowerCAmelCase  :		Optional[int]=None				,				_lowerCAmelCase  :		Optional[int]=""				,				):
       super().__init__()
       SCREAMING_SNAKE_CASE_							=			Path(_lowerCAmelCase						).joinpath(type_path + '.source'						)
       SCREAMING_SNAKE_CASE_							=			Path(_lowerCAmelCase						).joinpath(type_path + '.target'						)
       SCREAMING_SNAKE_CASE_							=			self.get_char_lens(self.src_file						)
       SCREAMING_SNAKE_CASE_							=			max_source_length
       SCREAMING_SNAKE_CASE_							=			max_target_length
       assert min(self.src_lens						) > 0, F"found empty line in {self.src_file}"
       SCREAMING_SNAKE_CASE_							=			tokenizer
       SCREAMING_SNAKE_CASE_							=			prefix
       if n_obs is not None:
             SCREAMING_SNAKE_CASE_							=			self.src_lens[:n_obs]
       SCREAMING_SNAKE_CASE_							=			src_lang
       SCREAMING_SNAKE_CASE_							=			tgt_lang



 def __len__(							self  :		Tuple						):
       return len(self.src_lens						)



 def __getitem__(							self  :		List[str]				,				_lowerCAmelCase  :		Any						):
       SCREAMING_SNAKE_CASE_							=			index + 1  # linecache starts at 1
       SCREAMING_SNAKE_CASE_							=			self.prefix + linecache.getline(str(self.src_file						)				,				_lowerCAmelCase						).rstrip('\n'						)
       SCREAMING_SNAKE_CASE_							=			linecache.getline(str(self.tgt_file						)				,				_lowerCAmelCase						).rstrip('\n'						)
       assert source_line, F"empty source line for index {index}"
       assert tgt_line, F"empty tgt line for index {index}"

       # Need to add eos token manually for T5
       if isinstance(self.tokenizer				,				_lowerCAmelCase						):
             source_line += self.tokenizer.eos_token
             tgt_line += self.tokenizer.eos_token

       # Pad source and target to the right
       SCREAMING_SNAKE_CASE_							=			(
           self.tokenizer.question_encoder if isinstance(self.tokenizer				,				_lowerCAmelCase						) else self.tokenizer
       )
       SCREAMING_SNAKE_CASE_							=			self.tokenizer.generator if isinstance(self.tokenizer				,				_lowerCAmelCase						) else self.tokenizer

       SCREAMING_SNAKE_CASE_							=			encode_line(_lowerCAmelCase				,				_lowerCAmelCase				,				self.max_source_length				,				'right'						)
       SCREAMING_SNAKE_CASE_							=			encode_line(_lowerCAmelCase				,				_lowerCAmelCase				,				self.max_target_length				,				'right'						)

       SCREAMING_SNAKE_CASE_							=			source_inputs['input_ids'].squeeze()
       SCREAMING_SNAKE_CASE_							=			target_inputs['input_ids'].squeeze()
       SCREAMING_SNAKE_CASE_							=			source_inputs['attention_mask'].squeeze()
       return {
           "input_ids": source_ids,
           "attention_mask": src_mask,
           "decoder_input_ids": target_ids,
       }



 @staticmethod
 def       lowerCAmelCase_  (							_lowerCAmelCase  :		Optional[int]						):
       return [len(_lowerCAmelCase						) for x in Path(_lowerCAmelCase						).open().readlines()]




 def       lowerCAmelCase_  (							self  :		int				,				_lowerCAmelCase  :		Optional[int]						):
       SCREAMING_SNAKE_CASE_							=			torch.stack([x['input_ids'] for x in batch]						)
       SCREAMING_SNAKE_CASE_							=			torch.stack([x['attention_mask'] for x in batch]						)
       SCREAMING_SNAKE_CASE_							=			torch.stack([x['decoder_input_ids'] for x in batch]						)
       SCREAMING_SNAKE_CASE_							=			(
           self.tokenizer.generator.pad_token_id
           if isinstance(self.tokenizer				,				_lowerCAmelCase						)
           else self.tokenizer.pad_token_id
       )
       SCREAMING_SNAKE_CASE_							=			(
           self.tokenizer.question_encoder.pad_token_id
           if isinstance(self.tokenizer				,				_lowerCAmelCase						)
           else self.tokenizer.pad_token_id
       )
       SCREAMING_SNAKE_CASE_							=			trim_batch(_lowerCAmelCase				,				_lowerCAmelCase						)
       SCREAMING_SNAKE_CASE_						, SCREAMING_SNAKE_CASE_							=			trim_batch(_lowerCAmelCase				,				_lowerCAmelCase				,				attention_mask=_lowerCAmelCase						)
       SCREAMING_SNAKE_CASE_							=			{
           'input_ids': source_ids,
           'attention_mask': source_mask,
           'decoder_input_ids': y,
       }
       return batch


lowerCamelCase__ :   List[str]					=							getLogger(__name__)

def 					UpperCAmelCase_							(      __UpperCAmelCase						:	List[List]							)					-> Tuple:
      return list(itertools.chain.from_iterable(__UpperCAmelCase							)							)

def 					UpperCAmelCase_							(      __UpperCAmelCase						:	str							)					-> None:
      SCREAMING_SNAKE_CASE_							=			get_git_info()
      save_json(__UpperCAmelCase			,			os.path.join(__UpperCAmelCase			,			'git_log.json'							)							)

def 					UpperCAmelCase_							(      __UpperCAmelCase						:	Dict			,			__UpperCAmelCase						:	Tuple			,			__UpperCAmelCase						:	Optional[int]=4			,			**__UpperCAmelCase						:	Tuple							)					-> str:
      with open(__UpperCAmelCase			,			'w'							) as f:
            json.dump(__UpperCAmelCase			,			__UpperCAmelCase			,			indent=__UpperCAmelCase			,			**__UpperCAmelCase							)

def 					UpperCAmelCase_							(      __UpperCAmelCase						:	List[str]							)					-> int:
      with open(__UpperCAmelCase							) as f:
            return json.load(__UpperCAmelCase							)

def 					UpperCAmelCase_							(      )					-> Tuple:
      SCREAMING_SNAKE_CASE_							=			git.Repo(search_parent_directories=__UpperCAmelCase							)
      SCREAMING_SNAKE_CASE_							=			{
          'repo_id': str(__UpperCAmelCase							),
          'repo_sha': str(repo.head.object.hexsha							),
          'repo_branch': str(repo.active_branch							),
          'hostname': str(socket.gethostname()							),
      }
      return repo_infos

def 					UpperCAmelCase_							(      __UpperCAmelCase						:	Callable			,			__UpperCAmelCase						:	Iterable							)					-> List:
      return list(map(__UpperCAmelCase			,			__UpperCAmelCase							)							)

def 					UpperCAmelCase_							(      __UpperCAmelCase						:	str			,			__UpperCAmelCase						:	Dict							)					-> Dict:
      with open(__UpperCAmelCase			,			'wb'							) as f:
            return pickle.dump(__UpperCAmelCase			,			__UpperCAmelCase							)

def 					UpperCAmelCase_							(      __UpperCAmelCase						:	List[Any]							)					-> Any:

      def remove_articles(__UpperCAmelCase						:	Any							):
            return re.sub(r'\b(a|an|the)\b'			,			' '			,			__UpperCAmelCase							)

      def white_space_fix(__UpperCAmelCase						:	List[str]							):
            return " ".join(text.split()							)

      def remove_punc(__UpperCAmelCase						:	List[Any]							):
            SCREAMING_SNAKE_CASE_							=			set(string.punctuation							)
            return "".join(ch for ch in text if ch not in exclude							)

      def lower(__UpperCAmelCase						:	Union[str, Any]							):
            return text.lower()

      return white_space_fix(remove_articles(remove_punc(lower(__UpperCAmelCase							)							)							)							)

def 					UpperCAmelCase_							(      __UpperCAmelCase						:	int			,			__UpperCAmelCase						:	Any							)					-> List[str]:
      SCREAMING_SNAKE_CASE_							=			normalize_answer(__UpperCAmelCase							).split()
      SCREAMING_SNAKE_CASE_							=			normalize_answer(__UpperCAmelCase							).split()
      SCREAMING_SNAKE_CASE_							=			Counter(__UpperCAmelCase							) & Counter(__UpperCAmelCase							)
      SCREAMING_SNAKE_CASE_							=			sum(common.values()							)
      if num_same == 0:
            return 0
      SCREAMING_SNAKE_CASE_							=			1.0 * num_same / len(__UpperCAmelCase							)
      SCREAMING_SNAKE_CASE_							=			1.0 * num_same / len(__UpperCAmelCase							)
      SCREAMING_SNAKE_CASE_							=			(2 * precision * recall) / (precision + recall)
      return fa

def 					UpperCAmelCase_							(      __UpperCAmelCase						:	str			,			__UpperCAmelCase						:	Optional[int]							)					-> Any:
      return normalize_answer(__UpperCAmelCase							) == normalize_answer(__UpperCAmelCase							)

def 					UpperCAmelCase_							(      __UpperCAmelCase						:	List[str]			,			__UpperCAmelCase						:	List[str]							)					-> Dict:
      assert len(__UpperCAmelCase							) == len(__UpperCAmelCase							)
      SCREAMING_SNAKE_CASE_							=			0
      for hypo, pred in zip(__UpperCAmelCase			,			__UpperCAmelCase							):
            em += exact_match_score(__UpperCAmelCase			,			__UpperCAmelCase							)
      if len(__UpperCAmelCase							) > 0:
            em /= len(__UpperCAmelCase							)
      return {"em": em}

def 					UpperCAmelCase_							(      __UpperCAmelCase						:	Union[str, Any]							)					-> Dict:
      return model_prefix.startswith('rag'							)





def 					UpperCAmelCase_							(      __UpperCAmelCase						:	Optional[Any]			,			__UpperCAmelCase						:	Any			,			__UpperCAmelCase						:	List[str]							)					-> Tuple:
      SCREAMING_SNAKE_CASE_							=			{p: p for p in extra_params}
      # T5 models don't have `dropout` param, they have `dropout_rate` instead
      SCREAMING_SNAKE_CASE_							=			'dropout_rate'
      for p in extra_params:
            if getattr(__UpperCAmelCase			,			__UpperCAmelCase			,			__UpperCAmelCase							):
                  if not hasattr(__UpperCAmelCase			,			__UpperCAmelCase							) and not hasattr(__UpperCAmelCase			,			equivalent_param[p]							):
                        logger.info('config doesn\'t have a `{}` attribute'.format(__UpperCAmelCase							)							)
                        delattr(__UpperCAmelCase			,			__UpperCAmelCase							)
                        continue
                  SCREAMING_SNAKE_CASE_							=			p if hasattr(__UpperCAmelCase			,			__UpperCAmelCase							) else equivalent_param[p]
                  setattr(__UpperCAmelCase			,			__UpperCAmelCase			,			getattr(__UpperCAmelCase			,			__UpperCAmelCase							)							)
                  delattr(__UpperCAmelCase			,			__UpperCAmelCase							)
      return hparams, config