

import gc
import random
import unittest

import numpy as np
import torch
from PIL import Image
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer

from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel
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


enable_full_determinism()

class 							UpperCAmelCase_						(     unittest.TestCase  ):
							"""simple docstring"""







							def 							__lowercase							(     self			)       ->       str:
												# clean up the VRAM after each test
												super().tearDown()
												gc.collect()
												torch.cuda.empty_cache()


							@property
							def 							__lowercase							(     self			)       ->       Optional[Any]:
												_a      :       str   =						1
												_a      :       Union[str, Any]   =						3
												_a      :       Optional[int]   =						(3_2, 3_2)

												_a      :       int   =						floats_tensor((batch_size, num_channels) + sizes			,				rng=random.Random(0			)			).to(_a			)
												return image


							@property
							def 							__lowercase							(     self			)       ->       str:
												torch.manual_seed(0			)
												_a      :       str   =						UNetaDConditionModel(
												    block_out_channels=(3_2, 3_2, 6_4)			,				layers_per_block=2			,				sample_size=3_2			,				in_channels=7			,				out_channels=4			,				down_block_types=('''DownBlock2D''', '''CrossAttnDownBlock2D''', '''CrossAttnDownBlock2D''')			,				up_block_types=('''CrossAttnUpBlock2D''', '''CrossAttnUpBlock2D''', '''UpBlock2D''')			,				cross_attention_dim=3_2			,				attention_head_dim=8			,				use_linear_projection=_a			,				only_cross_attention=(True, True, False)			,				num_class_embeds=1_0_0			,				)
												return model


							@property
							def 							__lowercase							(     self			)       ->       Any:
												torch.manual_seed(0			)
												_a      :       Optional[Any]   =						AutoencoderKL(
												    block_out_channels=[3_2, 3_2, 6_4]			,				in_channels=3			,				out_channels=3			,				down_block_types=['''DownEncoderBlock2D''', '''DownEncoderBlock2D''', '''DownEncoderBlock2D''']			,				up_block_types=['''UpDecoderBlock2D''', '''UpDecoderBlock2D''', '''UpDecoderBlock2D''']			,				latent_channels=4			,				)
												return model


							@property
							def 							__lowercase							(     self			)       ->       str:
												torch.manual_seed(0			)
												_a      :       List[str]   =						CLIPTextConfig(
												    bos_token_id=0			,				eos_token_id=2			,				hidden_size=3_2			,				intermediate_size=3_7			,				layer_norm_eps=1e-0_5			,				num_attention_heads=4			,				num_hidden_layers=5			,				pad_token_id=1			,				vocab_size=1_0_0_0			,				hidden_act='''gelu'''			,				projection_dim=5_1_2			,				)
												return CLIPTextModel(_a			)


							def 							__lowercase							(     self			)       ->       str:
												_a      :       List[Any]   =						'''cpu'''  # ensure determinism for the device-dependent torch.Generator
												_a      :       List[str]   =						self.dummy_cond_unet_upscale
												_a      :       int   =						DDPMScheduler()
												_a      :       int   =						DDIMScheduler(prediction_type='''v_prediction'''			)
												_a      :       List[Any]   =						self.dummy_vae
												_a      :       Tuple   =						self.dummy_text_encoder
												_a      :       Optional[int]   =						CLIPTokenizer.from_pretrained('''hf-internal-testing/tiny-random-clip'''			)

												_a      :       Tuple   =						self.dummy_image.cpu().permute(0			,				2			,				3			,				1			)[0]
												_a      :       int   =						Image.fromarray(np.uinta(_a			)			).convert('''RGB'''			).resize((6_4, 6_4)			)

												# make sure here that pndm scheduler skips prk
												_a      :       int   =						StableDiffusionUpscalePipeline(
												    unet=_a			,				low_res_scheduler=_a			,				scheduler=_a			,				vae=_a			,				text_encoder=_a			,				tokenizer=_a			,				max_noise_level=3_5_0			,				)
												_a      :       str   =						sd_pipe.to(_a			)
												sd_pipe.set_progress_bar_config(disable=_a			)

												_a      :       Union[str, Any]   =						'''A painting of a squirrel eating a burger'''
												_a      :       Any   =						torch.Generator(device=_a			).manual_seed(0			)
												_a      :       Dict   =						sd_pipe(
												    [prompt]			,				image=_a			,				generator=_a			,				guidance_scale=6.0			,				noise_level=2_0			,				num_inference_steps=2			,				output_type='''np'''			,				)

												_a      :       Optional[int]   =						output.images

												_a      :       Optional[int]   =						torch.Generator(device=_a			).manual_seed(0			)
												_a      :       Tuple   =						sd_pipe(
												    [prompt]			,				image=_a			,				generator=_a			,				guidance_scale=6.0			,				noise_level=2_0			,				num_inference_steps=2			,				output_type='''np'''			,				return_dict=_a			,				)[0]

												_a      :       Union[str, Any]   =						image[0, -3:, -3:, -1]
												_a      :       List[Any]   =						image_from_tuple[0, -3:, -3:, -1]

												_a      :       str   =						low_res_image.size[0] * 4
												assert image.shape == (1, expected_height_width, expected_height_width, 3)
												_a      :       Optional[int]   =						np.array([0.3113, 0.3910, 0.4272, 0.4859, 0.5061, 0.4652, 0.5362, 0.5715, 0.5661]			)

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


							def 							__lowercase							(     self			)       ->       List[Any]:
												_a      :       str   =						'''cpu'''  # ensure determinism for the device-dependent torch.Generator
												_a      :       Any   =						self.dummy_cond_unet_upscale
												_a      :       Dict   =						DDPMScheduler()
												_a      :       Any   =						DDIMScheduler(prediction_type='''v_prediction'''			)
												_a      :       Optional[int]   =						self.dummy_vae
												_a      :       Tuple   =						self.dummy_text_encoder
												_a      :       Union[str, Any]   =						CLIPTokenizer.from_pretrained('''hf-internal-testing/tiny-random-clip'''			)

												_a      :       Union[str, Any]   =						self.dummy_image.cpu().permute(0			,				2			,				3			,				1			)[0]
												_a      :       List[Any]   =						Image.fromarray(np.uinta(_a			)			).convert('''RGB'''			).resize((6_4, 6_4)			)

												# make sure here that pndm scheduler skips prk
												_a      :       Any   =						StableDiffusionUpscalePipeline(
												    unet=_a			,				low_res_scheduler=_a			,				scheduler=_a			,				vae=_a			,				text_encoder=_a			,				tokenizer=_a			,				max_noise_level=3_5_0			,				)
												_a      :       Tuple   =						sd_pipe.to(_a			)
												sd_pipe.set_progress_bar_config(disable=_a			)

												_a      :       Dict   =						'''A painting of a squirrel eating a burger'''
												_a      :       List[Any]   =						sd_pipe(
												    2 * [prompt]			,				image=2 * [low_res_image]			,				guidance_scale=6.0			,				noise_level=2_0			,				num_inference_steps=2			,				output_type='''np'''			,				)
												_a      :       Dict   =						output.images
												assert image.shape[0] == 2

												_a      :       Dict   =						torch.Generator(device=_a			).manual_seed(0			)
												_a      :       int   =						sd_pipe(
												    [prompt]			,				image=_a			,				generator=_a			,				num_images_per_prompt=2			,				guidance_scale=6.0			,				noise_level=2_0			,				num_inference_steps=2			,				output_type='''np'''			,				)
												_a      :       Optional[Any]   =						output.images
												assert image.shape[0] == 2




							@unittest.skipIf(torch_device != '''cuda'''			,				'''This test requires a GPU'''			)
							def 							__lowercase							(     self			)       ->       Union[str, Any]:
												_a      :       Union[str, Any]   =						self.dummy_cond_unet_upscale
												_a      :       List[Any]   =						DDPMScheduler()
												_a      :       Dict   =						DDIMScheduler(prediction_type='''v_prediction'''			)
												_a      :       Dict   =						self.dummy_vae
												_a      :       int   =						self.dummy_text_encoder
												_a      :       int   =						CLIPTokenizer.from_pretrained('''hf-internal-testing/tiny-random-clip'''			)

												_a      :       Any   =						self.dummy_image.cpu().permute(0			,				2			,				3			,				1			)[0]
												_a      :       Optional[Any]   =						Image.fromarray(np.uinta(_a			)			).convert('''RGB'''			).resize((6_4, 6_4)			)

												# put models in fp16, except vae as it overflows in fp16
												_a      :       Dict   =						unet.half()
												_a      :       Tuple   =						text_encoder.half()

												# make sure here that pndm scheduler skips prk
												_a      :       List[Any]   =						StableDiffusionUpscalePipeline(
												    unet=_a			,				low_res_scheduler=_a			,				scheduler=_a			,				vae=_a			,				text_encoder=_a			,				tokenizer=_a			,				max_noise_level=3_5_0			,				)
												_a      :       Union[str, Any]   =						sd_pipe.to(_a			)
												sd_pipe.set_progress_bar_config(disable=_a			)

												_a      :       Tuple   =						'''A painting of a squirrel eating a burger'''
												_a      :       str   =						torch.manual_seed(0			)
												_a      :       List[str]   =						sd_pipe(
												    [prompt]			,				image=_a			,				generator=_a			,				num_inference_steps=2			,				output_type='''np'''			,				).images

												_a      :       int   =						low_res_image.size[0] * 4
												assert image.shape == (1, expected_height_width, expected_height_width, 3)



@slow
@require_torch_gpu
class 							UpperCAmelCase_						(     unittest.TestCase  ):
							"""simple docstring"""







							def 							__lowercase							(     self			)       ->       Dict:
												# clean up the VRAM after each test
												super().tearDown()
												gc.collect()
												torch.cuda.empty_cache()


							def 							__lowercase							(     self			)       ->       int:
												_a      :       Tuple   =						load_image(
												    '''https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main'''
												    '''/sd2-upscale/low_res_cat.png'''			)
												_a      :       Tuple   =						load_numpy(
												    '''https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd2-upscale'''
												    '''/upsampled_cat.npy'''			)

												_a      :       List[Any]   =						'''stabilityai/stable-diffusion-x4-upscaler'''
												_a      :       Dict   =						StableDiffusionUpscalePipeline.from_pretrained(_a			)
												pipe.to(_a			)
												pipe.set_progress_bar_config(disable=_a			)
												pipe.enable_attention_slicing()

												_a      :       Optional[Any]   =						'''a cat sitting on a park bench'''

												_a      :       Dict   =						torch.manual_seed(0			)
												_a      :       Tuple   =						pipe(
												    prompt=_a			,				image=_a			,				generator=_a			,				output_type='''np'''			,				)
												_a      :       Dict   =						output.images[0]

												assert image.shape == (5_1_2, 5_1_2, 3)
												assert np.abs(expected_image - image			).max() < 1e-3


							def 							__lowercase							(     self			)       ->       List[str]:
												_a      :       Dict   =						load_image(
												    '''https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main'''
												    '''/sd2-upscale/low_res_cat.png'''			)
												_a      :       Optional[int]   =						load_numpy(
												    '''https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd2-upscale'''
												    '''/upsampled_cat_fp16.npy'''			)

												_a      :       Optional[int]   =						'''stabilityai/stable-diffusion-x4-upscaler'''
												_a      :       Union[str, Any]   =						StableDiffusionUpscalePipeline.from_pretrained(
												    _a			,				torch_dtype=torch.floataa			,				)
												pipe.to(_a			)
												pipe.set_progress_bar_config(disable=_a			)
												pipe.enable_attention_slicing()

												_a      :       Optional[int]   =						'''a cat sitting on a park bench'''

												_a      :       Optional[Any]   =						torch.manual_seed(0			)
												_a      :       str   =						pipe(
												    prompt=_a			,				image=_a			,				generator=_a			,				output_type='''np'''			,				)
												_a      :       str   =						output.images[0]

												assert image.shape == (5_1_2, 5_1_2, 3)
												assert np.abs(expected_image - image			).max() < 5e-1




							def 							__lowercase							(     self			)       ->       Optional[Any]:
												torch.cuda.empty_cache()
												torch.cuda.reset_max_memory_allocated()
												torch.cuda.reset_peak_memory_stats()

												_a      :       List[Any]   =						load_image(
												    '''https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main'''
												    '''/sd2-upscale/low_res_cat.png'''			)

												_a      :       Dict   =						'''stabilityai/stable-diffusion-x4-upscaler'''
												_a      :       str   =						StableDiffusionUpscalePipeline.from_pretrained(
												    _a			,				torch_dtype=torch.floataa			,				)
												pipe.to(_a			)
												pipe.set_progress_bar_config(disable=_a			)
												pipe.enable_attention_slicing(1			)
												pipe.enable_sequential_cpu_offload()

												_a      :       str   =						'''a cat sitting on a park bench'''

												_a      :       Optional[int]   =						torch.manual_seed(0			)
												_a      :       Optional[Any]   =						pipe(
												    prompt=_a			,				image=_a			,				generator=_a			,				num_inference_steps=5			,				output_type='''np'''			,				)

												_a      :       str   =						torch.cuda.max_memory_allocated()
												# make sure that less than 2.9 GB is allocated
												assert mem_bytes < 2.9 * 1_0**9






import argparse
import collections

import numpy as np
import torch
from flax import traverse_util
from tax import checkpoints

from transformers import MTaConfig, UMTaEncoderModel, UMTaForConditionalGeneration
from transformers.utils import logging


logging.set_verbosity_info()



def   __UpperCAmelCase					(      __a :     List[Any]						,__a :     Optional[Any]						,__a :     Optional[int]      )     ->	Dict:

					"""simple docstring"""

					return params[F"""{prefix}/{prefix}/relpos_bias/rel_embedding"""][:, i, :]



def   __UpperCAmelCase					(      __a :     List[Any]						,__a :     Optional[int]						,__a :     int						,__a :     List[str]="attention"      )     ->	List[str]:

					"""simple docstring"""

					_a      :       str   =						np.ascontiguousarray(params[F"""{prefix}/{prefix}/{layer_name}/key/kernel"""][:, i, :, :]      )
					_a      :       Tuple   =						k_tmp.reshape(k_tmp.shape[0]						,k_tmp.shape[1] * k_tmp.shape[2]      )
					_a      :       Any   =						np.ascontiguousarray(params[F"""{prefix}/{prefix}/{layer_name}/out/kernel"""][:, i, :, :]      )
					_a      :       Dict   =						o_tmp.reshape(o_tmp.shape[0] * o_tmp.shape[1]						,o_tmp.shape[2]      )
					_a      :       Union[str, Any]   =						np.ascontiguousarray(params[F"""{prefix}/{prefix}/{layer_name}/query/kernel"""][:, i, :, :]      )
					_a      :       Any   =						q_tmp.reshape(q_tmp.shape[0]						,q_tmp.shape[1] * q_tmp.shape[2]      )
					_a      :       Tuple   =						np.ascontiguousarray(params[F"""{prefix}/{prefix}/{layer_name}/value/kernel"""][:, i, :, :]      )
					_a      :       int   =						v_tmp.reshape(v_tmp.shape[0]						,v_tmp.shape[1] * v_tmp.shape[2]      )
					return k, o, q, v



def   __UpperCAmelCase					(      __a :     Union[str, Any]						,__a :     Union[str, Any]						,__a :     List[Any]						,__a :     Any=False      )     ->	Any:

					"""simple docstring"""

					if split_mlp_wi:
										_a      :       Union[str, Any]   =						params[F"""{prefix}/{prefix}/mlp/wi_0/kernel"""][:, i, :]
										_a      :       Union[str, Any]   =						params[F"""{prefix}/{prefix}/mlp/wi_1/kernel"""][:, i, :]
										_a      :       List[str]   =						(wi_a, wi_a)
					else:
										_a      :       List[str]   =						params[F"""{prefix}/{prefix}/mlp/wi/kernel"""][:, i, :]

					_a      :       Optional[int]   =						params[F"""{prefix}/{prefix}/mlp/wo/kernel"""][:, i, :]
					return wi, wo



def   __UpperCAmelCase					(      __a :     List[Any]						,__a :     Optional[Any]						,__a :     Union[str, Any]						,__a :     str      )     ->	List[str]:

					"""simple docstring"""

					return params[F"""{prefix}/{prefix}/{layer_name}/scale"""][:, i]



def   __UpperCAmelCase					(      __a :     dict						,*, __a :     int						,__a :     bool						,__a :     bool = False      )     ->	Any:

					"""simple docstring"""

					_a      :       Dict   =						traverse_util.flatten_dict(variables['''target''']      )
					_a      :       Any   =						{'''/'''.join(__a      ): v for k, v in old.items()}

					# v1.1 models have a gated GeLU with wi_0 and wi_1 instead of wi
					_a      :       Optional[int]   =						'''encoder/encoder/mlp/wi_0/kernel''' in old
					print('''Split MLP:'''						,__a      )

					_a      :       Tuple   =						collections.OrderedDict()

					# Shared embeddings.
					_a      :       Any   =						old['''token_embedder/embedding''']

					# Encoder.
					for i in range(__a      ):
										# Block i, layer 0 (Self Attention).
										_a      :       Optional[Any]   =						tax_layer_norm_lookup(__a						,__a						,'''encoder'''						,'''pre_attention_layer_norm'''      )
										_a ,   _a ,   _a ,   _a      :       List[str]   =						tax_attention_lookup(__a						,__a						,'''encoder'''						,'''attention'''      )
										_a      :       List[str]   =						layer_norm
										_a      :       Optional[Any]   =						k.T
										_a      :       str   =						o.T
										_a      :       List[Any]   =						q.T
										_a      :       Tuple   =						v.T

										# Block i, layer 1 (MLP).
										_a      :       str   =						tax_layer_norm_lookup(__a						,__a						,'''encoder'''						,'''pre_mlp_layer_norm'''      )
										_a ,   _a      :       Any   =						tax_mlp_lookup(__a						,__a						,'''encoder'''						,__a      )
										_a      :       str   =						layer_norm
										if split_mlp_wi:
															_a      :       List[Any]   =						wi[0].T
															_a      :       Any   =						wi[1].T
										else:
															_a      :       Any   =						wi.T
										_a      :       Optional[Any]   =						wo.T
										if scalable_attention:
															# convert the rel_embedding of each layer
															_a      :       Dict   =						tax_relpos_bias_lookup(
															    __a						,__a						,'''encoder'''      ).T

					_a      :       List[str]   =						old['''encoder/encoder_norm/scale''']

					if not scalable_attention:
										_a      :       List[Any]   =						tax_relpos_bias_lookup(
										    __a						,0						,'''encoder'''      ).T
										_a      :       Optional[Any]   =						tax_relpos_bias_lookup(
										    __a						,0						,'''decoder'''      ).T

					if not is_encoder_only:
										# Decoder.
										for i in range(__a      ):
															# Block i, layer 0 (Self Attention).
															_a      :       Union[str, Any]   =						tax_layer_norm_lookup(__a						,__a						,'''decoder'''						,'''pre_self_attention_layer_norm'''      )
															_a ,   _a ,   _a ,   _a      :       Optional[Any]   =						tax_attention_lookup(__a						,__a						,'''decoder'''						,'''self_attention'''      )
															_a      :       Optional[Any]   =						layer_norm
															_a      :       Dict   =						k.T
															_a      :       str   =						o.T
															_a      :       str   =						q.T
															_a      :       List[str]   =						v.T

															# Block i, layer 1 (Cross Attention).
															_a      :       Any   =						tax_layer_norm_lookup(__a						,__a						,'''decoder'''						,'''pre_cross_attention_layer_norm'''      )
															_a ,   _a ,   _a ,   _a      :       str   =						tax_attention_lookup(__a						,__a						,'''decoder'''						,'''encoder_decoder_attention'''      )
															_a      :       Optional[Any]   =						layer_norm
															_a      :       Optional[int]   =						k.T
															_a      :       Dict   =						o.T
															_a      :       str   =						q.T
															_a      :       int   =						v.T

															# Block i, layer 2 (MLP).
															_a      :       Optional[int]   =						tax_layer_norm_lookup(__a						,__a						,'''decoder'''						,'''pre_mlp_layer_norm'''      )
															_a ,   _a      :       Tuple   =						tax_mlp_lookup(__a						,__a						,'''decoder'''						,__a      )
															_a      :       Optional[Any]   =						layer_norm
															if split_mlp_wi:
																				_a      :       List[str]   =						wi[0].T
																				_a      :       List[Any]   =						wi[1].T
															else:
																				_a      :       Dict   =						wi.T
															_a      :       str   =						wo.T

															if scalable_attention:
																				# convert the rel_embedding of each layer
																				_a      :       Tuple   =						tax_relpos_bias_lookup(__a						,__a						,'''decoder'''      ).T

										_a      :       Tuple   =						old['''decoder/decoder_norm/scale''']

										# LM Head (only in v1.1 checkpoints, in v1.0 embeddings are used instead)
										if "decoder/logits_dense/kernel" in old:
															_a      :       Any   =						old['''decoder/logits_dense/kernel'''].T

					return new



def   __UpperCAmelCase					(      __a :     Dict						,__a :     bool      )     ->	Tuple:

					"""simple docstring"""

					_a      :       Tuple   =						collections.OrderedDict([(k, torch.from_numpy(v.copy()      )) for (k, v) in converted_params.items()]      )

					# Add what is missing.
					if "encoder.embed_tokens.weight" not in state_dict:
										_a      :       Any   =						state_dict['''shared.weight''']

					if not is_encoder_only:
										if "decoder.embed_tokens.weight" not in state_dict:
															_a      :       Optional[int]   =						state_dict['''shared.weight''']

										if "lm_head.weight" not in state_dict:  # For old 1.0 models.
															print('''Using shared word embeddings as lm_head.'''      )
															_a      :       str   =						state_dict['''shared.weight''']

					return state_dict



def   __UpperCAmelCase					(      __a :     List[str]						,__a :     Union[str, Any]						,__a :     Dict						,__a :     Union[str, Any]						,__a :     List[Any]      )     ->	int:

					"""simple docstring"""

					_a      :       List[str]   =						checkpoints.load_tax_checkpoint(__a      )
					_a      :       str   =						convert_tax_to_pytorch(
					    __a						,num_layers=config.num_layers						,is_encoder_only=__a						,scalable_attention=__a      )
					_a      :       str   =						make_state_dict(__a						,__a      )
					model.load_state_dict(__a						,strict=__a      )



def   __UpperCAmelCase					(      __a :     List[Any]						,__a :     Any						,__a :     Union[str, Any]						,__a :     bool = False						,__a :     bool = False						,)     ->	Optional[Any]:

					"""simple docstring"""

					_a      :       List[str]   =						MTaConfig.from_json_file(__a      )
					print(F"""Building PyTorch model from configuration: {config}"""      )
					# Non-v1.1 checkpoints could also use T5Model, but this works for all.
					# The v1.0 checkpoints will simply have an LM head that is the word embeddings.
					if is_encoder_only:
										_a      :       Any   =						UMTaEncoderModel(__a      )
					else:
										_a      :       Tuple   =						UMTaForConditionalGeneration(__a      )

					# Load weights from tf checkpoint
					load_tax_weights_in_ta(__a						,__a						,__a						,__a						,__a      )

					# Save pytorch-model
					print(F"""Save PyTorch model to {pytorch_dump_path}"""      )
					model.save_pretrained(__a      )

					# Verify that we can load the checkpoint.
					model.from_pretrained(__a      )
					print('''Done'''      )


if __name__ == "__main__":
			a__												=						argparse.ArgumentParser(description='''Converts a native T5X checkpoint into a PyTorch checkpoint.''')
			# Required parameters
			parser.add_argument(
			    '''--t5x_checkpoint_path''', default=None, type=str, required=True, help='''Path to the T5X checkpoint.'''
			)
			parser.add_argument(
			    '''--config_file''',
			    default=None,
			    type=str,
			    required=True,
			    help='''The config json file corresponding to the pre-trained T5 model.\nThis specifies the model architecture.''',
			)
			parser.add_argument(
			    '''--pytorch_dump_path''', default=None, type=str, required=True, help='''Path to the output PyTorch model.'''
			)
			parser.add_argument(
			    '''--is_encoder_only''', action='''store_true''', help='''Check if the model is encoder-decoder model''', default=False
			)
			parser.add_argument(
			    '''--scalable_attention''',
			    action='''store_true''',
			    help='''Whether the model uses scaled attention (umt5 model)''',
			    default=False,
			)
			a__												=						parser.parse_args()
			convert_tax_checkpoint_to_pytorch(
			    args.tax_checkpoint_path,
			    args.config_file,
			    args.pytorch_dump_path,
			    args.is_encoder_only,
			    args.scalable_attention,
			)



