ó
    qyüi£   ã                   óò   • S r SSKJr  SSKJr  SSKJrJr  \R                  " \	5      r
\" SS9\ " S S	\5      5       5       r\" SS9\ " S
 S\5      5       5       r\" SS9\ " S S\5      5       5       r/ SQrg)zPix2Struct model configurationé    )Ústricté   )ÚPreTrainedConfig)Úauto_docstringÚloggingzgoogle/pix2struct-base)Ú
checkpointc                   ót  • \ rS rSr% SrSrS/rSSSSSSS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'   Sr\\
S'   Sr\\
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"g!)+ÚPix2StructTextConfigé   an  
relative_attention_num_buckets (`int`, *optional*, defaults to 32):
    The number of buckets to use for each attention layer.
relative_attention_max_distance (`int`, *optional*, defaults to 128):
    The maximum distance of the longer sequences for the bucket separation.
dense_act_fn (`Union[Callable, str]`, *optional*, defaults to `"gelu_new"`):
    The non-linear activation function (function or string).

Example:

```python
>>> from transformers import Pix2StructTextConfig, Pix2StructTextModel

>>> # Initializing a Pix2StructTextConfig with google/pix2struct-base style configuration
>>> configuration = Pix2StructTextConfig()

>>> # Initializing a Pix2StructTextModel (with random weights) from the google/pix2struct-base style configuration
>>> model = Pix2StructTextModel(configuration)

>>> # Accessing the model configuration
>>> configuration = model.config
```Úpix2struct_text_modelÚpast_key_valuesÚhidden_sizeÚ	num_headsÚ
num_layers)r   Únum_attention_headsÚnum_hidden_layersÚdecoder_attention_headsÚencoder_attention_headsÚencoder_layersÚdecoder_layersiDÄ  Ú
vocab_sizeé   é@   Úd_kvé   Úd_ffé   é    Úrelative_attention_num_bucketsé€   Úrelative_attention_max_distancegš™™™™™¹?Údropout_rateç�íµ ÷Æ°>Úlayer_norm_epsilonç      ð?Úinitializer_factorÚgelu_newÚdense_act_fnr   Údecoder_start_token_idFÚ	use_cacheNÚpad_token_idé   Úeos_token_idÚbos_token_idÚtie_word_embeddingsTÚ
is_decoderÚadd_cross_attention© )#Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú
model_typeÚkeys_to_ignore_at_inferenceÚattribute_mapr   ÚintÚ__annotations__r   r   r   r   r   r   r!   r"   Úfloatr$   r&   r(   Ústrr)   r*   Úboolr+   r-   Úlistr.   r/   r0   r1   Ú__static_attributes__r2   ó    Út/home/mande/repo/quber/.venv/lib/python3.13/site-packages/transformers/models/pix2struct/configuration_pix2struct.pyr
   r
      s  ‡ ñð. )€JØ#4Ð"5Ðà$Ø*Ø)Ø#.Ø#.Ø&Ø&ñ€Mð €J�ÓØ€K�ÓØ€Dˆ#ƒNØ€Dˆ#ÓØ€J�ÓØ€IˆsÓØ*,Ð" CÓ,Ø+.Ð# SÓ.Ø #€L�%˜#‘+Ó#Ø $Ð˜Ó$Ø #Ð˜Ó#Ø"€L�#Ó"Ø"#Ð˜CÓ#Ø€IˆtÓØ €L�#˜‘*Ó Ø+,€L�#˜˜S™	‘/ DÑ(Ó,Ø#€L�#˜‘*Ó#Ø %Ð˜Ó%Ø€J�ÓØ %Ð˜Ö%rB   r
   c                   óü   • \ 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'   Sr\\S'   Sr\\S'   Sr\\S'   Sr\\S'   Sr\\S'   Srg )!ÚPix2StructVisionConfigéU   a*  
patch_embed_hidden_size (`int`, *optional*, defaults to 768):
    Dimensionality of the input patch_embedding layer in the Transformer encoder.
d_ff (`int`, *optional*, defaults to 2048):
    Dimensionality of the "intermediate" (i.e., feed-forward) layer in the Transformer encoder.
d_kv (`int`, *optional*, defaults to 64):
    Dimensionality of the key, query, value projections per attention head.
The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
    `"relu"`, `"selu"` and `"gelu_new"` `"gelu"` are supported.
dense_act_fn (`Union[Callable, str]`, *optional*, defaults to `"gelu_new"`):
    The non-linear activation function (function or string).
seq_len (`int`, *optional*, defaults to 4096):
    Maximum sequence length (here number of patches) supported by the model.
relative_attention_num_buckets (`int`, *optional*, defaults to 32):
    The number of buckets to use for each attention layer.
relative_attention_max_distance (`int`, *optional*, defaults to 128):
    The maximum distance (in tokens) to use for each attention layer.

Example:

```python
>>> from transformers import Pix2StructVisionConfig, Pix2StructVisionModel

>>> # Initializing a Pix2StructVisionConfig with google/pix2struct-base style configuration
>>> configuration = Pix2StructVisionConfig()

>>> # Initializing a Pix2StructVisionModel (with random weights) from the google/pix2struct-base style configuration
>>> model = Pix2StructVisionModel(configuration)

>>> # Accessing the model configuration
>>> configuration = model.config
```Úpix2struct_vision_modelr   r   Úpatch_embed_hidden_sizer   r   r   r   r   r   r   r'   r(   r#   Úlayer_norm_epsg        r"   Úattention_dropoutg»½×Ùß|Û=Úinitializer_ranger%   r&   i   Úseq_lenr   r   r    r!   r2   N)r3   r4   r5   r6   r7   r8   r   r;   r<   rH   r   r   r   r   r(   r>   rI   r=   r"   rJ   rK   r&   rL   r   r!   rA   r2   rB   rC   rE   rE   U   s´   ‡ ñðB +€Jà€K�ÓØ#&Ð˜SÓ&Ø€Dˆ#ÓØ€Dˆ#ƒNØÐ�sÓØ!Ð˜Ó!Ø"€L�#Ó"Ø €N�EÓ Ø #€L�%˜#‘+Ó#Ø%(Ð�u˜s‘{Ó(Ø$Ð�uÓ$Ø #Ð˜Ó#Ø€GˆSÓØ*,Ð" CÓ,Ø+.Ð# SÖ.rB   rE   c                   ó¶   ^ • \ rS rSr% SrSr\\S.rSr	\
\-  S-  \S'   Sr\
\-  S-  \S'   Sr\\S	'   S
r\\S'   Sr\\S'   Sr\\S'   Sr\\S'   U 4S jrSrU =r$ )ÚPix2StructConfigéŒ   a¿  
is_vqa (`bool`, *optional*, defaults to `False`):
    Whether the model has been fine-tuned for VQA or not.

Example:

```python
>>> from transformers import Pix2StructConfig, Pix2StructForConditionalGeneration

>>> # Initializing a Pix2StructConfig with google/pix2struct-base style configuration
>>> configuration = Pix2StructConfig()

>>> # Initializing a Pix2StructForConditionalGeneration (with random weights) from the google/pix2struct-base style configuration
>>> model = Pix2StructForConditionalGeneration(configuration)

>>> # Accessing the model configuration
>>> configuration = model.config

>>> # We can also initialize a Pix2StructConfig from a Pix2StructTextConfig and a Pix2StructVisionConfig

>>> # Initializing a Pix2Struct text and Pix2Struct vision configuration
>>> config_text = Pix2StructTextConfig()
>>> config_vision = Pix2StructVisionConfig()

>>> config = Pix2StructConfig(text_config=config_text, vision_config=config_vision)
```Ú
pix2struct)Útext_configÚvision_configNrQ   rR   r%   r&   g{®Gáz”?rK   FÚis_vqar/   TÚis_encoder_decoderc                 ól  >• U R                   c9  [        U R                  U R                  S9U l         [        R                  S5        Ok[        U R                   [        5      (       aL  U R                  U R                   S'   U R                  U R                   S'   [        S0 U R                   D6U l         U R                  c%  [        5       U l        [        R                  S5        O9[        U R                  [        5      (       a  [        S0 U R                  D6U l        U R                   R                  U l
        U R                   R                  U l        U R                   R                  U l        U R                  U R                   l        U R                  U R                  l        [        TU ]<  " S0 UD6  g )N)rT   r/   zU`text_config` is `None`. initializing the `Pix2StructTextConfig` with default values.rT   r/   zY`vision_config` is `None`. initializing the `Pix2StructVisionConfig` with default values.r2   )rQ   r
   rT   r/   ÚloggerÚinfoÚ
isinstanceÚdictrR   rE   r)   r+   r-   rK   ÚsuperÚ__post_init__)ÚselfÚkwargsÚ	__class__s     €rC   r[   ÚPix2StructConfig.__post_init__µ   sU  ø€ Ø×ÑÑ#Ü3Ø#'×#:Ñ#:Ø$(×$<Ñ$<ñ ˆDÔô �K‰KÐoÕpÜ˜×(Ñ(¬$×/Ñ/Ø59×5LÑ5LˆD×ÑÐ1Ñ2Ø6:×6NÑ6NˆD×ÑÐ2Ñ3Ü3ÑG°d×6FÑ6FÑGˆDÔà×ÑÑ%Ü!7Ó!9ˆDÔÜ�K‰KÐsÕtÜ˜×*Ñ*¬D×1Ñ1Ü!7Ñ!M¸$×:LÑ:LÑ!MˆDÔà&*×&6Ñ&6×&MÑ&MˆÔ#Ø ×,Ñ,×9Ñ9ˆÔØ ×,Ñ,×9Ñ9ˆÔà-1×-CÑ-Cˆ×ÑÔ*Ø/3×/EÑ/Eˆ×ÑÔ,ä‰ÒÑ' Ó'rB   )r)   r-   r+   rQ   rR   )r3   r4   r5   r6   r7   r8   r
   rE   Úsub_configsrQ   rY   r   r<   rR   r&   r=   rK   rS   r?   r/   rT   r[   rA   Ú__classcell__)r^   s   @rC   rN   rN   Œ   s„   ø‡ ñð6 €JØ"6ÐI_Ñ`€Kà26€K�Ð(Ñ(¨4Ñ/Ó6Ø48€M�4Ð*Ñ*¨TÑ1Ó8Ø #Ð˜Ó#Ø#Ð�uÓ#Ø€FˆDÓØ %Ð˜Ó%Ø#Ð˜Ó#÷(ó (rB   rN   )rN   r
   rE   N)r7   Úhuggingface_hub.dataclassesr   Úconfiguration_utilsr   Úutilsr   r   Ú
get_loggerr3   rV   r
   rE   rN   Ú__all__r2   rB   rC   Ú<module>rg      s±   ðñ %å .å 3ß ,ð 
×	Ò	˜HÓ	%€ñ Ð3Ñ4Øô7&Ð+ó 7&ó ó 5ð7&ñt Ð3Ñ4Øô2/Ð-ó 2/ó ó 5ð2/ñj Ð3Ñ4Øô@(Ð'ó @(ó ó 5ð@(òF Q�rB   