



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


_lowerCamelCase						    =  logging.get_logger(__name__)

_lowerCamelCase						    =  {
    """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       _SCREAMING_SNAKE_CASE	(UpperCamelCase ):
     lowerCAmelCase					=			"""markuplm"""





     def __init__(       self :							Any     ,  UpperCamelCase :							Tuple=3_0_5_2_2     ,  UpperCamelCase :							Any=7_6_8     ,  UpperCamelCase :							Any=1_2     ,  UpperCamelCase :							Dict=1_2     ,  UpperCamelCase :							int=3_0_7_2     ,  UpperCamelCase :							int="gelu"     ,  UpperCamelCase :							Optional[Any]=0.1     ,  UpperCamelCase :							Union[str, Any]=0.1     ,  UpperCamelCase :							str=5_1_2     ,  UpperCamelCase :							Optional[int]=2     ,  UpperCamelCase :							List[Any]=0.0_2     ,  UpperCamelCase :							Dict=1E-12     ,  UpperCamelCase :							Dict=0     ,  UpperCamelCase :							Dict=0     ,  UpperCamelCase :							Union[str, Any]=2     ,  UpperCamelCase :							List[Any]=2_5_6     ,  UpperCamelCase :							Optional[Any]=1_0_2_4     ,  UpperCamelCase :							Union[str, Any]=2_1_6     ,  UpperCamelCase :							Optional[int]=1_0_0_1     ,  UpperCamelCase :							Optional[int]=3_2     ,  UpperCamelCase :							List[str]=5_0     ,  UpperCamelCase :							Tuple="absolute"     ,  UpperCamelCase :							Any=True     ,  UpperCamelCase :							Optional[Any]=None     ,  **UpperCamelCase :							Any     ,  )->Optional[Any]:
      super().__init__(
          pad_token_id=UpperCamelCase     ,  bos_token_id=UpperCamelCase     ,  eos_token_id=UpperCamelCase     ,  **UpperCamelCase     ,  )
      __SCREAMING_SNAKE_CASE       :    List[Any]       =	vocab_size
      __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	hidden_size
      __SCREAMING_SNAKE_CASE       :    List[str]       =	num_hidden_layers
      __SCREAMING_SNAKE_CASE       :    Tuple       =	num_attention_heads
      __SCREAMING_SNAKE_CASE       :    str       =	hidden_act
      __SCREAMING_SNAKE_CASE       :    List[str]       =	intermediate_size
      __SCREAMING_SNAKE_CASE       :    List[str]       =	hidden_dropout_prob
      __SCREAMING_SNAKE_CASE       :    Optional[Any]       =	attention_probs_dropout_prob
      __SCREAMING_SNAKE_CASE       :    Dict       =	max_position_embeddings
      __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	type_vocab_size
      __SCREAMING_SNAKE_CASE       :    Dict       =	initializer_range
      __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	layer_norm_eps
      __SCREAMING_SNAKE_CASE       :    Union[str, Any]       =	position_embedding_type
      __SCREAMING_SNAKE_CASE       :    List[str]       =	use_cache
      __SCREAMING_SNAKE_CASE       :    Tuple       =	classifier_dropout
      # additional properties
      __SCREAMING_SNAKE_CASE       :    Any       =	max_depth
      __SCREAMING_SNAKE_CASE       :    int       =	max_xpath_tag_unit_embeddings
      __SCREAMING_SNAKE_CASE       :    List[Any]       =	max_xpath_subs_unit_embeddings
      __SCREAMING_SNAKE_CASE       :    int       =	tag_pad_id
      __SCREAMING_SNAKE_CASE       :    Optional[int]       =	subs_pad_id
      __SCREAMING_SNAKE_CASE       :    str       =	xpath_unit_hidden_size











import importlib
import shutil
import threading
import warnings
from typing import List

import fsspec
import fsspec.asyn

from . import compression
from .hffilesystem import HfFileSystem


_lowerCamelCase						    =  importlib.util.find_spec("""s3fs""") is not None

if _has_safs:
      from .safilesystem import SaFileSystem  # noqa: F401

_lowerCamelCase						    =  [
    compression.BzaFileSystem,
    compression.GzipFileSystem,
    compression.LzaFileSystem,
    compression.XzFileSystem,
    compression.ZstdFileSystem,
]

# Register custom filesystems
for fs_class in COMPRESSION_FILESYSTEMS + [HfFileSystem]:
      if fs_class.protocol in fsspec.registry and fsspec.registry[fs_class.protocol] is not fs_class:
            warnings.warn(f'''A filesystem protocol was already set for {fs_class.protocol} and will be overwritten.''')
      fsspec.register_implementation(fs_class.protocol, fs_class, clobber=True)






def 	_lowerCAmelCase						(				__lowerCamelCase   :     str     ):



 """simple docstring"""





 if "://" in dataset_path:
  __SCREAMING_SNAKE_CASE       :    Any       =	dataset_path.split("://"     )[1]
 return dataset_path






def 	_lowerCAmelCase						(				__lowerCamelCase   :     fsspec.AbstractFileSystem     ):



 """simple docstring"""





 if fs is not None and fs.protocol != "file":
  return True
 else:
  return False






def 	_lowerCAmelCase						(				__lowerCamelCase   :     fsspec.AbstractFileSystem		,	__lowerCamelCase   :     str		,	__lowerCamelCase   :     str     ):



 """simple docstring"""





 __SCREAMING_SNAKE_CASE       :    Optional[int]       =	not is_remote_filesystem(__lowerCamelCase     )
 if is_local:
  # LocalFileSystem.mv does copy + rm, it is more efficient to simply move a local directory
  shutil.move(fs._strip_protocol(__lowerCamelCase     )		,	fs._strip_protocol(__lowerCamelCase     )     )
 else:
  fs.mv(__lowerCamelCase		,	__lowerCamelCase		,	recursive=__lowerCamelCase     )






def 	_lowerCAmelCase						(				):



 """simple docstring"""





 if hasattr(fsspec.asyn		,	"reset_lock"     ):
  # for future fsspec>2022.05.0
  fsspec.asyn.reset_lock()
 else:
  __SCREAMING_SNAKE_CASE       :    Tuple       =	None
  __SCREAMING_SNAKE_CASE       :    Optional[Any]       =	None
  __SCREAMING_SNAKE_CASE       :    Dict       =	threading.Lock()






