


"""simple docstring"""







from ...configuration_utils import PretrainedConfig
from ...utils import logging


__a      			= logging.get_logger(__name__)

__a      			= {
    "ZinengTang/tvlt-base": "https://huggingface.co/ZinengTang/tvlt-base/blob/main/config.json",
}
class 				lowerCamelCase							(      __SCREAMING_SNAKE_CASE			):


							"""simple docstring"""
							SCREAMING_SNAKE_CASE              =   """tvlt"""






							def __init__(    self			:  List[str]		,			lowerCamelCase_			:  Union[str, Any]=224		,			lowerCamelCase_			:  List[str]=2048		,			lowerCamelCase_			:  Any=128		,			lowerCamelCase_			:  Tuple=[16, 16]		,			lowerCamelCase_			:  List[Any]=[16, 16]		,			lowerCamelCase_			:  Any=3		,			lowerCamelCase_			:  str=1		,			lowerCamelCase_			:  Tuple=8		,			lowerCamelCase_			:  int=768		,			lowerCamelCase_			:  List[str]=12		,			lowerCamelCase_			:  Optional[int]=12		,			lowerCamelCase_			:  List[Any]=3072		,			lowerCamelCase_			:  List[str]="gelu"		,			lowerCamelCase_			:  Optional[Any]=0.0		,			lowerCamelCase_			:  Any=0.0		,			lowerCamelCase_			:  Union[str, Any]=0.02		,			lowerCamelCase_			:  Optional[Any]=1E-6		,			lowerCamelCase_			:  List[Any]=True		,			lowerCamelCase_			:  Dict=False		,			lowerCamelCase_			:  List[Any]=16		,			lowerCamelCase_			:  Dict=512		,			lowerCamelCase_			:  str=8		,			lowerCamelCase_			:  Optional[Any]=2048		,			lowerCamelCase_			:  int=0.75		,			lowerCamelCase_			:  str=0.15		,			lowerCamelCase_			:  List[str]="frame-level"		,			lowerCamelCase_			:  List[str]=True		,			lowerCamelCase_			:  Optional[int]=True		,			lowerCamelCase_			:  int="classification"		,			**lowerCamelCase_			:  Optional[Any]		,			):
													super().__init__(**lowerCamelCase_					)

													if audio_mask_type not in ("frame-level", "patch_level"):
																			raise ValueError(
																			    '''audio_mask_type must be one of two acceptable strategies - {\'frame_level\', \'patch-level\') '''
																			    f"""got {audio_mask_type}"""					)

													UpperCAmelCase__												=     image_size
													UpperCAmelCase__												=     spectrogram_length
													UpperCAmelCase__												=     frequency_length
													UpperCAmelCase__												=     image_patch_size
													UpperCAmelCase__												=     audio_patch_size
													UpperCAmelCase__												=     num_image_channels
													UpperCAmelCase__												=     num_audio_channels
													UpperCAmelCase__												=     num_frames

													UpperCAmelCase__												=     hidden_size
													UpperCAmelCase__												=     num_hidden_layers
													UpperCAmelCase__												=     num_attention_heads
													UpperCAmelCase__												=     intermediate_size
													UpperCAmelCase__												=     hidden_act
													UpperCAmelCase__												=     hidden_dropout_prob
													UpperCAmelCase__												=     attention_probs_dropout_prob
													UpperCAmelCase__												=     initializer_range
													UpperCAmelCase__												=     layer_norm_eps
													UpperCAmelCase__												=     qkv_bias
													UpperCAmelCase__												=     use_mean_pooling

													UpperCAmelCase__												=     decoder_num_attention_heads
													UpperCAmelCase__												=     decoder_hidden_size
													UpperCAmelCase__												=     decoder_num_hidden_layers
													UpperCAmelCase__												=     decoder_intermediate_size
													UpperCAmelCase__												=     pixel_mask_ratio
													UpperCAmelCase__												=     audio_mask_ratio
													UpperCAmelCase__												=     audio_mask_type

													UpperCAmelCase__												=     task_matching
													UpperCAmelCase__												=     task_mae
													UpperCAmelCase__												=     loss_type



"""simple docstring"""







import importlib
import sys
from argparse import REMAINDER, ArgumentParser
from pathlib import Path

import torch_xla.distributed.xla_multiprocessing as xmp






def        a__			(							):





						"""simple docstring"""

						UpperCAmelCase__												=     ArgumentParser(
						    description=(
						        '''PyTorch TPU distributed training launch helper utility that will spawn up multiple distributed processes'''
						    )			)

						# Optional arguments for the launch helper
						parser.add_argument('''--num_cores'''						,      type=_UpperCamelCase						,      default=1						,      help='''Number of TPU cores to use (1 or 8).'''			)

						# positional
						parser.add_argument(
						    '''training_script'''						,      type=_UpperCamelCase						,      help=(
						        '''The full path to the single TPU training '''
						        '''program/script to be launched in parallel, '''
						        '''followed by all the arguments for the '''
						        '''training script'''
						    )						,      )

						# rest from the training program
						parser.add_argument('''training_script_args'''						,      nargs=_UpperCamelCase			)

						return parser.parse_args()






def        a__			(							):





						"""simple docstring"""

						UpperCAmelCase__												=     parse_args()

						# Import training_script as a module.
						UpperCAmelCase__												=     Path(args.training_script			)
						sys.path.append(str(script_fpath.parent.resolve()			)			)
						UpperCAmelCase__												=     script_fpath.stem
						UpperCAmelCase__												=     importlib.import_module(_UpperCamelCase			)

						# Patch sys.argv
						UpperCAmelCase__												=     [args.training_script] + args.training_script_args + ['''--tpu_num_cores''', str(args.num_cores			)]

						xmp.spawn(mod._mp_fn						,      args=()						,      nprocs=args.num_cores			)


if __name__ == "__main__":
						main()