






import argparse
import json

import torch

from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel






def    __magic_name__    (	SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE=1				)     ->    Tuple:
							if n_shave_prefix_segments >= 0:
														return ".".join(path.split('.'				)[n_shave_prefix_segments:]				)
							else:
														return ".".join(path.split('.'				)[:n_shave_prefix_segments]				)






def    __magic_name__    (	SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE=0				)     ->    str:
							_lowercase							:   Optional[Any] 							=   []
							for old_item in old_list:
														_lowercase							:   List[Any] 							=   old_item.replace('in_layers.0'     ,     'norm1'				)
														_lowercase							:   Optional[int] 							=   new_item.replace('in_layers.2'     ,     'conv1'				)

														_lowercase							:   Dict 							=   new_item.replace('out_layers.0'     ,     'norm2'				)
														_lowercase							:   Optional[Any] 							=   new_item.replace('out_layers.3'     ,     'conv2'				)

														_lowercase							:   List[str] 							=   new_item.replace('emb_layers.1'     ,     'time_emb_proj'				)
														_lowercase							:   List[str] 							=   new_item.replace('skip_connection'     ,     'conv_shortcut'				)

														_lowercase							:   List[Any] 							=   shave_segments(SCREAMING_SNAKE_CASE     ,     n_shave_prefix_segments=SCREAMING_SNAKE_CASE				)

														mapping.append({'old': old_item, 'new': new_item}				)

							return mapping






def    __magic_name__    (	SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE=0				)     ->    Optional[Any]:
							_lowercase							:   str 							=   []
							for old_item in old_list:
														_lowercase							:   List[str] 							=   old_item

														_lowercase							:   Union[str, Any] 							=   new_item.replace('norm.weight'     ,     'group_norm.weight'				)
														_lowercase							:   List[str] 							=   new_item.replace('norm.bias'     ,     'group_norm.bias'				)

														_lowercase							:   Union[str, Any] 							=   new_item.replace('proj_out.weight'     ,     'proj_attn.weight'				)
														_lowercase							:   List[Any] 							=   new_item.replace('proj_out.bias'     ,     'proj_attn.bias'				)

														_lowercase							:   List[Any] 							=   shave_segments(SCREAMING_SNAKE_CASE     ,     n_shave_prefix_segments=SCREAMING_SNAKE_CASE				)

														mapping.append({'old': old_item, 'new': new_item}				)

							return mapping






def    __magic_name__    (	SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE=None     ,     SCREAMING_SNAKE_CASE=None     ,     SCREAMING_SNAKE_CASE=None				)     ->    str:
							assert isinstance(SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE				), "Paths should be a list of dicts containing 'old' and 'new' keys."

							# Splits the attention layers into three variables.
							if attention_paths_to_split is not None:
														for path, path_map in attention_paths_to_split.items():
																					_lowercase							:   List[str] 							=   old_checkpoint[path]
																					_lowercase							:   Any 							=   old_tensor.shape[0] // 3

																					_lowercase							:   Dict 							=   (-1, channels) if len(old_tensor.shape				) == 3 else (-1)

																					_lowercase							:   str 							=   old_tensor.shape[0] // config['num_head_channels'] // 3

																					_lowercase							:   str 							=   old_tensor.reshape((num_heads, 3 * channels // num_heads) + old_tensor.shape[1:]				)
																					_lowercase							,							_lowercase							,							_lowercase							:   List[Any] 							=   old_tensor.split(channels // num_heads     ,     dim=1				)

																					_lowercase							:   List[Any] 							=   query.reshape(SCREAMING_SNAKE_CASE				)
																					_lowercase							:   List[str] 							=   key.reshape(SCREAMING_SNAKE_CASE				)
																					_lowercase							:   int 							=   value.reshape(SCREAMING_SNAKE_CASE				)

							for path in paths:
														_lowercase							:   Union[str, Any] 							=   path['new']

														# These have already been assigned
														if attention_paths_to_split is not None and new_path in attention_paths_to_split:
																					continue

														# Global renaming happens here
														_lowercase							:   List[str] 							=   new_path.replace('middle_block.0'     ,     'mid_block.resnets.0'				)
														_lowercase							:   List[str] 							=   new_path.replace('middle_block.1'     ,     'mid_block.attentions.0'				)
														_lowercase							:   Dict 							=   new_path.replace('middle_block.2'     ,     'mid_block.resnets.1'				)

														if additional_replacements is not None:
																					for replacement in additional_replacements:
																												_lowercase							:   Optional[int] 							=   new_path.replace(replacement['old']     ,     replacement['new']				)

        # proj_attn.weight has to be converted from conv 1D to linear
														if "proj_attn.weight" in new_path:
																					_lowercase							:   Optional[Any] 							=   old_checkpoint[path['old']][:, :, 0]
														else:
																					_lowercase							:   str 							=   old_checkpoint[path['old']]






def    __magic_name__    (	SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE				)     ->    str:
							_lowercase							:   str 							=   {}

							_lowercase							:   Tuple 							=   checkpoint['time_embed.0.weight']
							_lowercase							:   Optional[Any] 							=   checkpoint['time_embed.0.bias']
							_lowercase							:   List[Any] 							=   checkpoint['time_embed.2.weight']
							_lowercase							:   int 							=   checkpoint['time_embed.2.bias']

							_lowercase							:   Optional[int] 							=   checkpoint['input_blocks.0.0.weight']
							_lowercase							:   Optional[int] 							=   checkpoint['input_blocks.0.0.bias']

							_lowercase							:   Dict 							=   checkpoint['out.0.weight']
							_lowercase							:   Dict 							=   checkpoint['out.0.bias']
							_lowercase							:   Dict 							=   checkpoint['out.2.weight']
							_lowercase							:   Dict 							=   checkpoint['out.2.bias']

							# Retrieves the keys for the input blocks only
							_lowercase							:   Optional[int] 							=   len({'.'.join(layer.split('.'				)[:2]				) for layer in checkpoint if 'input_blocks' in layer}				)
							_lowercase							:   int 							=   {
							    layer_id: [key for key in checkpoint if F"""input_blocks.{layer_id}""" in key]
							    for layer_id in range(SCREAMING_SNAKE_CASE				)
							}

							# Retrieves the keys for the middle blocks only
							_lowercase							:   List[str] 							=   len({'.'.join(layer.split('.'				)[:2]				) for layer in checkpoint if 'middle_block' in layer}				)
							_lowercase							:   Optional[int] 							=   {
							    layer_id: [key for key in checkpoint if F"""middle_block.{layer_id}""" in key]
							    for layer_id in range(SCREAMING_SNAKE_CASE				)
							}

							# Retrieves the keys for the output blocks only
							_lowercase							:   List[Any] 							=   len({'.'.join(layer.split('.'				)[:2]				) for layer in checkpoint if 'output_blocks' in layer}				)
							_lowercase							:   Union[str, Any] 							=   {
							    layer_id: [key for key in checkpoint if F"""output_blocks.{layer_id}""" in key]
							    for layer_id in range(SCREAMING_SNAKE_CASE				)
							}

							for i in range(1     ,     SCREAMING_SNAKE_CASE				):
														_lowercase							:   List[Any] 							=   (i - 1) // (config['num_res_blocks'] + 1)
														_lowercase							:   List[Any] 							=   (i - 1) % (config['num_res_blocks'] + 1)

														_lowercase							:   Any 							=   [key for key in input_blocks[i] if F"""input_blocks.{i}.0""" in key]
														_lowercase							:   Tuple 							=   [key for key in input_blocks[i] if F"""input_blocks.{i}.1""" in key]

														if F"""input_blocks.{i}.0.op.weight""" in checkpoint:
																					_lowercase							:   Optional[int] 							=   checkpoint[
																					    F"""input_blocks.{i}.0.op.weight"""
																					]
																					_lowercase							:   Union[str, Any] 							=   checkpoint[
																					    F"""input_blocks.{i}.0.op.bias"""
																					]
																					continue

														_lowercase							:   List[Any] 							=   renew_resnet_paths(SCREAMING_SNAKE_CASE				)
														_lowercase							:   List[Any] 							=   {'old': F"""input_blocks.{i}.0""", 'new': F"""down_blocks.{block_id}.resnets.{layer_in_block_id}"""}
														_lowercase							:   int 							=   {'old': 'resnets.2.op', 'new': 'downsamplers.0.op'}
														assign_to_checkpoint(
														    SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE     ,     additional_replacements=[meta_path, resnet_op]     ,     config=SCREAMING_SNAKE_CASE				)

														if len(SCREAMING_SNAKE_CASE				):
																					_lowercase							:   Optional[Any] 							=   renew_attention_paths(SCREAMING_SNAKE_CASE				)
																					_lowercase							:   Dict 							=   {
																					    'old': F"""input_blocks.{i}.1""",
																					    'new': F"""down_blocks.{block_id}.attentions.{layer_in_block_id}""",
																					}
																					_lowercase							:   List[str] 							=   {
																					    F"""input_blocks.{i}.1.qkv.bias""": {
																					        'key': F"""down_blocks.{block_id}.attentions.{layer_in_block_id}.key.bias""",
																					        'query': F"""down_blocks.{block_id}.attentions.{layer_in_block_id}.query.bias""",
																					        'value': F"""down_blocks.{block_id}.attentions.{layer_in_block_id}.value.bias""",
																					    },
																					    F"""input_blocks.{i}.1.qkv.weight""": {
																					        'key': F"""down_blocks.{block_id}.attentions.{layer_in_block_id}.key.weight""",
																					        'query': F"""down_blocks.{block_id}.attentions.{layer_in_block_id}.query.weight""",
																					        'value': F"""down_blocks.{block_id}.attentions.{layer_in_block_id}.value.weight""",
																					    },
																					}
																					assign_to_checkpoint(
																					    SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE     ,     additional_replacements=[meta_path]     ,     attention_paths_to_split=SCREAMING_SNAKE_CASE     ,     config=SCREAMING_SNAKE_CASE     ,     )

							_lowercase							:   Any 							=   middle_blocks[0]
							_lowercase							:   int 							=   middle_blocks[1]
							_lowercase							:   List[str] 							=   middle_blocks[2]

							_lowercase							:   List[Any] 							=   renew_resnet_paths(SCREAMING_SNAKE_CASE				)
							assign_to_checkpoint(SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE     ,     config=SCREAMING_SNAKE_CASE				)

							_lowercase							:   Optional[Any] 							=   renew_resnet_paths(SCREAMING_SNAKE_CASE				)
							assign_to_checkpoint(SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE     ,     config=SCREAMING_SNAKE_CASE				)

							_lowercase							:   List[Any] 							=   renew_attention_paths(SCREAMING_SNAKE_CASE				)
							_lowercase							:   List[str] 							=   {
							    'middle_block.1.qkv.bias': {
							        'key': 'mid_block.attentions.0.key.bias',
							        'query': 'mid_block.attentions.0.query.bias',
							        'value': 'mid_block.attentions.0.value.bias',
							    },
							    'middle_block.1.qkv.weight': {
							        'key': 'mid_block.attentions.0.key.weight',
							        'query': 'mid_block.attentions.0.query.weight',
							        'value': 'mid_block.attentions.0.value.weight',
							    },
							}
							assign_to_checkpoint(
							    SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE     ,     attention_paths_to_split=SCREAMING_SNAKE_CASE     ,     config=SCREAMING_SNAKE_CASE				)

							for i in range(SCREAMING_SNAKE_CASE				):
														_lowercase							:   List[Any] 							=   i // (config['num_res_blocks'] + 1)
														_lowercase							:   int 							=   i % (config['num_res_blocks'] + 1)
														_lowercase							:   List[str] 							=   [shave_segments(SCREAMING_SNAKE_CASE     ,     2				) for name in output_blocks[i]]
														_lowercase							:   int 							=   {}

														for layer in output_block_layers:
																					_lowercase							,							_lowercase							:   str 							=   layer.split('.'				)[0], shave_segments(SCREAMING_SNAKE_CASE     ,     1				)
																					if layer_id in output_block_list:
																												output_block_list[layer_id].append(SCREAMING_SNAKE_CASE				)
																					else:
																												_lowercase							:   int 							=   [layer_name]

														if len(SCREAMING_SNAKE_CASE				) > 1:
																					_lowercase							:   Any 							=   [key for key in output_blocks[i] if F"""output_blocks.{i}.0""" in key]
																					_lowercase							:   Any 							=   [key for key in output_blocks[i] if F"""output_blocks.{i}.1""" in key]

																					_lowercase							:   Union[str, Any] 							=   renew_resnet_paths(SCREAMING_SNAKE_CASE				)
																					_lowercase							:   Dict 							=   renew_resnet_paths(SCREAMING_SNAKE_CASE				)

																					_lowercase							:   Optional[int] 							=   {'old': F"""output_blocks.{i}.0""", 'new': F"""up_blocks.{block_id}.resnets.{layer_in_block_id}"""}
																					assign_to_checkpoint(SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE     ,     additional_replacements=[meta_path]     ,     config=SCREAMING_SNAKE_CASE				)

																					if ["conv.weight", "conv.bias"] in output_block_list.values():
																												_lowercase							:   List[Any] 							=   list(output_block_list.values()				).index(['conv.weight', 'conv.bias']				)
																												_lowercase							:   Tuple 							=   checkpoint[
																												    F"""output_blocks.{i}.{index}.conv.weight"""
																												]
																												_lowercase							:   Union[str, Any] 							=   checkpoint[
																												    F"""output_blocks.{i}.{index}.conv.bias"""
																												]

																												# Clear attentions as they have been attributed above.
																												if len(SCREAMING_SNAKE_CASE				) == 2:
																																			_lowercase							:   Union[str, Any] 							=   []

																					if len(SCREAMING_SNAKE_CASE				):
																												_lowercase							:   str 							=   renew_attention_paths(SCREAMING_SNAKE_CASE				)
																												_lowercase							:   int 							=   {
																												    'old': F"""output_blocks.{i}.1""",
																												    'new': F"""up_blocks.{block_id}.attentions.{layer_in_block_id}""",
																												}
																												_lowercase							:   Optional[int] 							=   {
																												    F"""output_blocks.{i}.1.qkv.bias""": {
																												        'key': F"""up_blocks.{block_id}.attentions.{layer_in_block_id}.key.bias""",
																												        'query': F"""up_blocks.{block_id}.attentions.{layer_in_block_id}.query.bias""",
																												        'value': F"""up_blocks.{block_id}.attentions.{layer_in_block_id}.value.bias""",
																												    },
																												    F"""output_blocks.{i}.1.qkv.weight""": {
																												        'key': F"""up_blocks.{block_id}.attentions.{layer_in_block_id}.key.weight""",
																												        'query': F"""up_blocks.{block_id}.attentions.{layer_in_block_id}.query.weight""",
																												        'value': F"""up_blocks.{block_id}.attentions.{layer_in_block_id}.value.weight""",
																												    },
																												}
																												assign_to_checkpoint(
																												    SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE     ,     SCREAMING_SNAKE_CASE     ,     additional_replacements=[meta_path]     ,     attention_paths_to_split=to_split if any('qkv' in key for key in attentions				) else None     ,     config=SCREAMING_SNAKE_CASE     ,     )
														else:
																					_lowercase							:   Optional[int] 							=   renew_resnet_paths(SCREAMING_SNAKE_CASE     ,     n_shave_prefix_segments=1				)
																					for path in resnet_0_paths:
																												_lowercase							:   List[Any] 							=   '.'.join(['output_blocks', str(SCREAMING_SNAKE_CASE				), path['old']]				)
																												_lowercase							:   int 							=   '.'.join(['up_blocks', str(SCREAMING_SNAKE_CASE				), 'resnets', str(SCREAMING_SNAKE_CASE				), path['new']]				)

																												_lowercase							:   Optional[Any] 							=   checkpoint[old_path]

							return new_checkpoint


if __name__ == "__main__":
							UpperCamelCase								=		argparse.ArgumentParser()

							parser.add_argument(
							    "--checkpoint_path", default=None, type=str, required=True, help="Path to the checkpoint to convert."
							)

							parser.add_argument(
							    "--config_file",
							    default=None,
							    type=str,
							    required=True,
							    help="The config json file corresponding to the architecture.",
							)

							parser.add_argument("--dump_path", default=None, type=str, required=True, help="Path to the output model.")

							UpperCamelCase								=		parser.parse_args()

							UpperCamelCase								=		torch.load(args.checkpoint_path)

							with open(args.config_file) as f:
														UpperCamelCase								=		json.loads(f.read())

							UpperCamelCase								=		convert_ldm_checkpoint(checkpoint, config)

							if "ldm" in config:
														del config["ldm"]

							UpperCamelCase								=		UNetaDModel(**config)
							model.load_state_dict(converted_checkpoint)

							try:
														UpperCamelCase								=		DDPMScheduler.from_config("/".join(args.checkpoint_path.split("/")[:-1]))
														UpperCamelCase								=		VQModel.from_pretrained("/".join(args.checkpoint_path.split("/")[:-1]))

														UpperCamelCase								=		LDMPipeline(unet=model, scheduler=scheduler, vae=vqvae)
														pipe.save_pretrained(args.dump_path)
							except:  # noqa: E722
														model.save_pretrained(args.dump_path)











'''simple docstring'''




from ..utils import DummyObject, requires_backends




class      UpperCamelCase__					(					metaclass=lowercase_			):




					"""simple docstring"""
					SCREAMING_SNAKE_CASE__				=	['''flax''']


					def __init__(						self				:			Optional[int]      ,						*lowerCamelCase_				:			Any      ,						**lowerCamelCase_				:			Dict						):

							'''simple docstring'''



							requires_backends(self      ,						["""flax"""]						)


					@classmethod
					def lowerCamelCase_			(						cls				:			Optional[int]      ,						*lowerCamelCase_				:			List[Any]      ,						**lowerCamelCase_				:			str						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)



					@classmethod
					def lowerCamelCase_			(						cls				:			int      ,						*lowerCamelCase_				:			Union[str, Any]      ,						**lowerCamelCase_				:			int						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)







class      UpperCamelCase__					(					metaclass=lowercase_			):




					"""simple docstring"""
					SCREAMING_SNAKE_CASE__				=	['''flax''']


					def __init__(						self				:			List[str]      ,						*lowerCamelCase_				:			Union[str, Any]      ,						**lowerCamelCase_				:			str						):

							'''simple docstring'''



							requires_backends(self      ,						["""flax"""]						)


					@classmethod
					def lowerCamelCase_			(						cls				:			Dict      ,						*lowerCamelCase_				:			Optional[Any]      ,						**lowerCamelCase_				:			Union[str, Any]						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)



					@classmethod
					def lowerCamelCase_			(						cls				:			List[Any]      ,						*lowerCamelCase_				:			Dict      ,						**lowerCamelCase_				:			Dict						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)







class      UpperCamelCase__					(					metaclass=lowercase_			):




					"""simple docstring"""
					SCREAMING_SNAKE_CASE__				=	['''flax''']


					def __init__(						self				:			Optional[Any]      ,						*lowerCamelCase_				:			Optional[int]      ,						**lowerCamelCase_				:			Union[str, Any]						):

							'''simple docstring'''



							requires_backends(self      ,						["""flax"""]						)


					@classmethod
					def lowerCamelCase_			(						cls				:			str      ,						*lowerCamelCase_				:			int      ,						**lowerCamelCase_				:			Dict						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)



					@classmethod
					def lowerCamelCase_			(						cls				:			Optional[Any]      ,						*lowerCamelCase_				:			str      ,						**lowerCamelCase_				:			List[Any]						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)







class      UpperCamelCase__					(					metaclass=lowercase_			):




					"""simple docstring"""
					SCREAMING_SNAKE_CASE__				=	['''flax''']


					def __init__(						self				:			List[Any]      ,						*lowerCamelCase_				:			Tuple      ,						**lowerCamelCase_				:			int						):

							'''simple docstring'''



							requires_backends(self      ,						["""flax"""]						)


					@classmethod
					def lowerCamelCase_			(						cls				:			int      ,						*lowerCamelCase_				:			Dict      ,						**lowerCamelCase_				:			Tuple						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)



					@classmethod
					def lowerCamelCase_			(						cls				:			Any      ,						*lowerCamelCase_				:			str      ,						**lowerCamelCase_				:			Optional[Any]						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)







class      UpperCamelCase__					(					metaclass=lowercase_			):




					"""simple docstring"""
					SCREAMING_SNAKE_CASE__				=	['''flax''']


					def __init__(						self				:			List[str]      ,						*lowerCamelCase_				:			Dict      ,						**lowerCamelCase_				:			int						):

							'''simple docstring'''



							requires_backends(self      ,						["""flax"""]						)


					@classmethod
					def lowerCamelCase_			(						cls				:			Any      ,						*lowerCamelCase_				:			Any      ,						**lowerCamelCase_				:			Any						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)



					@classmethod
					def lowerCamelCase_			(						cls				:			Any      ,						*lowerCamelCase_				:			Optional[int]      ,						**lowerCamelCase_				:			str						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)







class      UpperCamelCase__					(					metaclass=lowercase_			):




					"""simple docstring"""
					SCREAMING_SNAKE_CASE__				=	['''flax''']


					def __init__(						self				:			Any      ,						*lowerCamelCase_				:			List[Any]      ,						**lowerCamelCase_				:			Any						):

							'''simple docstring'''



							requires_backends(self      ,						["""flax"""]						)


					@classmethod
					def lowerCamelCase_			(						cls				:			Union[str, Any]      ,						*lowerCamelCase_				:			Union[str, Any]      ,						**lowerCamelCase_				:			Union[str, Any]						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)



					@classmethod
					def lowerCamelCase_			(						cls				:			List[Any]      ,						*lowerCamelCase_				:			str      ,						**lowerCamelCase_				:			Optional[int]						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)







class      UpperCamelCase__					(					metaclass=lowercase_			):




					"""simple docstring"""
					SCREAMING_SNAKE_CASE__				=	['''flax''']


					def __init__(						self				:			Dict      ,						*lowerCamelCase_				:			Optional[Any]      ,						**lowerCamelCase_				:			int						):

							'''simple docstring'''



							requires_backends(self      ,						["""flax"""]						)


					@classmethod
					def lowerCamelCase_			(						cls				:			int      ,						*lowerCamelCase_				:			Tuple      ,						**lowerCamelCase_				:			Dict						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)



					@classmethod
					def lowerCamelCase_			(						cls				:			Tuple      ,						*lowerCamelCase_				:			int      ,						**lowerCamelCase_				:			Union[str, Any]						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)







class      UpperCamelCase__					(					metaclass=lowercase_			):




					"""simple docstring"""
					SCREAMING_SNAKE_CASE__				=	['''flax''']


					def __init__(						self				:			Optional[Any]      ,						*lowerCamelCase_				:			Dict      ,						**lowerCamelCase_				:			List[Any]						):

							'''simple docstring'''



							requires_backends(self      ,						["""flax"""]						)


					@classmethod
					def lowerCamelCase_			(						cls				:			List[Any]      ,						*lowerCamelCase_				:			Optional[Any]      ,						**lowerCamelCase_				:			List[str]						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)



					@classmethod
					def lowerCamelCase_			(						cls				:			List[str]      ,						*lowerCamelCase_				:			Tuple      ,						**lowerCamelCase_				:			Tuple						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)







class      UpperCamelCase__					(					metaclass=lowercase_			):




					"""simple docstring"""
					SCREAMING_SNAKE_CASE__				=	['''flax''']


					def __init__(						self				:			Dict      ,						*lowerCamelCase_				:			int      ,						**lowerCamelCase_				:			Any						):

							'''simple docstring'''



							requires_backends(self      ,						["""flax"""]						)


					@classmethod
					def lowerCamelCase_			(						cls				:			int      ,						*lowerCamelCase_				:			int      ,						**lowerCamelCase_				:			Any						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)



					@classmethod
					def lowerCamelCase_			(						cls				:			List[Any]      ,						*lowerCamelCase_				:			Tuple      ,						**lowerCamelCase_				:			Tuple						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)







class      UpperCamelCase__					(					metaclass=lowercase_			):




					"""simple docstring"""
					SCREAMING_SNAKE_CASE__				=	['''flax''']


					def __init__(						self				:			int      ,						*lowerCamelCase_				:			Tuple      ,						**lowerCamelCase_				:			Any						):

							'''simple docstring'''



							requires_backends(self      ,						["""flax"""]						)


					@classmethod
					def lowerCamelCase_			(						cls				:			List[Any]      ,						*lowerCamelCase_				:			Tuple      ,						**lowerCamelCase_				:			Optional[Any]						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)



					@classmethod
					def lowerCamelCase_			(						cls				:			List[Any]      ,						*lowerCamelCase_				:			Optional[int]      ,						**lowerCamelCase_				:			Any						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)







class      UpperCamelCase__					(					metaclass=lowercase_			):




					"""simple docstring"""
					SCREAMING_SNAKE_CASE__				=	['''flax''']


					def __init__(						self				:			List[Any]      ,						*lowerCamelCase_				:			List[Any]      ,						**lowerCamelCase_				:			List[Any]						):

							'''simple docstring'''



							requires_backends(self      ,						["""flax"""]						)


					@classmethod
					def lowerCamelCase_			(						cls				:			List[Any]      ,						*lowerCamelCase_				:			Optional[Any]      ,						**lowerCamelCase_				:			Optional[int]						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)



					@classmethod
					def lowerCamelCase_			(						cls				:			Any      ,						*lowerCamelCase_				:			Dict      ,						**lowerCamelCase_				:			Optional[int]						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)







class      UpperCamelCase__					(					metaclass=lowercase_			):




					"""simple docstring"""
					SCREAMING_SNAKE_CASE__				=	['''flax''']


					def __init__(						self				:			Any      ,						*lowerCamelCase_				:			Dict      ,						**lowerCamelCase_				:			int						):

							'''simple docstring'''



							requires_backends(self      ,						["""flax"""]						)


					@classmethod
					def lowerCamelCase_			(						cls				:			List[Any]      ,						*lowerCamelCase_				:			Union[str, Any]      ,						**lowerCamelCase_				:			List[str]						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)



					@classmethod
					def lowerCamelCase_			(						cls				:			Optional[Any]      ,						*lowerCamelCase_				:			Dict      ,						**lowerCamelCase_				:			Optional[Any]						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)







class      UpperCamelCase__					(					metaclass=lowercase_			):




					"""simple docstring"""
					SCREAMING_SNAKE_CASE__				=	['''flax''']


					def __init__(						self				:			Tuple      ,						*lowerCamelCase_				:			Tuple      ,						**lowerCamelCase_				:			Union[str, Any]						):

							'''simple docstring'''



							requires_backends(self      ,						["""flax"""]						)


					@classmethod
					def lowerCamelCase_			(						cls				:			Optional[Any]      ,						*lowerCamelCase_				:			Any      ,						**lowerCamelCase_				:			Optional[int]						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)



					@classmethod
					def lowerCamelCase_			(						cls				:			List[Any]      ,						*lowerCamelCase_				:			Any      ,						**lowerCamelCase_				:			Tuple						):

							'''simple docstring'''



							requires_backends(cls      ,						["""flax"""]						)



