
    Z j                         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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SAM model configuration    )strict   )PreTrainedConfig)auto_docstringzfacebook/sam-vit-huge)
checkpointc                      ^  \ rS rSr% SrSrSr\\S'   Sr	\\
\   -  \\\4   -  \S'   Sr\\
\   -  \\\4   -  \S	'   Sr\\S
'   Sr\\S'   Sr\\S'   Sr\\S'   U 4S jrSrU =r$ )SamPromptEncoderConfig   z
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   > U R                   U R                  -  U l        [        TU ]  " S0 UD6  g N )r   r   image_embedding_sizesuper__post_init__selfkwargs	__class__s     z/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/transformers/models/sam/configuration_sam.pyr   $SamPromptEncoderConfig.__post_init__*   s(    $(OOt$F!''    )r   )__name__
__module____qualname____firstlineno____doc__base_config_keyr   int__annotations__r   listtupler   r   r   r   strr   floatr   __static_attributes____classcell__r"   s   @r#   r	   r	      s     .OK48Jd3i%S/1846Jd3i%S/16!! !#!J NE ( (r%   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g)SamMaskDecoderConfig/   a  
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   r   N)r&   r'   r(   r)   r*   r+   r   r,   r-   r   r0   r:   r<   r>   r?   r@   rA   rB   r   r1   r2   r   r%   r#   r6   r6   /   sw     ,OKJGSs  %&s&!"3"NC"" NE r%   r6   c                     ^  \ rS 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\\\   -  \\\4   -  \	S'   Sr\\\   -  \\\4   -  \	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#4   -  \	S$'   S%r\\	S&'   S'r \S'-  \	S('   U 4S) jr!S*r"U =r#$ )+SamVisionConfigM   a  
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   r<   r>   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)r;      r=      .global_attn_indexes   num_pos_featsNr:   c                    > U R                   c"  [        U R                  U R                  -  5      OU R                   U l         U R                  S-  U l        [
        TU ]  " S0 UD6  g )Nr;   r   )r:   r,   r   rN   scaler   r   r   s     r#   r   SamVisionConfig.__post_init__   sR    AEAUs4++dnn<=[_[g[g%%*
''r%   )r:   rY   )$r&   r'   r(   r)   r*   r+   
model_typer   r,   r-   rH   r<   r>   rJ   r   r.   r/   r   r   r0   r   r1   rK   rL   rM   boolrN   rO   rP   rR   rU   rW   r:   r   r2   r3   r4   s   @r#   rD   rD   M   s%   B &O#JKOSs!!L#48Jd3i%S/1846Jd3i%S/16J!NE!%(us{($u$HdIuKKK7DcU38_4DM3GS4Z( (r%   rD   c                      ^  \ rS rSr% SrSr\\\S.r	Sr
\\-  S-  \S'   Sr\\-  S-  \S'   Sr\\-  S-  \S'   S	r\\S
'   Sr\\S'   U 4S jrSrU =r$ )	SamConfig   a  
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   r8   rF   NrF   r   r8   g{Gz?rL   Ttie_word_embeddingsc                 *  > [        U R                  [        5      (       a  [        S0 U R                  D6U l        OU R                  c  [        5       U l        [        U R                  [        5      (       a  [        S0 U R                  D6U l        OU R                  c  [        5       U l        [        U R                  [        5      (       a  [        S0 U R                  D6U l        OU R                  c  [        5       U l        [        TU ]$  " S0 UD6  g r   )

isinstancerF   dictrD   r   r	   r8   r6   r   r   r   s     r#   r   SamConfig.__post_init__   s    d(($//!0!F43E3E!FD'!0!2Dd00$77)?)]$B\B\)]D&''/)?)AD&d..55';'Wd>V>V'WD$%%-';'=D$''r%   )r8   r   rF   )r&   r'   r(   r)   r*   r[   r	   r6   rD   sub_configsrF   rd   r   r-   r   r8   rL   r1   ra   r\   r   r2   r3   r4   s   @r#   r^   r^      s    !F J!73(K 59M4**T18<@4"22T9@:> 0047>#u# $$( (r%   r^   )r^   r6   r	   rD   N)r*   huggingface_hub.dataclassesr   configuration_utilsr   utilsr   r	   r6   rD   r^   __all__r   r%   r#   <module>rk      s     . 3 # 23(- (  4(. 23!+ !  4!8 23<(& <(  4<(~ 23A(  A(  4A(H ]r%   