


'''simple docstring'''



import argparse
import json

import torch

from diffusers import AutoencoderKL, DDPMPipeline, DDPMScheduler, UNetaDModel, VQModel






def 						lowerCamelCase							(_SCREAMING_SNAKE_CASE   :     List[Any]		,   _SCREAMING_SNAKE_CASE   :     Union[str, Any]=1     ):
					if n_shave_prefix_segments >= 0:
										return ".".join(path.split('.'     )[n_shave_prefix_segments:]     )
					else:
										return ".".join(path.split('.'     )[:n_shave_prefix_segments]     )






def 						lowerCamelCase							(_SCREAMING_SNAKE_CASE   :     List[str]		,   _SCREAMING_SNAKE_CASE   :     List[str]=0     ):
					__a    : int      					=						[]
					for old_item in old_list:
										__a    : Dict      					=						old_item
										__a    : Optional[Any]      					=						new_item.replace('block.'		,   'resnets.'     )
										__a    : str      					=						new_item.replace('conv_shorcut'		,   'conv1'     )
										__a    : List[str]      					=						new_item.replace('in_shortcut'		,   'conv_shortcut'     )
										__a    : str      					=						new_item.replace('temb_proj'		,   'time_emb_proj'     )

										__a    : Dict      					=						shave_segments(_SCREAMING_SNAKE_CASE		,   n_shave_prefix_segments=_SCREAMING_SNAKE_CASE     )

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

					return mapping






def 						lowerCamelCase							(_SCREAMING_SNAKE_CASE   :     List[str]		,   _SCREAMING_SNAKE_CASE   :     Union[str, Any]=0		,   _SCREAMING_SNAKE_CASE   :     Optional[int]=False     ):
					__a    : List[str]      					=						[]
					for old_item in old_list:
										__a    : Optional[int]      					=						old_item

										# In `model.mid`, the layer is called `attn`.
										if not in_mid:
															__a    : Union[str, Any]      					=						new_item.replace('attn'		,   'attentions'     )
										__a    : int      					=						new_item.replace('.k.'		,   '.key.'     )
										__a    : Optional[Any]      					=						new_item.replace('.v.'		,   '.value.'     )
										__a    : int      					=						new_item.replace('.q.'		,   '.query.'     )

										__a    : Optional[Any]      					=						new_item.replace('proj_out'		,   'proj_attn'     )
										__a    : List[Any]      					=						new_item.replace('norm'		,   'group_norm'     )

										__a    : str      					=						shave_segments(_SCREAMING_SNAKE_CASE		,   n_shave_prefix_segments=_SCREAMING_SNAKE_CASE     )
										mapping.append({'old': old_item, 'new': new_item}     )

					return mapping






def 						lowerCamelCase							(_SCREAMING_SNAKE_CASE   :     int		,   _SCREAMING_SNAKE_CASE   :     List[Any]		,   _SCREAMING_SNAKE_CASE   :     str		,   _SCREAMING_SNAKE_CASE   :     int=None		,   _SCREAMING_SNAKE_CASE   :     Tuple=None		,   _SCREAMING_SNAKE_CASE   :     str=None     ):
					assert isinstance(_SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE     ), "Paths should be a list of dicts containing 'old' and 'new' keys."

					if attention_paths_to_split is not None:
										if config is None:
															raise ValueError('Please specify the config if setting \'attention_paths_to_split\' to \'True\'.'     )

										for path, path_map in attention_paths_to_split.items():
															__a    : Optional[int]      					=						old_checkpoint[path]
															__a    : str      					=						old_tensor.shape[0] // 3

															__a    : Tuple      					=						(-1, channels) if len(old_tensor.shape     ) == 3 else (-1)

															__a    : Optional[Any]      					=						old_tensor.shape[0] // config.get('num_head_channels'		,   1     ) // 3

															__a    : Optional[Any]      					=						old_tensor.reshape((num_heads, 3 * channels // num_heads) + old_tensor.shape[1:]     )
															__a					,       __a					,       __a    : Dict      					=						old_tensor.split(channels // num_heads		,   dim=1     )

															__a    : List[str]      					=						query.reshape(_SCREAMING_SNAKE_CASE     ).squeeze()
															__a    : List[Any]      					=						key.reshape(_SCREAMING_SNAKE_CASE     ).squeeze()
															__a    : Optional[Any]      					=						value.reshape(_SCREAMING_SNAKE_CASE     ).squeeze()

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

										if attention_paths_to_split is not None and new_path in attention_paths_to_split:
															continue

										__a    : Optional[Any]      					=						new_path.replace('down.'		,   'down_blocks.'     )
										__a    : Tuple      					=						new_path.replace('up.'		,   'up_blocks.'     )

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

										if "attentions" in new_path:
															__a    : List[Any]      					=						old_checkpoint[path['old']].squeeze()
										else:
															__a    : Tuple      					=						old_checkpoint[path['old']]






def 						lowerCamelCase							(_SCREAMING_SNAKE_CASE   :     List[str]		,   _SCREAMING_SNAKE_CASE   :     str     ):
					__a    : Optional[Any]      					=						{}

					__a    : List[str]      					=						checkpoint['temb.dense.0.weight']
					__a    : Optional[Any]      					=						checkpoint['temb.dense.0.bias']
					__a    : List[Any]      					=						checkpoint['temb.dense.1.weight']
					__a    : Any      					=						checkpoint['temb.dense.1.bias']

					__a    : Optional[int]      					=						checkpoint['norm_out.weight']
					__a    : List[str]      					=						checkpoint['norm_out.bias']

					__a    : List[str]      					=						checkpoint['conv_in.weight']
					__a    : Dict      					=						checkpoint['conv_in.bias']
					__a    : Tuple      					=						checkpoint['conv_out.weight']
					__a    : List[Any]      					=						checkpoint['conv_out.bias']

					__a    : Dict      					=						len({'.'.join(layer.split('.'     )[:2]     ) for layer in checkpoint if 'down' in layer}     )
					__a    : Union[str, Any]      					=						{
					    layer_id: [key for key in checkpoint if F"""down.{layer_id}""" in key] for layer_id in range(_SCREAMING_SNAKE_CASE     )
					}

					__a    : List[Any]      					=						len({'.'.join(layer.split('.'     )[:2]     ) for layer in checkpoint if 'up' in layer}     )
					__a    : Optional[Any]      					=						{layer_id: [key for key in checkpoint if F"""up.{layer_id}""" in key] for layer_id in range(_SCREAMING_SNAKE_CASE     )}

					for i in range(_SCREAMING_SNAKE_CASE     ):
										__a    : int      					=						(i - 1) // (config['layers_per_block'] + 1)

										if any('downsample' in layer for layer in down_blocks[i]     ):
															__a    : Any      					=						checkpoint[
															    F"""down.{i}.downsample.op.weight"""
															]
															__a    : Optional[int]      					=						checkpoint[F"""down.{i}.downsample.op.bias"""]
										#            new_checkpoint[f'down_blocks.{i}.downsamplers.0.op.weight'] = checkpoint[f'down.{i}.downsample.conv.weight']
										#            new_checkpoint[f'down_blocks.{i}.downsamplers.0.op.bias'] = checkpoint[f'down.{i}.downsample.conv.bias']

										if any('block' in layer for layer in down_blocks[i]     ):
															__a    : List[str]      					=						len(
															    {'.'.join(shave_segments(_SCREAMING_SNAKE_CASE		,   2     ).split('.'     )[:2]     ) for layer in down_blocks[i] if 'block' in layer}     )
															__a    : Dict      					=						{
															    layer_id: [key for key in down_blocks[i] if F"""block.{layer_id}""" in key]
															    for layer_id in range(_SCREAMING_SNAKE_CASE     )
															}

															if num_blocks > 0:
																				for j in range(config['layers_per_block']     ):
																									__a    : Optional[int]      					=						renew_resnet_paths(blocks[j]     )
																									assign_to_checkpoint(_SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE     )

										if any('attn' in layer for layer in down_blocks[i]     ):
															__a    : Tuple      					=						len(
															    {'.'.join(shave_segments(_SCREAMING_SNAKE_CASE		,   2     ).split('.'     )[:2]     ) for layer in down_blocks[i] if 'attn' in layer}     )
															__a    : List[Any]      					=						{
															    layer_id: [key for key in down_blocks[i] if F"""attn.{layer_id}""" in key]
															    for layer_id in range(_SCREAMING_SNAKE_CASE     )
															}

															if num_attn > 0:
																				for j in range(config['layers_per_block']     ):
																									__a    : Tuple      					=						renew_attention_paths(attns[j]     )
																									assign_to_checkpoint(_SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   config=_SCREAMING_SNAKE_CASE     )

					__a    : str      					=						[key for key in checkpoint if 'mid.block_1' in key]
					__a    : Optional[int]      					=						[key for key in checkpoint if 'mid.block_2' in key]
					__a    : List[Any]      					=						[key for key in checkpoint if 'mid.attn_1' in key]

					# Mid new 2
					__a    : str      					=						renew_resnet_paths(_SCREAMING_SNAKE_CASE     )
					assign_to_checkpoint(
					    _SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   additional_replacements=[{'old': 'mid.', 'new': 'mid_new_2.'}, {'old': 'block_1', 'new': 'resnets.0'}]		,   )

					__a    : str      					=						renew_resnet_paths(_SCREAMING_SNAKE_CASE     )
					assign_to_checkpoint(
					    _SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   additional_replacements=[{'old': 'mid.', 'new': 'mid_new_2.'}, {'old': 'block_2', 'new': 'resnets.1'}]		,   )

					__a    : Optional[int]      					=						renew_attention_paths(_SCREAMING_SNAKE_CASE		,   in_mid=_SCREAMING_SNAKE_CASE     )
					assign_to_checkpoint(
					    _SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   additional_replacements=[{'old': 'mid.', 'new': 'mid_new_2.'}, {'old': 'attn_1', 'new': 'attentions.0'}]		,   )

					for i in range(_SCREAMING_SNAKE_CASE     ):
										__a    : Dict      					=						num_up_blocks - 1 - i

										if any('upsample' in layer for layer in up_blocks[i]     ):
															__a    : str      					=						checkpoint[
															    F"""up.{i}.upsample.conv.weight"""
															]
															__a    : Optional[int]      					=						checkpoint[F"""up.{i}.upsample.conv.bias"""]

										if any('block' in layer for layer in up_blocks[i]     ):
															__a    : Optional[Any]      					=						len(
															    {'.'.join(shave_segments(_SCREAMING_SNAKE_CASE		,   2     ).split('.'     )[:2]     ) for layer in up_blocks[i] if 'block' in layer}     )
															__a    : str      					=						{
															    layer_id: [key for key in up_blocks[i] if F"""block.{layer_id}""" in key] for layer_id in range(_SCREAMING_SNAKE_CASE     )
															}

															if num_blocks > 0:
																				for j in range(config['layers_per_block'] + 1     ):
																									__a    : List[str]      					=						{'old': F"""up_blocks.{i}""", 'new': F"""up_blocks.{block_id}"""}
																									__a    : List[Any]      					=						renew_resnet_paths(blocks[j]     )
																									assign_to_checkpoint(_SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   additional_replacements=[replace_indices]     )

										if any('attn' in layer for layer in up_blocks[i]     ):
															__a    : Union[str, Any]      					=						len(
															    {'.'.join(shave_segments(_SCREAMING_SNAKE_CASE		,   2     ).split('.'     )[:2]     ) for layer in up_blocks[i] if 'attn' in layer}     )
															__a    : int      					=						{
															    layer_id: [key for key in up_blocks[i] if F"""attn.{layer_id}""" in key] for layer_id in range(_SCREAMING_SNAKE_CASE     )
															}

															if num_attn > 0:
																				for j in range(config['layers_per_block'] + 1     ):
																									__a    : int      					=						{'old': F"""up_blocks.{i}""", 'new': F"""up_blocks.{block_id}"""}
																									__a    : Optional[int]      					=						renew_attention_paths(attns[j]     )
																									assign_to_checkpoint(_SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   additional_replacements=[replace_indices]     )

					__a    : str      					=						{k.replace('mid_new_2'		,   'mid_block'     ): v for k, v in new_checkpoint.items()}
					return new_checkpoint






def 						lowerCamelCase							(_SCREAMING_SNAKE_CASE   :     Union[str, Any]		,   _SCREAMING_SNAKE_CASE   :     List[Any]     ):
					__a    : Tuple      					=						{}

					__a    : str      					=						checkpoint['encoder.norm_out.weight']
					__a    : Optional[Any]      					=						checkpoint['encoder.norm_out.bias']

					__a    : Tuple      					=						checkpoint['encoder.conv_in.weight']
					__a    : Dict      					=						checkpoint['encoder.conv_in.bias']
					__a    : Optional[Any]      					=						checkpoint['encoder.conv_out.weight']
					__a    : Optional[Any]      					=						checkpoint['encoder.conv_out.bias']

					__a    : List[str]      					=						checkpoint['decoder.norm_out.weight']
					__a    : str      					=						checkpoint['decoder.norm_out.bias']

					__a    : int      					=						checkpoint['decoder.conv_in.weight']
					__a    : Optional[int]      					=						checkpoint['decoder.conv_in.bias']
					__a    : Union[str, Any]      					=						checkpoint['decoder.conv_out.weight']
					__a    : List[str]      					=						checkpoint['decoder.conv_out.bias']

					__a    : Optional[Any]      					=						len({'.'.join(layer.split('.'     )[:3]     ) for layer in checkpoint if 'down' in layer}     )
					__a    : Any      					=						{
					    layer_id: [key for key in checkpoint if F"""down.{layer_id}""" in key] for layer_id in range(_SCREAMING_SNAKE_CASE     )
					}

					__a    : Dict      					=						len({'.'.join(layer.split('.'     )[:3]     ) for layer in checkpoint if 'up' in layer}     )
					__a    : int      					=						{layer_id: [key for key in checkpoint if F"""up.{layer_id}""" in key] for layer_id in range(_SCREAMING_SNAKE_CASE     )}

					for i in range(_SCREAMING_SNAKE_CASE     ):
										__a    : Any      					=						(i - 1) // (config['layers_per_block'] + 1)

										if any('downsample' in layer for layer in down_blocks[i]     ):
															__a    : Optional[int]      					=						checkpoint[
															    F"""encoder.down.{i}.downsample.conv.weight"""
															]
															__a    : Union[str, Any]      					=						checkpoint[
															    F"""encoder.down.{i}.downsample.conv.bias"""
															]

										if any('block' in layer for layer in down_blocks[i]     ):
															__a    : Optional[Any]      					=						len(
															    {'.'.join(shave_segments(_SCREAMING_SNAKE_CASE		,   3     ).split('.'     )[:3]     ) for layer in down_blocks[i] if 'block' in layer}     )
															__a    : Union[str, Any]      					=						{
															    layer_id: [key for key in down_blocks[i] if F"""block.{layer_id}""" in key]
															    for layer_id in range(_SCREAMING_SNAKE_CASE     )
															}

															if num_blocks > 0:
																				for j in range(config['layers_per_block']     ):
																									__a    : Dict      					=						renew_resnet_paths(blocks[j]     )
																									assign_to_checkpoint(_SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE     )

										if any('attn' in layer for layer in down_blocks[i]     ):
															__a    : int      					=						len(
															    {'.'.join(shave_segments(_SCREAMING_SNAKE_CASE		,   3     ).split('.'     )[:3]     ) for layer in down_blocks[i] if 'attn' in layer}     )
															__a    : Tuple      					=						{
															    layer_id: [key for key in down_blocks[i] if F"""attn.{layer_id}""" in key]
															    for layer_id in range(_SCREAMING_SNAKE_CASE     )
															}

															if num_attn > 0:
																				for j in range(config['layers_per_block']     ):
																									__a    : int      					=						renew_attention_paths(attns[j]     )
																									assign_to_checkpoint(_SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   config=_SCREAMING_SNAKE_CASE     )

					__a    : int      					=						[key for key in checkpoint if 'mid.block_1' in key]
					__a    : Tuple      					=						[key for key in checkpoint if 'mid.block_2' in key]
					__a    : Tuple      					=						[key for key in checkpoint if 'mid.attn_1' in key]

					# Mid new 2
					__a    : Optional[int]      					=						renew_resnet_paths(_SCREAMING_SNAKE_CASE     )
					assign_to_checkpoint(
					    _SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   additional_replacements=[{'old': 'mid.', 'new': 'mid_new_2.'}, {'old': 'block_1', 'new': 'resnets.0'}]		,   )

					__a    : Any      					=						renew_resnet_paths(_SCREAMING_SNAKE_CASE     )
					assign_to_checkpoint(
					    _SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   additional_replacements=[{'old': 'mid.', 'new': 'mid_new_2.'}, {'old': 'block_2', 'new': 'resnets.1'}]		,   )

					__a    : Tuple      					=						renew_attention_paths(_SCREAMING_SNAKE_CASE		,   in_mid=_SCREAMING_SNAKE_CASE     )
					assign_to_checkpoint(
					    _SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   additional_replacements=[{'old': 'mid.', 'new': 'mid_new_2.'}, {'old': 'attn_1', 'new': 'attentions.0'}]		,   )

					for i in range(_SCREAMING_SNAKE_CASE     ):
										__a    : Dict      					=						num_up_blocks - 1 - i

										if any('upsample' in layer for layer in up_blocks[i]     ):
															__a    : Any      					=						checkpoint[
															    F"""decoder.up.{i}.upsample.conv.weight"""
															]
															__a    : Any      					=						checkpoint[
															    F"""decoder.up.{i}.upsample.conv.bias"""
															]

										if any('block' in layer for layer in up_blocks[i]     ):
															__a    : Optional[int]      					=						len(
															    {'.'.join(shave_segments(_SCREAMING_SNAKE_CASE		,   3     ).split('.'     )[:3]     ) for layer in up_blocks[i] if 'block' in layer}     )
															__a    : Tuple      					=						{
															    layer_id: [key for key in up_blocks[i] if F"""block.{layer_id}""" in key] for layer_id in range(_SCREAMING_SNAKE_CASE     )
															}

															if num_blocks > 0:
																				for j in range(config['layers_per_block'] + 1     ):
																									__a    : List[Any]      					=						{'old': F"""up_blocks.{i}""", 'new': F"""up_blocks.{block_id}"""}
																									__a    : Union[str, Any]      					=						renew_resnet_paths(blocks[j]     )
																									assign_to_checkpoint(_SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   additional_replacements=[replace_indices]     )

										if any('attn' in layer for layer in up_blocks[i]     ):
															__a    : Optional[int]      					=						len(
															    {'.'.join(shave_segments(_SCREAMING_SNAKE_CASE		,   3     ).split('.'     )[:3]     ) for layer in up_blocks[i] if 'attn' in layer}     )
															__a    : str      					=						{
															    layer_id: [key for key in up_blocks[i] if F"""attn.{layer_id}""" in key] for layer_id in range(_SCREAMING_SNAKE_CASE     )
															}

															if num_attn > 0:
																				for j in range(config['layers_per_block'] + 1     ):
																									__a    : Union[str, Any]      					=						{'old': F"""up_blocks.{i}""", 'new': F"""up_blocks.{block_id}"""}
																									__a    : Optional[Any]      					=						renew_attention_paths(attns[j]     )
																									assign_to_checkpoint(_SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   _SCREAMING_SNAKE_CASE		,   additional_replacements=[replace_indices]     )

					__a    : Any      					=						{k.replace('mid_new_2'		,   'mid_block'     ): v for k, v in new_checkpoint.items()}
					__a    : List[Any]      					=						checkpoint['quant_conv.weight']
					__a    : str      					=						checkpoint['quant_conv.bias']
					if "quantize.embedding.weight" in checkpoint:
										__a    : Optional[Any]      					=						checkpoint['quantize.embedding.weight']
					__a    : List[str]      					=						checkpoint['post_quant_conv.weight']
					__a    : int      					=						checkpoint['post_quant_conv.bias']

					return new_checkpoint


if __name__ == "__main__":
	__lowercase			:		int =			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.')

	__lowercase			:		List[Any] =			parser.parse_args()
	__lowercase			:		str =			torch.load(args.checkpoint_path)

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

	# unet case
	__lowercase			:		Optional[Any] =			{key.split('.')[0] for key in checkpoint.keys()}
	if "encoder" in key_prefix_set and "decoder" in key_prefix_set:
		__lowercase			:		Dict =			convert_vq_autoenc_checkpoint(checkpoint, config)
	else:
		__lowercase			:		List[Any] =			convert_ddpm_checkpoint(checkpoint, config)

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

	if config["_class_name"] == "VQModel":
		__lowercase			:		Optional[int] =			VQModel(**config)
		model.load_state_dict(converted_checkpoint)
		model.save_pretrained(args.dump_path)
	elif config["_class_name"] == "AutoencoderKL":
		__lowercase			:		Optional[Any] =			AutoencoderKL(**config)
		model.load_state_dict(converted_checkpoint)
		model.save_pretrained(args.dump_path)
	else:
		__lowercase			:		Union[str, Any] =			UNetaDModel(**config)
		model.load_state_dict(converted_checkpoint)

		__lowercase			:		List[Any] =			DDPMScheduler.from_config('/'.join(args.checkpoint_path.split('/')[:-1]))

		__lowercase			:		Optional[Any] =			DDPMPipeline(unet=model, scheduler=scheduler)
		pipe.save_pretrained(args.dump_path)







'''simple docstring'''



from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


__lowercase			:		Any =			{'configuration_visual_bert': ['VISUAL_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'VisualBertConfig']}

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	__lowercase			:		Optional[int] =			[
	    'VISUAL_BERT_PRETRAINED_MODEL_ARCHIVE_LIST',
	    'VisualBertForMultipleChoice',
	    'VisualBertForPreTraining',
	    'VisualBertForQuestionAnswering',
	    'VisualBertForRegionToPhraseAlignment',
	    'VisualBertForVisualReasoning',
	    'VisualBertLayer',
	    'VisualBertModel',
	    'VisualBertPreTrainedModel',
	]


if TYPE_CHECKING:
	from .configuration_visual_bert import VISUAL_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, VisualBertConfig

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_visual_bert import (
		    VISUAL_BERT_PRETRAINED_MODEL_ARCHIVE_LIST,
		    VisualBertForMultipleChoice,
		    VisualBertForPreTraining,
		    VisualBertForQuestionAnswering,
		    VisualBertForRegionToPhraseAlignment,
		    VisualBertForVisualReasoning,
		    VisualBertLayer,
		    VisualBertModel,
		    VisualBertPreTrainedModel,
		)


else:
	import sys

	__lowercase			:		Tuple =			_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)



