
"""simple docstring"""





import importlib
import os
import sys


# This is required to make the module import works (when the python process is running from the root of the repo)
sys.path.append('''.''')
def 							A_     (__a				):

					'''simple docstring'''





					A_				 =						test_file.split(os.path.sep				)
					if components[0:2] != ["tests", "models"]:
										raise ValueError(
										    "`test_file` should start with `tests/models/` (with `/` being the OS specific path separator). Got "
										    f'{test_file} instead.'				)
					A_				 =						components[-1]
					if not test_fn.endswith("py"				):
										raise ValueError(f'`test_file` should be a python file. Got {test_fn} instead.'				)
					if not test_fn.startswith("test_modeling_"				):
										raise ValueError(
										    f'`test_file` should point to a file name of the form `test_modeling_*.py`. Got {test_fn} instead.'				)

					A_				 =						components[:-1] + [test_fn.replace(".py"				,   ""				)]
					A_				 =						".".join(__a				)

					return test_module_path
def 							A_     (__a				):

					'''simple docstring'''





					A_				 =						get_module_path(__a				)
					A_				 =						importlib.import_module(__a				)

					return test_module
def 							A_     (__a				):

					'''simple docstring'''





					A_				 =						[]
					A_				 =						get_test_module(__a				)
					for attr in dir(__a				):
										if attr.endswith("ModelTester"				):
															tester_classes.append(getattr(__a				,   __a				)				)

    # sort with class names
					return sorted(__a				,   key=lambda __a				: x.__name__				)
def 							A_     (__a				):

					'''simple docstring'''





					A_				 =						[]
					A_				 =						get_test_module(__a				)
					for attr in dir(__a				):
										A_				 =						getattr(__a				,   __a				)
										# (TF/Flax)ModelTesterMixin is also an attribute in specific model test module. Let's exclude them by checking
										# `all_model_classes` is not empty (which also excludes other special classes).
										A_				 =						getattr(__a				,   "all_model_classes"				,   []				)
										if len(__a				) > 0:
															test_classes.append(__a				)

    # sort with class names
					return sorted(__a				,   key=lambda __a				: x.__name__				)
def 							A_     (__a				):

					'''simple docstring'''





					A_				 =						get_test_classes(__a				)
					A_				 =						set()
					for test_class in test_classes:
										model_classes.update(test_class.all_model_classes				)

					# sort with class names
					return sorted(__a				,   key=lambda __a				: x.__name__				)
def 							A_     (__a				):

					'''simple docstring'''





					A_				 =						test_class()
					if hasattr(__a				,   "setUp"				):
										test.setUp()

					A_				 =						None
					if hasattr(__a				,   "model_tester"				):
										# `(TF/Flax)ModelTesterMixin` has this attribute default to `None`. Let's skip this case.
										if test.model_tester is not None:
															A_				 =						test.model_tester.__class__

					return model_tester
def 							A_     (__a				,   __a				):

					'''simple docstring'''





					A_				 =						get_test_classes(__a				)

					A_				 =						[]
					for test_class in test_classes:
										if model_class in test_class.all_model_classes:
															target_test_classes.append(__a				)

    # sort with class names
					return sorted(__a				,   key=lambda __a				: x.__name__				)
def 							A_     (__a				,   __a				):

					'''simple docstring'''





					A_				 =						get_test_classes_for_model(__a				,   __a				)

					A_				 =						[]
					for test_class in test_classes:
										A_				 =						get_model_tester_from_test_class(__a				)
										if tester_class is not None:
															tester_classes.append(__a				)

    # sort with class names
					return sorted(__a				,   key=lambda __a				: x.__name__				)
def 							A_     (__a				):

					'''simple docstring'''





					A_				 =						get_test_classes(__a				)
					A_				 =						{test_class: get_model_tester_from_test_class(__a				) for test_class in test_classes}
					return test_tester_mapping
def 							A_     (__a				):

					'''simple docstring'''





					A_				 =						get_model_classes(__a				)
					A_				 =						{
					    model_class: get_test_classes_for_model(__a				,   __a				) for model_class in model_classes
					}
					return model_test_mapping
def 							A_     (__a				):

					'''simple docstring'''





					A_				 =						get_model_classes(__a				)
					A_				 =						{
					    model_class: get_tester_classes_for_model(__a				,   __a				) for model_class in model_classes
					}
					return model_to_tester_mapping




def 							A_     (__a				):

					'''simple docstring'''





					if isinstance(__a				,   __a				):
										return o
					elif isinstance(__a				,   __a				):
										return o.__name__
					elif isinstance(__a				,   (list, tuple)				):
										return [to_json(__a				) for x in o]
					elif isinstance(__a				,   __a				):
										return {to_json(__a				): to_json(__a				) for k, v in o.items()}
					else:
										return o






"""simple docstring"""





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


UpperCamelCase_					:						Tuple				= logging.get_logger(__name__)

UpperCamelCase_					:						Optional[int]				= {
    '''microsoft/markuplm-base''': '''https://huggingface.co/microsoft/markuplm-base/resolve/main/config.json''',
    '''microsoft/markuplm-large''': '''https://huggingface.co/microsoft/markuplm-large/resolve/main/config.json''',
}



class __lowerCAmelCase				(					_lowercase      ):




			"""simple docstring"""







			snake_case	      =				"markuplm"




			def __init__(				self						:					Optional[Any]       ,   _snake_case						:					Dict=30_522       ,   _snake_case						:					str=768       ,   _snake_case						:					Tuple=12       ,   _snake_case						:					Union[str, Any]=12       ,   _snake_case						:					Union[str, Any]=3_072       ,   _snake_case						:					List[str]="gelu"       ,   _snake_case						:					List[str]=0.1       ,   _snake_case						:					Optional[Any]=0.1       ,   _snake_case						:					Dict=512       ,   _snake_case						:					Union[str, Any]=2       ,   _snake_case						:					Tuple=0.0_2       ,   _snake_case						:					Tuple=1e-12       ,   _snake_case						:					Tuple=0       ,   _snake_case						:					Tuple=0       ,   _snake_case						:					Optional[Any]=2       ,   _snake_case						:					int=256       ,   _snake_case						:					Dict=1_024       ,   _snake_case						:					List[str]=216       ,   _snake_case						:					Optional[int]=1_001       ,   _snake_case						:					Union[str, Any]=32       ,   _snake_case						:					List[str]=50       ,   _snake_case						:					str="absolute"       ,   _snake_case						:					Optional[Any]=True       ,   _snake_case						:					str=None       ,   **_snake_case						:					Optional[Any]       ,   )      -> Optional[Any]:







								"""simple docstring"""
								super().__init__(
								    pad_token_id=_snake_case       ,   bos_token_id=_snake_case       ,   eos_token_id=_snake_case       ,   **_snake_case       ,   )
								A_				 =						vocab_size
								A_				 =						hidden_size
								A_				 =						num_hidden_layers
								A_				 =						num_attention_heads
								A_				 =						hidden_act
								A_				 =						intermediate_size
								A_				 =						hidden_dropout_prob
								A_				 =						attention_probs_dropout_prob
								A_				 =						max_position_embeddings
								A_				 =						type_vocab_size
								A_				 =						initializer_range
								A_				 =						layer_norm_eps
								A_				 =						position_embedding_type
								A_				 =						use_cache
								A_				 =						classifier_dropout
								# additional properties
								A_				 =						max_depth
								A_				 =						max_xpath_tag_unit_embeddings
								A_				 =						max_xpath_subs_unit_embeddings
								A_				 =						tag_pad_id
								A_				 =						subs_pad_id
								A_				 =						xpath_unit_hidden_size




