§
    ‚Štj—  ã                   ó¤   — d Z ddlmZ ddlmZ ddlmZmZ  e¦   «         rddlZ ed¬¦  «        e G d	„ d
e¦  «        ¦   «         ¦   «         Z	d
gZ
dS )zLayoutLMv2 model configurationé    )Ústricté   )ÚPreTrainedConfig)Úauto_docstringÚis_detectron2_availableNz!microsoft/layoutlmv2-base-uncased)Ú
checkpointc                   óø  ‡ — e Zd ZU dZdZdZeed<   dZeed<   dZ	eed<   dZ
eed	<   d
Zeed<   dZeed<   dZeez  ed<   dZeez  ed<   dZeed<   dZeed<   dZeed<   dZeed<   dZedz  ed<   dZeed<   dZeed<   d Zeed!<   d"Zeed#<   d$Zeed%<   d&Zeed'<   d"Zeed(<   d)Zee         e ed*f         z  ed+<   dZ!eed,<   dZ"eed-<   d"Z#eed.<   d"Z$eed/<   d0Z%eed1<   dZ&e'dz  ed2<   ˆ fd3„Z(e)d4„ ¦   «         Z*d5„ Z+ˆ xZ,S )6ÚLayoutLMv2Configaº
  
    max_2d_position_embeddings (`int`, *optional*, defaults to 1024):
        The maximum value that the 2D position embedding might ever be used with. Typically set this to something
        large just in case (e.g., 1024).
    max_rel_pos (`int`, *optional*, defaults to 128):
        The maximum number of relative positions to be used in the self-attention mechanism.
    rel_pos_bins (`int`, *optional*, defaults to 32):
        The number of relative position bins to be used in the self-attention mechanism.
    fast_qkv (`bool`, *optional*, defaults to `True`):
        Whether or not to use a single matrix for the queries, keys, values in the self-attention layers.
    max_rel_2d_pos (`int`, *optional*, defaults to 256):
        The maximum number of relative 2D positions in the self-attention mechanism.
    rel_2d_pos_bins (`int`, *optional*, defaults to 64):
        The number of 2D relative position bins in the self-attention mechanism.
    convert_sync_batchnorm (`bool`, *optional*, defaults to `True`):
        Whether or not to convert batch normalization layers to synchronized batch normalization layers.
    image_feature_pool_shape (`list[int]`, *optional*, defaults to `[7, 7, 256]`):
        The shape of the average-pooled feature map.
    coordinate_size (`int`, *optional*, defaults to 128):
        Dimension of the coordinate embeddings.
    shape_size (`int`, *optional*, defaults to 128):
        Dimension of the width and height embeddings.
    has_relative_attention_bias (`bool`, *optional*, defaults to `True`):
        Whether or not to use a relative attention bias in the self-attention mechanism.
    has_spatial_attention_bias (`bool`, *optional*, defaults to `True`):
        Whether or not to use a spatial attention bias in the self-attention mechanism.
    has_visual_segment_embedding (`bool`, *optional*, defaults to `False`):
        Whether or not to add visual segment embeddings.
    detectron2_config_args (`dict`, *optional*):
        Dictionary containing the configuration arguments of the Detectron2 visual backbone. Refer to [this
        file](https://github.com/microsoft/unilm/blob/master/layoutlmft/layoutlmft/models/layoutlmv2/detectron2_config.py)
        for details regarding default values.

    Example:

    ```python
    >>> from transformers import LayoutLMv2Config, LayoutLMv2Model

    >>> # Initializing a LayoutLMv2 microsoft/layoutlmv2-base-uncased style configuration
    >>> configuration = LayoutLMv2Config()

    >>> # Initializing a model (with random weights) from the microsoft/layoutlmv2-base-uncased style configuration
    >>> model = LayoutLMv2Model(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```Ú
layoutlmv2i:w  Ú
vocab_sizei   Úhidden_sizeé   Únum_hidden_layersÚnum_attention_headsi   Úintermediate_sizeÚgeluÚ
hidden_actgš™™™™™¹?Úhidden_dropout_probÚattention_probs_dropout_probé   Úmax_position_embeddingsé   Útype_vocab_sizeg{®Gáz”?Úinitializer_rangegê-�™—q=Úlayer_norm_epsr   NÚpad_token_idi   Úmax_2d_position_embeddingsé€   Úmax_rel_posé    Úrel_pos_binsTÚfast_qkvé   Úmax_rel_2d_posé@   Úrel_2d_pos_binsÚconvert_sync_batchnorm)é   r(   r#   .Úimage_feature_pool_shapeÚcoordinate_sizeÚ
shape_sizeÚhas_relative_attention_biasÚhas_spatial_attention_biasFÚhas_visual_segment_embeddingÚdetectron2_config_argsc                 óˆ   •—  t          ¦   «         j        di |¤Ž | j        �| j        n|                      ¦   «         | _        d S )N© )ÚsuperÚ__post_init__r/   Úget_default_detectron2_config)ÚselfÚkwargsÚ	__class__s     €úu/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/transformers/models/layoutlmv2/configuration_layoutlmv2.pyr3   zLayoutLMv2Config.__post_init__l   sS   ø€ Ø�‰ŒÔÐ'Ð' Ð'Ð'Ð'ð Ô*Ð6ð Ô'Ð'à×3Ò3Ñ5Ô5ð 	Ô#Ð#Ð#ó    c                 óÆ   — i dd“dg d¢“dd“dg d¢“d	d
gdgdgdgdgg“dg d¢“dd“dd“dd“dd“dd“dd“dg d¢“dd“dd “d!d"“d#d$“d%d&d'd
gdgdgdgdggg d(¢gg d¢d
d)d*d+œ	¥S ),NzMODEL.MASK_ONTzMODEL.PIXEL_STD)g     °L@g�Âõ(\�L@gÃõ(\�2M@zMODEL.BACKBONE.NAMEÚbuild_resnet_fpn_backbonezMODEL.FPN.IN_FEATURES)Úres2Úres3Úres4Úres5zMODEL.ANCHOR_GENERATOR.SIZESr    r%   r   r#   r   zMODEL.RPN.IN_FEATURES)Úp2Úp3Úp4Úp5Úp6zMODEL.RPN.PRE_NMS_TOPK_TRAINiÐ  zMODEL.RPN.PRE_NMS_TOPK_TESTiè  zMODEL.RPN.POST_NMS_TOPK_TRAINzMODEL.POST_NMS_TOPK_TESTzMODEL.ROI_HEADS.NAMEÚStandardROIHeadszMODEL.ROI_HEADS.NUM_CLASSESé   zMODEL.ROI_HEADS.IN_FEATURES)r@   rA   rB   rC   zMODEL.ROI_BOX_HEAD.NAMEÚFastRCNNConvFCHeadzMODEL.ROI_BOX_HEAD.NUM_FCr   z$MODEL.ROI_BOX_HEAD.POOLER_RESOLUTIONé   zMODEL.ROI_MASK_HEAD.NAMEÚMaskRCNNConvUpsampleHeadé   r(   ée   )g      à?g      ð?g       @é   F)	zMODEL.ROI_MASK_HEAD.NUM_CONVz%MODEL.ROI_MASK_HEAD.POOLER_RESOLUTIONzMODEL.RESNETS.DEPTHzMODEL.RESNETS.SIZESzMODEL.RESNETS.ASPECT_RATIOSzMODEL.RESNETS.OUT_FEATURESzMODEL.RESNETS.NUM_GROUPSzMODEL.RESNETS.WIDTH_PER_GROUPzMODEL.RESNETS.STRIDE_IN_1X1r1   )Úclss    r8   r4   z.LayoutLMv2Config.get_default_detectron2_configt   sW  € ð
Ø˜Tð
àÐ7Ð7Ð7ð
ð "Ð#>ð
ð $Ð%EÐ%EÐ%Eð	
ð
 +¨b¨T°B°4¸#¸ÀÀÈÀuÐ,Mð
ð $Ð%CÐ%CÐ%Cð
ð +¨Dð
ð *¨4ð
ð ,¨Tð
ð '¨ð
ð #Ð$6ð
ð *¨1ð
ð *Ð+CÐ+CÐ+Cð
ð &Ð';ð
ð (¨ð
ð  3°Bð!
ð" 'Ð(Bð#
ð$ -.Ø56Ø#&Ø%' D¨2¨$°°¸°u¸s¸eÐ#DØ,;¨O¨OÐ+<Ø*JÐ*JÐ*JØ(*Ø-.Ø+0ð5
ð 
ð 
ð 	
r9   c                 ó  — t           j                             ¦   «         }| j                             ¦   «         D ]P\  }}|                     d¦  «        }|}|d d…         D ]}t          ||¦  «        }Œt          ||d         |¦  «         ŒQ|S )Nú.éÿÿÿÿ)Ú
detectron2ÚconfigÚget_cfgr/   ÚitemsÚsplitÚgetattrÚsetattr)r5   Údetectron2_configÚkÚvÚ
attributesÚto_setÚ	attributes          r8   Úget_detectron2_configz&LayoutLMv2Config.get_detectron2_config“   s”   € Ý&Ô-×5Ò5Ñ7Ô7ÐØÔ/×5Ò5Ñ7Ô7ð 	/ð 	/‰DˆAˆqØŸš ™œˆJØ&ˆFØ'¨¨¨œ_ð 4ð 4�	Ý  ¨Ñ3Ô3��Ý�F˜J rœN¨AÑ.Ô.Ð.Ð.à Ð r9   )-Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
model_typer   ÚintÚ__annotations__r   r   r   r   r   Ústrr   Úfloatr   r   r   r   r   r   r   r   r!   r"   Úboolr$   r&   r'   r)   ÚlistÚtupler*   r+   r,   r-   r.   r/   Údictr3   Úclassmethodr4   r^   Ú__classcell__)r7   s   @r8   r
   r
      sU  ø€ € € € € € ð.ð .ð` €Jà€J�ÐÐÑØ€K�ÐÐÑØÐ�sÐÐÑØ!Ð˜Ð!Ð!Ñ!Ø!Ð�sÐ!Ð!Ñ!Ø€J�ÐÐÑØ'*Ð˜ ™Ð*Ð*Ñ*Ø03Ð  %¨#¡+Ð3Ð3Ñ3Ø#&Ð˜SÐ&Ð&Ñ&Ø€O�SÐÐÑØ#Ð�uÐ#Ð#Ñ#Ø!€N�EÐ!Ð!Ñ!Ø €L�#˜‘*Ð Ð Ñ Ø&*Ð Ð*Ð*Ñ*Ø€K�ÐÐÑØ€L�#ÐÐÑØ€HˆdÐÐÑØ€N�CÐÐÑØ€O�SÐÐÑØ#'Ð˜DÐ'Ð'Ñ'Ø<GÐ˜d 3œi¨%°°S°¬/Ñ9ÐGÐGÑGØ€O�SÐÐÑØ€J�ÐÐÑØ(,Ð Ð,Ð,Ñ,Ø'+Ð Ð+Ð+Ñ+Ø).Ð  $Ð.Ð.Ñ.Ø*.Ð˜D 4™KÐ.Ð.Ñ.ð
ð 
ð 
ð 
ð 
ð ð
ð 
ñ „[ð
ð<	!ð 	!ð 	!ð 	!ð 	!ð 	!ð 	!r9   r
   )rb   Úhuggingface_hub.dataclassesr   Úconfiguration_utilsr   Úutilsr   r   rQ   r
   Ú__all__r1   r9   r8   ú<module>rr      sÐ   ðð %Ð $à .Ð .Ð .Ð .Ð .Ð .à 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø <Ð <Ð <Ð <Ð <Ð <Ð <Ð <ð ÐÑÔð ØÐÐÐð €Ð>Ð?Ñ?Ô?Øð!ð !ð !ð !ð !Ð'ñ !ô !ñ „ñ @Ô?ð!ðD Ð
€€€r9   