




from ...configuration_utils import PretrainedConfig


_lowerCamelCase     					=		{
    '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      a	(  _A     ):

     '''simple docstring'''





     lowerCAmelCase							:			Union[str, Any]  						=    'tapas'
     def __init__(      self  :     int   ,       __snake_case  :     Tuple=3_05_22   ,       __snake_case  :     Tuple=7_68   ,       __snake_case  :     List[str]=12   ,       __snake_case  :     List[Any]=12   ,       __snake_case  :     Union[str, Any]=30_72   ,       __snake_case  :     Any="gelu"   ,       __snake_case  :     Dict=0.1   ,       __snake_case  :     Optional[Any]=0.1   ,       __snake_case  :     Any=10_24   ,       __snake_case  :     int=[3, 2_56, 2_56, 2, 2_56, 2_56, 10]   ,       __snake_case  :     int=0.02   ,       __snake_case  :     List[str]=1E-12   ,       __snake_case  :     int=0   ,       __snake_case  :     List[Any]=10.0   ,       __snake_case  :     Optional[Any]=0   ,       __snake_case  :     Union[str, Any]=1.0   ,       __snake_case  :     Dict=None   ,       __snake_case  :     Optional[Any]=1.0   ,       __snake_case  :     Optional[Any]=False   ,       __snake_case  :     Dict=None   ,       __snake_case  :     Dict=1.0   ,       __snake_case  :     int=1.0   ,       __snake_case  :     Union[str, Any]=False   ,       __snake_case  :     int=False   ,       __snake_case  :     Any="ratio"   ,       __snake_case  :     str=None   ,       __snake_case  :     int=None   ,       __snake_case  :     Optional[int]=64   ,       __snake_case  :     Tuple=32   ,       __snake_case  :     int=False   ,       __snake_case  :     List[Any]=True   ,       __snake_case  :     Tuple=False   ,       __snake_case  :     Optional[int]=False   ,       __snake_case  :     int=True   ,       __snake_case  :     Union[str, Any]=False   ,       __snake_case  :     Any=None   ,       __snake_case  :     Optional[Any]=None   ,       **__snake_case  :     Any   ,       ):
         super().__init__(pad_token_id=__SCREAMING_SNAKE_CASE   ,       **__SCREAMING_SNAKE_CASE							)

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

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

         # Aggregation hyperparameters
         UpperCAmelCase_									=	aggregation_labels
         UpperCAmelCase_									=	no_aggregation_label_index

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








'''simple docstring'''



from typing import Optional, Union

import torch
from torch import nn

from ...configuration_utils import ConfigMixin, register_to_config
from ...models.modeling_utils import ModelMixin







class 		lowerCAmelCase__  ( a					,   a   ):



 """simple docstring"""



 @register_to_config
 def __init__(						self   :			int   ,				__SCREAMING_SNAKE_CASE   :			int = 768   ,				)    ->					int:


      """simple docstring"""




      super().__init__()

      __SCREAMING_SNAKE_CASE      = nn.Parameter(torch.zeros(1   ,				__SCREAMING_SNAKE_CASE     )     )
      __SCREAMING_SNAKE_CASE      = nn.Parameter(torch.ones(1   ,				__SCREAMING_SNAKE_CASE     )     )
 def  UpperCAmelCase__						(						self   :			Any   ,				__SCREAMING_SNAKE_CASE   :			Optional[Union[str, torch.device]] = None   ,				__SCREAMING_SNAKE_CASE   :			Optional[torch.dtype] = None   ,				)    ->					List[str]:


      """simple docstring"""




      __SCREAMING_SNAKE_CASE      = nn.Parameter(self.mean.to(__SCREAMING_SNAKE_CASE     ).to(__SCREAMING_SNAKE_CASE     )     )
      __SCREAMING_SNAKE_CASE      = nn.Parameter(self.std.to(__SCREAMING_SNAKE_CASE     ).to(__SCREAMING_SNAKE_CASE     )     )
      return self
 def  UpperCAmelCase__						(						self   :			Optional[Any]   ,				__SCREAMING_SNAKE_CASE   :			Optional[int]     )    ->					Optional[int]:


      """simple docstring"""




      __SCREAMING_SNAKE_CASE      = (embeds - self.mean) * 1.0 / self.std
      return embeds


 def  UpperCAmelCase__						(						self   :			Tuple   ,				__SCREAMING_SNAKE_CASE   :			Any     )    ->					Optional[int]:


      """simple docstring"""




      __SCREAMING_SNAKE_CASE      = (embeds * self.std) + self.mean
      return embeds






