




"""simple docstring"""




from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


lowerCAmelCase							:			Dict     							=							logging.get_logger(__name__)

lowerCAmelCase							:			Dict     							=							{
    """YituTech/conv-bert-base""": """https://huggingface.co/YituTech/conv-bert-base/resolve/main/config.json""",
    """YituTech/conv-bert-medium-small""": (
        """https://huggingface.co/YituTech/conv-bert-medium-small/resolve/main/config.json"""
    ),
    """YituTech/conv-bert-small""": """https://huggingface.co/YituTech/conv-bert-small/resolve/main/config.json""",
    # See all ConvBERT models at https://huggingface.co/models?filter=convbert
}






class     __magic_name__							(       UpperCAmelCase__				):






				'''simple docstring'''
				__UpperCamelCase			  =						"convbert"





				def __init__(       self		, _a=30_522		, _a=768		, _a=12		, _a=12		, _a=3_072		, _a="gelu"		, _a=0.1		, _a=0.1		, _a=512		, _a=2		, _a=0.02		, _a=1e-1_2		, _a=1		, _a=0		, _a=2		, _a=768		, _a=2		, _a=9		, _a=1		, _a=None		, **_a		, ):





							"""simple docstring"""
							super().__init__(
							    pad_token_id=_a		, bos_token_id=_a		, eos_token_id=_a		, **_a		, )

							lowerCamelCase			      =					vocab_size
							lowerCamelCase			      =					hidden_size
							lowerCamelCase			      =					num_hidden_layers
							lowerCamelCase			      =					num_attention_heads
							lowerCamelCase			      =					intermediate_size
							lowerCamelCase			      =					hidden_act
							lowerCamelCase			      =					hidden_dropout_prob
							lowerCamelCase			      =					attention_probs_dropout_prob
							lowerCamelCase			      =					max_position_embeddings
							lowerCamelCase			      =					type_vocab_size
							lowerCamelCase			      =					initializer_range
							lowerCamelCase			      =					layer_norm_eps
							lowerCamelCase			      =					embedding_size
							lowerCamelCase			      =					head_ratio
							lowerCamelCase			      =					conv_kernel_size
							lowerCamelCase			      =					num_groups
							lowerCamelCase			      =					classifier_dropout






class     __magic_name__							(       UpperCAmelCase__				):






				'''simple docstring'''





				@property
				def    _lowerCAmelCase				(       self ):





							"""simple docstring"""
							if self.task == "multiple-choice":
										lowerCamelCase			      =					{0: """batch""", 1: """choice""", 2: """sequence"""}
							else:
										lowerCamelCase			      =					{0: """batch""", 1: """sequence"""}
							return OrderedDict(
							    [
							        ("""input_ids""", dynamic_axis),
							        ("""attention_mask""", dynamic_axis),
							        ("""token_type_ids""", dynamic_axis),
							    ] )









"""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__ (				)						->					Union[str, Any]:
			lowerCamelCase			      =					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=snake_case__       , default=1       , help="""Number of TPU cores to use (1 or 8)."""				)

			# positional
			parser.add_argument(
			    """training_script"""       , type=snake_case__       , 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=snake_case__				)

			return parser.parse_args()



def     a__ (				)						->					List[str]:
			lowerCamelCase			      =					parse_args()

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

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



