
    Z jm                     d    S r SSKJr  SSKJr  SSKJr  \" SS9\ " S S	\5      5       5       rS	/rg
)a[  
TAPAS configuration. Based on the BERT configuration with added parameters.

Hyperparameters are taken from run_task_main.py and hparam_utils.py of the original implementation. URLS:

- https://github.com/google-research/tapas/blob/master/tapas/run_task_main.py
- https://github.com/google-research/tapas/blob/master/tapas/utils/hparam_utils.py

    )strict   )PreTrainedConfig)auto_docstringzgoogle/tapas-base-finetuned-sqa)
checkpointc                     ^  \ rS rSr% SrSrSr\\S'   Sr	\\S'   Sr
\\S	'   Sr\\S
'   Sr\\S'   Sr\\S'   Sr\\-  \S'   Sr\\-  \S'   Sr\\S'   Sr\\   \\S4   -  \S'   Sr\\S'   Sr\\S'   Sr\S-  \S'   Sr\S-  \S'   Sr\\\   -  S-  \S'   S r\\S!'   Sr\\S"'   S#r\\S$'   Sr\S-  \S%'   S#r \\S&'   S'r!\\S('   Sr"\S-  \S)'   S#r#\\S*'   S#r$\\S+'   S'r%\\S,'   S'r&\\S-'   S.r'\\S/'   Sr(\S-  \S0'   Sr)\\-  S-  \S1'   S2r*\\S3'   S4r+\\S5'   S'r,\\S6'   S7r-\\S8'   S'r.\\S9'   S'r/\\S:'   S7r0\\S;'   S'r1\\S<'   Sr2\3S-  \S='   Sr4\S-  \S>'   S'r5\\S?'   S'r6\\S@'   S7r7\\SA'   U 4SB jr8SCr9U =r:$ )DTapasConfig   a  
type_vocab_sizes (`list[int]`, *optional*, defaults to `[3, 256, 256, 2, 256, 256, 10]`):
    The vocabulary sizes of the `token_type_ids` passed when calling [`TapasModel`].
positive_label_weight (`float`, *optional*, defaults to 10.0):
    Weight for positive labels.
num_aggregation_labels (`int`, *optional*, defaults to 0):
    The number of aggregation operators to predict.
aggregation_loss_weight (`float`, *optional*, defaults to 1.0):
    Importance weight for the aggregation loss.
use_answer_as_supervision (`bool`, *optional*):
    Whether to use the answer as the only supervision for aggregation examples.
answer_loss_importance (`float`, *optional*, defaults to 1.0):
    Importance weight for the regression loss.
use_normalized_answer_loss (`bool`, *optional*, defaults to `False`):
    Whether to normalize the answer loss by the maximum of the predicted and expected value.
huber_loss_delta (`float`, *optional*):
    Delta parameter used to calculate the regression loss.
temperature (`float`, *optional*, defaults to 1.0):
    Value used to control (OR change) the skewness of cell logits probabilities.
aggregation_temperature (`float`, *optional*, defaults to 1.0):
    Scales aggregation logits to control the skewness of probabilities.
use_gumbel_for_cells (`bool`, *optional*, defaults to `False`):
    Whether to apply Gumbel-Softmax to cell selection.
use_gumbel_for_aggregation (`bool`, *optional*, defaults to `False`):
    Whether to apply Gumbel-Softmax to aggregation selection.
average_approximation_function (`string`, *optional*, defaults to `"ratio"`):
    Method to calculate the expected average of cells in the weak supervision case. One of `"ratio"`,
    `"first_order"` or `"second_order"`.
cell_selection_preference (`float`, *optional*):
    Preference for cell selection in ambiguous cases. Only applicable in case of weak supervision for
    aggregation (WTQ, WikiSQL). If the total mass of the aggregation probabilities (excluding the "NONE"
    operator) is higher than this hyperparameter, then aggregation is predicted for an example.
answer_loss_cutoff (`float`, *optional*):
    Ignore examples with answer loss larger than cutoff.
max_num_rows (`int`, *optional*, defaults to 64):
    Maximum number of rows.
max_num_columns (`int`, *optional*, defaults to 32):
    Maximum number of columns.
average_logits_per_cell (`bool`, *optional*, defaults to `False`):
    Whether to average logits per cell.
select_one_column (`bool`, *optional*, defaults to `True`):
    Whether to constrain the model to only select cells from a single column.
allow_empty_column_selection (`bool`, *optional*, defaults to `False`):
    Whether to allow not to select any column.
init_cell_selection_weights_to_zero (`bool`, *optional*, defaults to `False`):
    Whether to initialize cell selection weights to 0 so that the initial probabilities are 50%.
reset_position_index_per_cell (`bool`, *optional*, defaults to `True`):
    Whether to restart position indexes at every cell (i.e. use relative position embeddings).
disable_per_token_loss (`bool`, *optional*, defaults to `False`):
    Whether to disable any (strong or weak) supervision on cells.
aggregation_labels (`dict[int, label]`, *optional*):
    The aggregation labels used to aggregate the results. For example, the WTQ models have the following
    aggregation labels: `{0: "NONE", 1: "SUM", 2: "AVERAGE", 3: "COUNT"}`
no_aggregation_label_index (`int`, *optional*):
    If the aggregation labels are defined and one of these labels represents "No aggregation", this should be
    set to its index. For example, the WTQ models have the "NONE" aggregation label at index 0, so that value
    should be set to 0 for these models.

Example:

```python
>>> from transformers import TapasModel, TapasConfig

>>> # Initializing a default (SQA) Tapas configuration
>>> configuration = TapasConfig()
>>> # Initializing a model from the configuration
>>> model = TapasModel(configuration)
>>> # Accessing the model configuration
>>> configuration = model.config
```tapasi:w  
vocab_sizei   hidden_size   num_hidden_layersnum_attention_headsi   intermediate_sizegelu
hidden_actg?hidden_dropout_probattention_probs_dropout_probi   max_position_embeddings)r      r      r   r   
   .type_vocab_sizesg{Gz?initializer_rangeg-q=layer_norm_epsr   Npad_token_idbos_token_ideos_token_idg      $@positive_label_weightnum_aggregation_labelsg      ?aggregation_loss_weightuse_answer_as_supervisionanswer_loss_importanceFuse_normalized_answer_losshuber_loss_deltatemperatureaggregation_temperatureuse_gumbel_for_cellsuse_gumbel_for_aggregationratioaverage_approximation_functioncell_selection_preferenceanswer_loss_cutoff@   max_num_rows    max_num_columnsaverage_logits_per_cellTselect_one_columnallow_empty_column_selection#init_cell_selection_weights_to_zeroreset_position_index_per_celldisable_per_token_lossaggregation_labelsno_aggregation_label_index
is_decoderadd_cross_attentiontie_word_embeddingsc                    > [        U R                  [        5      (       a>  U R                  R                  5        VVs0 s H  u  p#[	        U5      U_M     snnU l        [
        TU ]  " S0 UD6  g s  snnf )N )
isinstancer9   dictitemsintsuper__post_init__)selfkwargskv	__class__s       ~/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/transformers/models/tapas/configuration_tapas.pyrE   TapasConfig.__post_init__   s^    d--t44=A=T=T=Z=Z=\&]=\TQs1vqy=\&]D#'' '^s   A0)r9   );__name__
__module____qualname____firstlineno____doc__
model_typer   rC   __annotations__r   r   r   r   r   strr   floatr   r   r   listtupler   r   r   r   r   r    r!   r"   r#   boolr$   r%   r&   r'   r(   r)   r*   r,   r-   r.   r0   r2   r3   r4   r5   r6   r7   r8   r9   rA   r:   r;   r<   r=   rE   __static_attributes____classcell__)rJ   s   @rK   r	   r	      s)   EN JJKs!!!s!J'**03 %#+3#'S'4Rd3i%S/1R#u#!NE! L#* #L#*#+/L#S	/D(/#'5'"#C#%(U(-1td{1$'E'',,%)edl)K%(U(!&$&',,*1"C1.2ut|2-1d*1L#OS$)T)"t"). $.05'5*.!4.#(D(&*t*-1d
1J %% $$( (    r	   N)	rQ   huggingface_hub.dataclassesr   configuration_utilsr   utilsr   r	   __all__r?   r[   rK   <module>r`      sL    / 3 # <=x(" x(  >x(v /r[   