§
    ‚Štj  ã                   óv  — d Z ddlmZ ddlmZ ddlmZ  ed¬¦  «        e G d„ d	e¦  «        ¦   «         ¦   «         Z ed¬¦  «        e G d
„ de¦  «        ¦   «         ¦   «         Z ed¬¦  «        e G d„ de¦  «        ¦   «         ¦   «         Z	 ed¬¦  «        e G d„ de¦  «        ¦   «         ¦   «         Z
g d¢ZdS )zSAM model configurationé    )Ústricté   )ÚPreTrainedConfig)Úauto_docstringzfacebook/sam-vit-huge)Ú
checkpointc                   óÚ   ‡ — e Zd ZU dZdZdZeed<   dZee	e         z  e
eef         z  ed<   dZee	e         z  e
eef         z  ed<   dZeed	<   d
Zeed<   dZeed<   dZeed<   ˆ fd„Zˆ xZS )ÚSamPromptEncoderConfigzø
    mask_input_channels (`int`, *optional*, defaults to 16):
        The number of channels to be fed to the `MaskDecoder` module.
    num_point_embeddings (`int`, *optional*, defaults to 4):
        The number of point embeddings to be used.
    Úprompt_encoder_configé   Úhidden_sizeé   Ú
image_sizeé   Ú
patch_sizeÚmask_input_channelsé   Únum_point_embeddingsÚgeluÚ
hidden_actç�íµ ÷Æ°>Úlayer_norm_epsc                 ób   •— | j         | j        z  | _         t          ¦   «         j        di |¤Ž d S ©N© )r   r   Úimage_embedding_sizeÚsuperÚ__post_init__©ÚselfÚkwargsÚ	__class__s     €úg/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/transformers/models/sam/configuration_sam.pyr   z$SamPromptEncoderConfig.__post_init__*   s7   ø€ Ø$(¤O°t´Ñ$FˆÔ!Ø�‰ŒÔÐ'Ð' Ð'Ð'Ð'Ð'Ð'ó    )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úbase_config_keyr   ÚintÚ__annotations__r   ÚlistÚtupler   r   r   r   Ústrr   Úfloatr   Ú__classcell__©r!   s   @r"   r	   r	      sç   ø€ € € € € € ðð ð .€Oà€K�ÐÐÑØ48€J��d˜3”i‘ %¨¨S¨¤/Ñ1Ð8Ð8Ñ8Ø46€J��d˜3”i‘ %¨¨S¨¤/Ñ1Ð6Ð6Ñ6Ø!Ð˜Ð!Ð!Ñ!Ø !Ð˜#Ð!Ð!Ñ!Ø€J�ÐÐÑØ €N�EÐ Ð Ñ ð(ð (ð (ð (ð (ð (ð (ð (ð (r#   r	   c                   ó¤   — 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d<   dZeed<   dZeed<   dZeed<   dS )ÚSamMaskDecoderConfigaµ  
    mlp_dim (`int`, *optional*, defaults to 2048):
        Dimensionality of the "intermediate" (i.e., feed-forward) layer in the Transformer encoder.
    attention_downsample_rate (`int`, *optional*, defaults to 2):
        The downsampling rate of the attention layer.
    num_multimask_outputs (`int`, *optional*, defaults to 3):
        The number of outputs from the `SamMaskDecoder` module. In the Segment Anything paper, this is set to 3.
    iou_head_depth (`int`, *optional*, defaults to 3):
        The number of layers in the IoU head module.
    iou_head_hidden_dim (`int`, *optional*, defaults to 256):
        The dimensionality of the hidden states in the IoU head module.
    Úmask_decoder_configr   r   Úrelur   i   Úmlp_dimé   Únum_hidden_layersé   Únum_attention_headsÚattention_downsample_rater   Únum_multimask_outputsÚiou_head_depthÚiou_head_hidden_dimr   r   N)r$   r%   r&   r'   r(   r   r)   r*   r   r-   r5   r7   r9   r:   r;   r<   r=   r   r.   r   r#   r"   r2   r2   /   sÈ   € € € € € € ðð ð ,€Oà€K�ÐÐÑØ€J�ÐÐÑØ€GˆSÐÐÑØÐ�sÐÐÑØ Ð˜Ð Ð Ñ Ø%&Ð˜sÐ&Ð&Ñ&Ø!"Ð˜3Ð"Ð"Ñ"Ø€N�CÐÐÑØ"Ð˜Ð"Ð"Ñ"Ø €N�EÐ Ð Ñ Ð Ð r#   r2   c                   ó´  ‡ — e Zd ZU dZ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e         z  eeef         z  ed<   dZeee         z  eeef         z  ed<   dZeed<   dZe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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d&z  ed'<   ˆ fd(„Z ˆ xZ!S ))ÚSamVisionConfigaé  
    output_channels (`int`, *optional*, defaults to 256):
        Dimensionality of the output channels in the Patch Encoder.
    use_rel_pos (`bool`, *optional*, defaults to `True`):
        Whether to use relative position embedding.
    window_size (`int`, *optional*, defaults to 14):
        Window size for relative position.
    global_attn_indexes (`list[int]`, *optional*, defaults to `[2, 5, 8, 11]`):
        The indexes of the global attention layers.
    num_pos_feats (`int`, *optional*, defaults to 128):
        The dimensionality of the position embedding.
    mlp_dim (`int`, *optional*):
        The dimensionality of the MLP layer in the Transformer encoder. If `None`, defaults to `mlp_ratio *
        hidden_size`.

    Example:

    ```python
    >>> from transformers import (
    ...     SamVisionConfig,
    ...     SamVisionModel,
    ... )

    >>> # Initializing a SamVisionConfig with `"facebook/sam-vit-huge"` style configuration
    >>> configuration = SamVisionConfig()

    >>> # Initializing a SamVisionModel (with random weights) from the `"facebook/sam-vit-huge"` style configuration
    >>> model = SamVisionModel(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```Úvision_configÚsam_vision_modeli   r   r   Úoutput_channelsé   r7   r9   r   Únum_channelsr   r   r   r   r   r   r   r   g        Úattention_dropoutg»½×Ùß|Û=Úinitializer_rangeTÚqkv_biasg      @Ú	mlp_ratioÚuse_abs_posÚuse_rel_posé   Úwindow_size)r6   é   r8   é   .Úglobal_attn_indexesé€   Únum_pos_featsNr5   c                 ó¶   •— | j         €t          | j        | j        z  ¦  «        n| j         | _         | j        dz  | _         t          ¦   «         j        di |¤Ž d S )Nr6   r   )r5   r)   r   rH   Úscaler   r   r   s     €r"   r   zSamVisionConfig.__post_init__ˆ   s^   ø€ ØAEÄÐAU•s˜4Ô+¨d¬nÑ<Ñ=Ô=Ð=Ð[_Ô[gˆŒØÔ%¨Ñ*ˆŒ
Ø�‰ŒÔÐ'Ð' Ð'Ð'Ð'Ð'Ð'r#   )"r$   r%   r&   r'   r(   Ú
model_typer   r)   r*   rB   r7   r9   rD   r   r+   r,   r   r   r-   r   r.   rE   rF   rG   ÚboolrH   rI   rJ   rL   rO   rQ   r5   r   r/   r0   s   @r"   r?   r?   M   sÉ  ø€ € € € € € ðð ðB &€OØ#€Jà€K�ÐÐÑØ€O�SÐÐÑØÐ�sÐÐÑØ!Ð˜Ð!Ð!Ñ!Ø€L�#ÐÐÑØ48€J��d˜3”i‘ %¨¨S¨¤/Ñ1Ð8Ð8Ñ8Ø46€J��d˜3”i‘ %¨¨S¨¤/Ñ1Ð6Ð6Ñ6Ø€J�ÐÐÑØ!€N�EÐ!Ð!Ñ!Ø%(Ð�u˜s‘{Ð(Ð(Ñ(Ø$Ð�uÐ$Ð$Ñ$Ø€HˆdÐÐÑØ€IˆuÐÐÑØ€K�ÐÐÑØ€K�ÐÐÑØ€K�ÐÐÑØ7DÐ˜˜cœ U¨3°¨8¤_Ñ4ÐDÐDÑDØ€M�3ÐÐÑØ€GˆS�4‰ZÐÐÑð(ð (ð (ð (ð (ð (ð (ð (ð (r#   r?   c                   óž   ‡ — e Zd ZU dZdZeeedœZdZ	e
ez  dz  ed<   dZe
ez  dz  ed<   dZe
ez  dz  ed<   dZeed	<   d
Zeed<   ˆ fd„Zˆ xZS )Ú	SamConfiga;  
    prompt_encoder_config (Union[`dict`, `SamPromptEncoderConfig`], *optional*):
        Dictionary of configuration options used to initialize [`SamPromptEncoderConfig`].
    mask_decoder_config (Union[`dict`, `SamMaskDecoderConfig`], *optional*):
        Dictionary of configuration options used to initialize [`SamMaskDecoderConfig`].

    Example:

    ```python
    >>> from transformers import (
    ...     SamVisionConfig,
    ...     SamPromptEncoderConfig,
    ...     SamMaskDecoderConfig,
    ...     SamModel,
    ... )

    >>> # Initializing a SamConfig with `"facebook/sam-vit-huge"` style configuration
    >>> configuration = SamConfig()

    >>> # Initializing a SamModel (with random weights) from the `"facebook/sam-vit-huge"` style configuration
    >>> model = SamModel(configuration)

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

    >>> # We can also initialize a SamConfig from a SamVisionConfig, SamPromptEncoderConfig, and SamMaskDecoderConfig

    >>> # Initializing SAM vision, SAM Q-Former and language model configurations
    >>> vision_config = SamVisionConfig()
    >>> prompt_encoder_config = SamPromptEncoderConfig()
    >>> mask_decoder_config = SamMaskDecoderConfig()

    >>> config = SamConfig(vision_config, prompt_encoder_config, mask_decoder_config)
    ```Úsam)r
   r3   r@   Nr@   r
   r3   g{®Gáz”?rF   TÚtie_word_embeddingsc                 óü  •— t          | j        t          ¦  «        rt          di | j        ¤Ž| _        n| j        €t          ¦   «         | _        t          | j        t          ¦  «        rt          di | j        ¤Ž| _        n| j        €t          ¦   «         | _        t          | j        t          ¦  «        rt          di | j        ¤Ž| _        n| j        €t          ¦   «         | _         t          ¦   «         j	        di |¤Ž d S r   )
Ú
isinstancer@   Údictr?   r
   r	   r3   r2   r   r   r   s     €r"   r   zSamConfig.__post_init__Á   sÿ   ø€ Ý�dÔ(­$Ñ/Ô/ð 	3Ý!0Ð!FÐ!F°4Ô3EÐ!FÐ!FˆDÔÐØÔÐ'Ý!0Ñ!2Ô!2ˆDÔå�dÔ0µ$Ñ7Ô7ð 	BÝ)?Ð)]Ð)]À$ÔB\Ð)]Ð)]ˆDÔ&Ð&ØÔ'Ð/Ý)?Ñ)AÔ)AˆDÔ&å�dÔ.µÑ5Ô5ð 	>Ý';Ð'WÐ'W¸dÔ>VÐ'WÐ'WˆDÔ$Ð$ØÔ%Ð-Ý';Ñ'=Ô'=ˆDÔ$à�‰ŒÔÐ'Ð' Ð'Ð'Ð'Ð'Ð'r#   )r$   r%   r&   r'   rT   r	   r2   r?   Úsub_configsr@   r\   r   r*   r
   r3   rF   r.   rY   rU   r   r/   r0   s   @r"   rW   rW   Ž   sØ   ø€ € € € € € ð!ð !ðF €Jà!7Ø3Ø(ðð €Kð 59€M�4Ð*Ñ*¨TÑ1Ð8Ð8Ñ8Ø<@Ð˜4Ð"2Ñ2°TÑ9Ð@Ð@Ñ@Ø:>Ð˜Ð 0Ñ0°4Ñ7Ð>Ð>Ñ>Ø#Ð�uÐ#Ð#Ñ#Ø $Ð˜Ð$Ð$Ñ$ð(ð (ð (ð (ð (ð (ð (ð (ð (r#   rW   )rW   r2   r	   r?   N)r'   Úhuggingface_hub.dataclassesr   Úconfiguration_utilsr   Úutilsr   r	   r2   r?   rW   Ú__all__r   r#   r"   ú<module>rb      sŸ  ðð Ð à .Ð .Ð .Ð .Ð .Ð .à 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø #Ð #Ð #Ð #Ð #Ð #ð €Ð2Ð3Ñ3Ô3Øð(ð (ð (ð (ð (Ð-ñ (ô (ñ „ñ 4Ô3ð(ð. €Ð2Ð3Ñ3Ô3Øð!ð !ð !ð !ð !Ð+ñ !ô !ñ „ñ 4Ô3ð!ð8 €Ð2Ð3Ñ3Ô3Øð<(ð <(ð <(ð <(ð <(Ð&ñ <(ô <(ñ „ñ 4Ô3ð<(ð~ €Ð2Ð3Ñ3Ô3ØðA(ð A(ð A(ð A(ð A(Ð ñ A(ô A(ñ „ñ 4Ô3ðA(ðH ]Ð
\Ð
\€€€r#   