


'''simple docstring'''
import os
from typing import Optional

import fsspec
from fsspec.archive import AbstractArchiveFileSystem
from fsspec.utils import DEFAULT_BLOCK_SIZE
class        lowercase     (							lowerCAmelCase__ ):

		"""simple docstring"""

		_a   			=    ""
		_a   			=    (
		    None  # protocol passed in prefix to the url. ex: "gzip", for gzip://file.txt::http://foo.bar/file.txt.gz
		)
		_a   			=    None  # compression type in fsspec. ex: "gzip"
		_a   			=    None  # extension of the filename to strip. ex: "".gz" to get file.txt from file.txt.gz




		def __init__(		self   ,       UpperCamelCase_ = ""   ,       UpperCamelCase_ = None   ,       UpperCamelCase_ = None   ,       **UpperCamelCase_							):

							'''simple docstring'''


							super().__init__(self   ,       **_SCREAMING_SNAKE_CASE							)
							# always open as "rb" since fsspec can then use the TextIOWrapper to make it work for "r" mode
							UpperCamelCase__       :Optional[int]							 =			fsspec.open(
							    _SCREAMING_SNAKE_CASE   ,       mode='''rb'''   ,       protocol=_SCREAMING_SNAKE_CASE   ,       compression=self.compression   ,       client_kwargs={
							        '''requote_redirect_url''': False,  # see https://github.com/huggingface/datasets/pull/5459
							        '''trust_env''': True,  # Enable reading proxy env variables.
							        **(target_options or {}).pop('''client_kwargs'''   ,       {}							),  # To avoid issues if it was already passed.
							    }   ,       **(target_options or {})   ,       )
							UpperCamelCase__       :int							 =			os.path.basename(self.file.path.split('''::'''							)[0]							)
							UpperCamelCase__       :List[Any]							 =			(
							    self.compressed_name[: self.compressed_name.rindex('''.'''							)]
							    if '''.''' in self.compressed_name
							    else self.compressed_name
							)
							UpperCamelCase__       :Optional[int]							 =			None




		@classmethod
		def    lowerCAmelCase__    (		cls   ,       UpperCamelCase_							):

							'''simple docstring'''


							return super()._strip_protocol(_SCREAMING_SNAKE_CASE							).lstrip('''/'''							)




		def    lowerCAmelCase__    (		self							):

							'''simple docstring'''


							if self.dir_cache is None:
												UpperCamelCase__       :Optional[int]							 =			{**self.file.fs.info(self.file.path							), '''name''': self.uncompressed_name}
												UpperCamelCase__       :str							 =			{f['''name''']: f}




		def    lowerCAmelCase__    (		self   ,       UpperCamelCase_							):

							'''simple docstring'''


							return self.file.open().read()




		def    lowerCAmelCase__    (		self   ,       UpperCamelCase_   ,       UpperCamelCase_ = "rb"   ,       UpperCamelCase_=None   ,       UpperCamelCase_=True   ,       UpperCamelCase_=None   ,       **UpperCamelCase_   ,       ):

							'''simple docstring'''


							UpperCamelCase__       :List[Any]							 =			self._strip_protocol(_SCREAMING_SNAKE_CASE							)
							if mode != "rb":
												raise ValueError(F'''Tried to read with mode {mode} on file {self.file.path} opened with mode \'rb\''''							)
							return self.file.open()



class        lowercase     (							lowerCAmelCase__ ):

		"""simple docstring"""

		_a   			=    "bz2"
		_a   			=    "bz2"
		_a   			=    ".bz2"



class        lowercase     (							lowerCAmelCase__ ):

		"""simple docstring"""

		_a   			=    "gzip"
		_a   			=    "gzip"
		_a   			=    ".gz"



class        lowercase     (							lowerCAmelCase__ ):

		"""simple docstring"""

		_a   			=    "lz4"
		_a   			=    "lz4"
		_a   			=    ".lz4"



class        lowercase     (							lowerCAmelCase__ ):

		"""simple docstring"""

		_a   			=    "xz"
		_a   			=    "xz"
		_a   			=    ".xz"



class        lowercase     (							lowerCAmelCase__ ):

		"""simple docstring"""

		_a   			=    "zstd"
		_a   			=    "zstd"
		_a   			=    ".zst"




		def __init__(		self   ,       UpperCamelCase_   ,       UpperCamelCase_ = "rb"   ,       UpperCamelCase_ = None   ,       UpperCamelCase_ = None   ,       UpperCamelCase_ = DEFAULT_BLOCK_SIZE   ,       **UpperCamelCase_   ,       ):

							'''simple docstring'''


							super().__init__(
							    fo=_SCREAMING_SNAKE_CASE   ,       mode=_SCREAMING_SNAKE_CASE   ,       target_protocol=_SCREAMING_SNAKE_CASE   ,       target_options=_SCREAMING_SNAKE_CASE   ,       block_size=_SCREAMING_SNAKE_CASE   ,       **_SCREAMING_SNAKE_CASE   ,       )
							# We need to wrap the zstd decompressor to avoid this error in fsspec==2021.7.0 and zstandard==0.15.2:
							#
							# File "/Users/user/.virtualenvs/hf-datasets/lib/python3.7/site-packages/fsspec/core.py", line 145, in open
							#     out.close = close
							# AttributeError: 'zstd.ZstdDecompressionReader' object attribute 'close' is read-only
							#
							# see https://github.com/intake/filesystem_spec/issues/725
							UpperCamelCase__       :int							 =			self.file.__enter__
							class        lowercase     :

									"""simple docstring"""

									def __init__(		self   ,       UpperCamelCase_							):

														'''simple docstring'''


														UpperCamelCase__       :Tuple							 =			file_




									def __enter__(		self							):

														'''simple docstring'''


														self._file.__enter__()
														return self




									def __exit__(		self   ,       *UpperCamelCase_   ,       **UpperCamelCase_							):

														'''simple docstring'''


														self._file.__exit__(*_SCREAMING_SNAKE_CASE   ,       **_SCREAMING_SNAKE_CASE							)




									def __iter__(		self							):

														'''simple docstring'''


														return iter(self._file							)




									def    lowerCAmelCase__    (		self							):

														'''simple docstring'''


														return next(self._file							)




									def __getattr__(		self   ,       UpperCamelCase_							):

														'''simple docstring'''


														return getattr(self._file   ,       _SCREAMING_SNAKE_CASE							)

							def fixed_enter(*UpperCamelCase_   ,       **UpperCamelCase_							):
												return WrappedFile(_enter(*_SCREAMING_SNAKE_CASE   ,       **_SCREAMING_SNAKE_CASE							)							)

							UpperCamelCase__       :Any							 =			fixed_enter



'''simple docstring'''
import logging

from transformers.configuration_utils import PretrainedConfig


__snake_case											=					logging.getLogger(__name__)
class        lowercase     (							A__ ):

		"""simple docstring"""

		_a   			=    'masked_bert'




		def __init__(		self   ,       UpperCamelCase_=30522   ,       UpperCamelCase_=768   ,       UpperCamelCase_=12   ,       UpperCamelCase_=12   ,       UpperCamelCase_=3072   ,       UpperCamelCase_="gelu"   ,       UpperCamelCase_=0.1   ,       UpperCamelCase_=0.1   ,       UpperCamelCase_=512   ,       UpperCamelCase_=2   ,       UpperCamelCase_=0.02   ,       UpperCamelCase_=1e-12   ,       UpperCamelCase_=0   ,       UpperCamelCase_="topK"   ,       UpperCamelCase_="constant"   ,       UpperCamelCase_=0.0   ,       **UpperCamelCase_   ,       ):

							'''simple docstring'''


							super().__init__(pad_token_id=UpperCamelCase_   ,       **UpperCamelCase_							)

							UpperCamelCase__       :Tuple							 =			vocab_size
							UpperCamelCase__       :Dict							 =			hidden_size
							UpperCamelCase__       :Optional[int]							 =			num_hidden_layers
							UpperCamelCase__       :Any							 =			num_attention_heads
							UpperCamelCase__       :Optional[Any]							 =			hidden_act
							UpperCamelCase__       :str							 =			intermediate_size
							UpperCamelCase__       :List[Any]							 =			hidden_dropout_prob
							UpperCamelCase__       :List[str]							 =			attention_probs_dropout_prob
							UpperCamelCase__       :List[Any]							 =			max_position_embeddings
							UpperCamelCase__       :int							 =			type_vocab_size
							UpperCamelCase__       :List[Any]							 =			initializer_range
							UpperCamelCase__       :Any							 =			layer_norm_eps
							UpperCamelCase__       :str							 =			pruning_method
							UpperCamelCase__       :int							 =			mask_init
							UpperCamelCase__       :Optional[Any]							 =			mask_scale