

"""simple docstring"""




import enum
import os
from hashlib import shaaaa
from typing import Optional

from .. import config
from .logging import get_logger


__UpperCAmelCase =				get_logger(__name__)







class      __lowercase			(    enum.Enum					):
  snake_case_				       =       """all_checks"""
  snake_case_				       =       """basic_checks"""
  snake_case_				       =       """no_checks"""







class      __lowercase			(    __lowerCamelCase					):
  pass







class      __lowercase			(    __lowerCamelCase					):
  pass







class      __lowercase			(    __lowerCamelCase					):
  pass







class      __lowercase			(    __lowerCamelCase					):
  pass







def   lowerCAmelCase						(					__UpperCamelCase							,    __UpperCamelCase							,    __UpperCamelCase=None      ):
 '''simple docstring'''





 if expected_checksums is None:
  logger.info("""Unable to verify checksums."""      )
  return
 if len(set(__UpperCamelCase      ) - set(__UpperCamelCase      )      ) > 0:
  raise ExpectedMoreDownloadedFiles(str(set(__UpperCamelCase      ) - set(__UpperCamelCase      )      )      )
 if len(set(__UpperCamelCase      ) - set(__UpperCamelCase      )      ) > 0:
  raise UnexpectedDownloadedFile(str(set(__UpperCamelCase      ) - set(__UpperCamelCase      )      )      )
 UpperCAmelCase__					:  Tuple					   =					[url for url in expected_checksums if expected_checksums[url] != recorded_checksums[url]]
 UpperCAmelCase__					:  Dict					   =					""" for """ + verification_name if verification_name is not None else """"""
 if len(__UpperCamelCase      ) > 0:
  raise NonMatchingChecksumError(
      F"Checksums didn't match{for_verification_name}:\n"
      F"{bad_urls}\n"
      """Set `verification_mode='no_checks'` to skip checksums verification and ignore this error"""      )
 logger.info("""All the checksums matched successfully""" + for_verification_name      )







class      __lowercase			(    __lowerCamelCase					):
  pass







class      __lowercase			(    __lowerCamelCase					):
  pass







class      __lowercase			(    __lowerCamelCase					):
  pass







class      __lowercase			(    __lowerCamelCase					):
  pass







def   lowerCAmelCase						(					__UpperCamelCase							,    __UpperCamelCase      ):
 '''simple docstring'''





 if expected_splits is None:
  logger.info("""Unable to verify splits sizes."""      )
  return
 if len(set(__UpperCamelCase      ) - set(__UpperCamelCase      )      ) > 0:
  raise ExpectedMoreSplits(str(set(__UpperCamelCase      ) - set(__UpperCamelCase      )      )      )
 if len(set(__UpperCamelCase      ) - set(__UpperCamelCase      )      ) > 0:
  raise UnexpectedSplits(str(set(__UpperCamelCase      ) - set(__UpperCamelCase      )      )      )
 UpperCAmelCase__					:  Union[str, Any]					   =					[
     {"""expected""": expected_splits[name], """recorded""": recorded_splits[name]}
     for name in expected_splits
     if expected_splits[name].num_examples != recorded_splits[name].num_examples
 ]
 if len(__UpperCamelCase      ) > 0:
  raise NonMatchingSplitsSizesError(str(__UpperCamelCase      )      )
 logger.info("""All the splits matched successfully."""      )
def   lowerCAmelCase						(					__UpperCamelCase							,    __UpperCamelCase = True      ):
 '''simple docstring'''





 if record_checksum:
  UpperCAmelCase__					:  Optional[Any]					   =					shaaaa()
  with open(__UpperCamelCase							,    """rb"""      ) as f:
   for chunk in iter(lambda: f.read(1 << 20      )							,    B""""""      ):
    m.update(__UpperCamelCase      )
   UpperCAmelCase__					:  Optional[int]					   =					m.hexdigest()
 else:
  UpperCAmelCase__					:  Dict					   =					None
 return {"num_bytes": os.path.getsize(__UpperCamelCase      ), "checksum": checksum}




def   lowerCAmelCase						(					__UpperCamelCase      ):
 '''simple docstring'''





 if dataset_size and config.IN_MEMORY_MAX_SIZE:
  return dataset_size < config.IN_MEMORY_MAX_SIZE
 else:
  return False








"""simple docstring"""




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


__UpperCAmelCase =				logging.get_logger(__name__)

__UpperCAmelCase =				{
    '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      __lowercase			(    __lowerCamelCase					):
  snake_case_				       =       """markuplm"""

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






   '''simple docstring'''
   super().__init__(
       pad_token_id=A					,bos_token_id=A					,eos_token_id=A					,**A					,)
   UpperCAmelCase__					:  Dict					   =					vocab_size
   UpperCAmelCase__					:  Union[str, Any]					   =					hidden_size
   UpperCAmelCase__					:  Optional[int]					   =					num_hidden_layers
   UpperCAmelCase__					:  Tuple					   =					num_attention_heads
   UpperCAmelCase__					:  Optional[Any]					   =					hidden_act
   UpperCAmelCase__					:  Any					   =					intermediate_size
   UpperCAmelCase__					:  Dict					   =					hidden_dropout_prob
   UpperCAmelCase__					:  Optional[Any]					   =					attention_probs_dropout_prob
   UpperCAmelCase__					:  Optional[int]					   =					max_position_embeddings
   UpperCAmelCase__					:  Dict					   =					type_vocab_size
   UpperCAmelCase__					:  Optional[Any]					   =					initializer_range
   UpperCAmelCase__					:  str					   =					layer_norm_eps
   UpperCAmelCase__					:  Any					   =					position_embedding_type
   UpperCAmelCase__					:  int					   =					use_cache
   UpperCAmelCase__					:  List[str]					   =					classifier_dropout
   # additional properties
   UpperCAmelCase__					:  Optional[int]					   =					max_depth
   UpperCAmelCase__					:  List[str]					   =					max_xpath_tag_unit_embeddings
   UpperCAmelCase__					:  Any					   =					max_xpath_subs_unit_embeddings
   UpperCAmelCase__					:  str					   =					tag_pad_id
   UpperCAmelCase__					:  Dict					   =					subs_pad_id
   UpperCAmelCase__					:  List[str]					   =					xpath_unit_hidden_size





