'''simple docstring'''




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

import torch_xla.distributed.xla_multiprocessing as xmp

def _lowercase	(      )					->       List[str]:





       """simple docstring"""


       __UpperCAmelCase  :				Optional[Any]       				=		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 _lowercase	(      )					->       Optional[int]:





       """simple docstring"""


       __UpperCAmelCase  :				int       				=		parse_args()

       # Import training_script as a module.
       __UpperCAmelCase  :				List[Any]       				=		Path(args.training_script						)
       sys.path.append(str(script_fpath.parent.resolve()						)						)
       __UpperCAmelCase  :				int       				=		script_fpath.stem
       __UpperCAmelCase  :				List[Any]       				=		importlib.import_module(__UpperCamelCase						)

       # Patch sys.argv
       __UpperCAmelCase  :				int       				=		[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()







'''simple docstring'''




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


_a   :	Any 							=   logging.get_logger(__name__)

_a   :	List[Any] 							=   {
    "microsoft/cvt-13": "https://huggingface.co/microsoft/cvt-13/resolve/main/config.json",
    # See all Cvt models at https://huggingface.co/models?filter=cvt
}






class 		__A       (__magic_name__   ):
       snake_case       :Any				    =					"cvt"






       def __init__(      self				,     UpperCamelCase_=3				,     UpperCamelCase_=[7, 3, 3]				,     UpperCamelCase_=[4, 2, 2]				,     UpperCamelCase_=[2, 1, 1]				,     UpperCamelCase_=[64, 1_92, 3_84]				,     UpperCamelCase_=[1, 3, 6]				,     UpperCamelCase_=[1, 2, 10]				,     UpperCamelCase_=[4.0, 4.0, 4.0]				,     UpperCamelCase_=[0.0, 0.0, 0.0]				,     UpperCamelCase_=[0.0, 0.0, 0.0]				,     UpperCamelCase_=[0.0, 0.0, 0.1]				,     UpperCamelCase_=[True, True, True]				,     UpperCamelCase_=[False, False, True]				,     UpperCamelCase_=["dw_bn", "dw_bn", "dw_bn"]				,     UpperCamelCase_=[3, 3, 3]				,     UpperCamelCase_=[1, 1, 1]				,     UpperCamelCase_=[2, 2, 2]				,     UpperCamelCase_=[1, 1, 1]				,     UpperCamelCase_=[1, 1, 1]				,     UpperCamelCase_=0.0_2				,     UpperCamelCase_=1E-12				,     **UpperCamelCase_				,     ):
              super().__init__(**UpperCamelCase_      )
              __UpperCAmelCase  :				Optional[int]       				=		num_channels
              __UpperCAmelCase  :				Optional[Any]       				=		patch_sizes
              __UpperCAmelCase  :				List[str]       				=		patch_stride
              __UpperCAmelCase  :				Tuple       				=		patch_padding
              __UpperCAmelCase  :				int       				=		embed_dim
              __UpperCAmelCase  :				str       				=		num_heads
              __UpperCAmelCase  :				Any       				=		depth
              __UpperCAmelCase  :				List[str]       				=		mlp_ratio
              __UpperCAmelCase  :				List[str]       				=		attention_drop_rate
              __UpperCAmelCase  :				Dict       				=		drop_rate
              __UpperCAmelCase  :				Dict       				=		drop_path_rate
              __UpperCAmelCase  :				str       				=		qkv_bias
              __UpperCAmelCase  :				Optional[int]       				=		cls_token
              __UpperCAmelCase  :				Optional[Any]       				=		qkv_projection_method
              __UpperCAmelCase  :				Tuple       				=		kernel_qkv
              __UpperCAmelCase  :				Optional[Any]       				=		padding_kv
              __UpperCAmelCase  :				Optional[int]       				=		stride_kv
              __UpperCAmelCase  :				Any       				=		padding_q
              __UpperCAmelCase  :				List[Any]       				=		stride_q
              __UpperCAmelCase  :				Union[str, Any]       				=		initializer_range
              __UpperCAmelCase  :				Any       				=		layer_norm_eps






