

"""simple docstring"""





from ...configuration_utils import PretrainedConfig


_a       =							{
    'google/tapas-base-finetuned-sqa': (
        'https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json'
    ),
    'google/tapas-base-finetuned-wtq': (
        'https://huggingface.co/google/tapas-base-finetuned-wtq/resolve/main/config.json'
    ),
    'google/tapas-base-finetuned-wikisql-supervised': (
        'https://huggingface.co/google/tapas-base-finetuned-wikisql-supervised/resolve/main/config.json'
    ),
    'google/tapas-base-finetuned-tabfact': (
        'https://huggingface.co/google/tapas-base-finetuned-tabfact/resolve/main/config.json'
    ),
}




class 					_lowerCAmelCase  (	lowercase   ):







 """simple docstring"""







 __UpperCAmelCase	:					Union[str, Any]   		=	"tapas"


 def __init__(			self							:			int,					UpperCAmelCase__							:			List[Any]=3_0_5_2_2,					UpperCAmelCase__							:			Any=7_6_8,					UpperCAmelCase__							:			Tuple=1_2,					UpperCAmelCase__							:			str=1_2,					UpperCAmelCase__							:			Union[str, Any]=3_0_7_2,					UpperCAmelCase__							:			Union[str, Any]="gelu",					UpperCAmelCase__							:			Dict=0.1,					UpperCAmelCase__							:			Union[str, Any]=0.1,					UpperCAmelCase__							:			Optional[int]=1_0_2_4,					UpperCAmelCase__							:			Optional[Any]=[3, 2_5_6, 2_5_6, 2, 2_5_6, 2_5_6, 1_0],					UpperCAmelCase__							:			Dict=0.02,					UpperCAmelCase__							:			str=1E-12,					UpperCAmelCase__							:			int=0,					UpperCAmelCase__							:			Optional[Any]=10.0,					UpperCAmelCase__							:			Union[str, Any]=0,					UpperCAmelCase__							:			Any=1.0,					UpperCAmelCase__							:			List[Any]=None,					UpperCAmelCase__							:			Any=1.0,					UpperCAmelCase__							:			Union[str, Any]=False,					UpperCAmelCase__							:			Union[str, Any]=None,					UpperCAmelCase__							:			Union[str, Any]=1.0,					UpperCAmelCase__							:			Optional[Any]=1.0,					UpperCAmelCase__							:			Optional[Any]=False,					UpperCAmelCase__							:			str=False,					UpperCAmelCase__							:			List[str]="ratio",					UpperCAmelCase__							:			Optional[Any]=None,					UpperCAmelCase__							:			Dict=None,					UpperCAmelCase__							:			Optional[Any]=6_4,					UpperCAmelCase__							:			Dict=3_2,					UpperCAmelCase__							:			Any=False,					UpperCAmelCase__							:			List[str]=True,					UpperCAmelCase__							:			Optional[Any]=False,					UpperCAmelCase__							:			Optional[Any]=False,					UpperCAmelCase__							:			Any=True,					UpperCAmelCase__							:			Union[str, Any]=False,					UpperCAmelCase__							:			str=None,					UpperCAmelCase__							:			int=None,					**UpperCAmelCase__							:			Optional[int],					):
    super().__init__(pad_token_id=UpperCAmelCase__,					**UpperCAmelCase__	)

    # BERT hyperparameters (with updated max_position_embeddings and type_vocab_sizes)
    __lowercase								=						vocab_size
    __lowercase								=						hidden_size
    __lowercase								=						num_hidden_layers
    __lowercase								=						num_attention_heads
    __lowercase								=						hidden_act
    __lowercase								=						intermediate_size
    __lowercase								=						hidden_dropout_prob
    __lowercase								=						attention_probs_dropout_prob
    __lowercase								=						max_position_embeddings
    __lowercase								=						type_vocab_sizes
    __lowercase								=						initializer_range
    __lowercase								=						layer_norm_eps

    # Fine-tuning task hyperparameters
    __lowercase								=						positive_label_weight
    __lowercase								=						num_aggregation_labels
    __lowercase								=						aggregation_loss_weight
    __lowercase								=						use_answer_as_supervision
    __lowercase								=						answer_loss_importance
    __lowercase								=						use_normalized_answer_loss
    __lowercase								=						huber_loss_delta
    __lowercase								=						temperature
    __lowercase								=						aggregation_temperature
    __lowercase								=						use_gumbel_for_cells
    __lowercase								=						use_gumbel_for_aggregation
    __lowercase								=						average_approximation_function
    __lowercase								=						cell_selection_preference
    __lowercase								=						answer_loss_cutoff
    __lowercase								=						max_num_rows
    __lowercase								=						max_num_columns
    __lowercase								=						average_logits_per_cell
    __lowercase								=						select_one_column
    __lowercase								=						allow_empty_column_selection
    __lowercase								=						init_cell_selection_weights_to_zero
    __lowercase								=						reset_position_index_per_cell
    __lowercase								=						disable_per_token_loss

    # Aggregation hyperparameters
    __lowercase								=						aggregation_labels
    __lowercase								=						no_aggregation_label_index

    if isinstance(self.aggregation_labels,					UpperCAmelCase__	):
       __lowercase								=						{int(UpperCAmelCase__	): v for k, v in aggregation_labels.items()}











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

import fsspec
import fsspec.asyn

from . import compression
from .hffilesystem import HfFileSystem


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

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

SCREAMING_SNAKE_CASE_						   =       [
    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    __lowercase   (      _SCREAMING_SNAKE_CASE	) ->   str:


      '''simple docstring'''


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



def    __lowercase   (      _SCREAMING_SNAKE_CASE	) ->   bool:


      '''simple docstring'''


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



def    __lowercase   (      _SCREAMING_SNAKE_CASE ,						_SCREAMING_SNAKE_CASE ,						_SCREAMING_SNAKE_CASE	) ->   Dict:


      '''simple docstring'''


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



def    __lowercase   (      ) ->   None:


      '''simple docstring'''


      if hasattr(fsspec.asyn ,						"""reset_lock"""	):
            # for future fsspec>2022.05.0
            fsspec.asyn.reset_lock()
      else:
            SCREAMING_SNAKE_CASE		=						None
            SCREAMING_SNAKE_CASE		=						None
            SCREAMING_SNAKE_CASE		=						threading.Lock()


