+
    œ°³j‡4  ã                   ó°   € ^ RI Ht ^RIHt ^RIHt ^RIHt ]! RR7      ] ! R R]4      4       4       t]! R	R7      ] ! R
 R]]4      4       4       t	RR.t
R# )é    )Ústrict)ÚBackboneConfigMixin)ÚPreTrainedConfig)Úauto_docstringzfacebook/sapiens2-seg-0.4b)Ú
checkpointc                   óŒ   a a€ ] tR t^t oRtRtRtRtRt^t	Rt
RtRt^tRtRt^tRtRtV 3R ltV3R lR ltV3R ltR	tVtV ;t# )
ÚSapiens2HeadConfigaØ  
upsample_out_channels (`list[int]`, *optional*):
    Output channel counts for each upsample block.
    The first block takes `hidden_size` channels as input; subsequent blocks use the previous output.
upsample_kernel_sizes (`list[int]`, *optional*):
    Kernel size for each upsample block. Auto-filled with `[4, ...]` when
    `upsample_out_channels` is set but this is `None`.
    Must have the same length as `upsample_out_channels`.
upsample_kernel_size (`int`, defaults to 4):
    Default kernel size for upsample blocks when `upsample_kernel_sizes` is not set.
use_pixel_shuffle (`bool`, *optional*):
    Whether the upsample head uses pixel-shuffle upsampling instead of transposed convolutions.
    When `None` (default), the head uses transposed convolutions.
conv_out_channels (`list[int]`, *optional*):
    Output channel counts for the refinement conv layers that follow the upsample blocks.
conv_kernel_sizes (`list[int]`, *optional*):
    Kernel size for each refinement conv layer. Auto-filled with `[1, ...]` when
    `conv_out_channels` is set but this is `None`.
    Must have the same length as `conv_out_channels`.
conv_kernel_size (`int`, defaults to 1):
    Default kernel size for conv layers when `conv_kernel_sizes` is not set.
scale_conv_out_channels (`list[int]`, *optional*):
    Output channel counts for the stride-2 conv layers used to predict the focal-length scale.
    When `None` (default), no scale branch is built.
scale_conv_kernel_sizes (`list[int]`, *optional*):
    Kernel size for each scale conv layer. Auto-filled with `[1, ...]` when
    `scale_conv_out_channels` is set but this is `None`.
    Must have the same length as `scale_conv_out_channels`.
scale_conv_kernel_size (`int`, defaults to 1):
    Default kernel size for scale conv layers when `scale_conv_kernel_sizes` is not set.
scale_final_input_size (`int`, *optional*):
    Flattened feature size passed into the scale MLP.
    When `None` (default), it is automatically inferred from `image_size` and `patch_size`
    in the parent [`Sapiens2Config`].
scale_final_hidden_sizes (`list[int]`, *optional*):
    Hidden-layer sizes for the MLP that maps flattened scale features to the scalar scale output.
    When `None` (default), no scale branch is built.
Úsapiens2_headÚhead_configNc                óØ  <€ V P                   e;   V P                  f-   V P                  .\        V P                   4      ,          V n        V P                  e;   V P
                  f-   V P                  .\        V P                  4      ,          V n        V P                  e;   V P                  f-   V P                  .\        V P                  4      ,          V n        \        SV `,  ! R/ VB  R # )N© )Úupsample_out_channelsÚupsample_kernel_sizesÚupsample_kernel_sizeÚlenÚconv_out_channelsÚconv_kernel_sizesÚconv_kernel_sizeÚscale_conv_out_channelsÚscale_conv_kernel_sizesÚscale_conv_kernel_sizeÚsuperÚ__post_init__)ÚselfÚkwargsÚ	__class__s   &,€Út/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/models/sapiens2/configuration_sapiens2.pyr   Ú Sapiens2HeadConfig.__post_init__T   s»   ø€ Ø×%Ñ%Ò1°d×6PÑ6PÒ6XØ*.×*CÑ*CÐ)DÄsÈ4×KeÑKeÓGfÕ)fˆDÔ&Ø×!Ñ!Ò-°$×2HÑ2HÒ2PØ&*×&;Ñ&;Ð%<¼sÀ4×CYÑCYÓ?ZÕ%ZˆDÔ"Ø×'Ñ'Ò3¸×8TÑ8TÒ8\Ø,0×,GÑ,GÐ+HÌ3Èt×OkÑOkÓKlÕ+lˆDÔ(Ü‰ÒÑ' Ô'ó    c                ó¶   <€ V ^8„  d   QhRS[ S[S[ ,          ,          S[S[ S[ 3,          ,          RS[ S[S[ ,          ,          S[S[ S[ 3,          ,          RR/# )é   Ú
image_sizeÚ
patch_sizeÚreturnN)ÚintÚlistÚtuple)ÚformatÚ__classdict__s   "€r   Ú__annotate__ÚSapiens2HeadConfig.__annotate__]   sZ   ø€ ÷ jñ jÙ¡¡S¥	�/©E±#±s°(­OÕ;ðjÙILÉtÑTWÍyÍÑ[`ÑadÑfiÐaiÕ[jÕIjðjà	ñjr   c                ól  € V P                   f   V P                  e   V P                  f   R # \        V\        \
        34      '       d   TMW3w  r4\        V\        4      '       d   TMV^ ,          p\        V\        4      '       d   TMV^,          pW5,          pWF,          pV P                   F]  p	V	^,
          ^,          p
V^V
,          ,           V	,
          ^,          ^,           pV^V
,          ,           V	,
          ^,          ^,           pK_  	  Wx,          V P                  R,          ,          V n         R # )Néÿÿÿÿ)Úscale_final_input_sizer   r   Ú
isinstancer&   r'   r%   )r   r"   r#   Úimage_heightÚimage_widthÚpatch_heightÚpatch_widthÚfeatures_heightÚfeatures_widthÚkernel_sizeÚpaddings   &&&        r   Ú_init_scale_final_input_sizeÚ/Sapiens2HeadConfig._init_scale_final_input_size]   s  € ð ×'Ñ'Ò3Ø×+Ñ+Ò3Ø×+Ñ+Ò3áÜ2<¸ZÌ$ÔPUÈ×2WÒ2W¡JÐ^hÐ]uÑ!ˆÜ%/°
¼C×%@Ò%@‘zÀjÐQRÅmˆÜ$.¨z¼3×$?Ò$?‘jÀZÐPQÅ]ˆØ&Õ6ˆØ$Õ3ˆØ×7Ô7ˆKØ" Q•¨1Õ,ˆGØ.°°WµÕ<¸{ÕJÈqÕPÐSTÕTˆOØ,¨q°7­{Õ:¸[ÕHÈQÕNÐQRÕRŠNñ 8ð '6Õ&FÈ×IeÑIeÐfhÕIiÕ&iˆÖ#r   c                ó˜  <€ V ^8„  d   Qh/ S[ S[,          R,          ;R&   S[ S[,          R,          ;R&   S[;R&   S[R,          ;R&   S[ S[,          R,          ;R&   S[ S[,          R,          ;R&   S[;R&   S[ S[,          R,          ;R	&   S[ S[,          R,          ;R
&   S[;R&   S[R,          ;R&   S[ S[,          R,          ;R&   # )r!   Nr   r   r   Úuse_pixel_shuffler   r   r   r   r   r   r.   Úscale_final_hidden_sizes)r&   r%   Úbool)r(   r)   s   "€r   r*   r+      s   ø‡ ‚ ñZ  ¡�9 tÕ+Ñ2ñ[ ñ\  ¡�9 tÕ+Ñ2ñ] ñ^ Ñ!ñ_ ñ` ˜d•{Ñ)ña ñb ™C•y 4Õ'Ñ.ñc ñd ™C•y 4Õ'Ñ.ñe ñf Ññg ñh "¡#�Y¨Õ-Ñ4ñi ñj "¡#�Y¨Õ-Ñ4ñk ñl  Ñ#ñm ñn   $�JÑ-ño ñp #¡3�i¨$Õ.Ñ5òq r   )r   r   r.   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú
model_typeÚbase_config_keyr   r   r   r;   r   r   r   r   r   r   r.   r<   r   r8   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__Ú__classcell__©r   r)   s   @@r   r	   r	      sx   ù‡ € ñ%ðN !€JØ#€Oà.2ÐØ.2ÐØ !ÐØ%)ÐØ*.ÐØ*.ÐØÐØ04ÐØ04ÐØ"#ÐØ)-ÐØ15Ðõ(÷jð j÷G … r   r	   zfacebook/sapiens2-pretrain-0.4bc                   óâ   a a€ ] tR t^rt oRtRt^tRtRt^t	^t
RtRtRtRt^àt^tR	tR	tR	tR	tR	tR
tRtR	t^tRtRtRtRtRtR	tR] /t!Rt"Rt#R	t$R	t%Rt&^t'^t(^t)^ÿt*Rt+Rt,V 3R lt-V3R lt.Rt/Vt0V ;t1# )ÚSapiens2ConfiguS  
rope_theta (`float`, *optional*, defaults to 100.0):
    The base period of the RoPE embeddings.
query_bias (`bool`, *optional*, defaults to `True`):
    Whether to add a bias to the query projection.
key_bias (`bool`, *optional*, defaults to `False`):
    Whether to add a bias to the key projection.
value_bias (`bool`, *optional*, defaults to `True`):
    Whether to add a bias to the value projection.
proj_bias (`bool`, *optional*, defaults to `True`):
    Whether to add a bias to the output projection.
layerscale_value (`float`, *optional*, defaults to 1.0):
    Initial value to use for layer scale.
use_gated_mlp (`bool`, *optional*, defaults to `False`):
    Whether to use the SwiGLU feedforward neural network.
num_register_tokens (`int`, *optional*, defaults to 0):
    The number of register tokens.
pos_embed_shift (`float`, *optional*):
    Amount to randomly shift position embedding coordinates in [-shift, shift],
    applied only in training mode if not `None`.
pos_embed_jitter (`float`, *optional*):
    Amount to randomly jitter position embedding coordinates in log-uniform value in [1/jitter, jitter],
    applied only in training mode if not `None`.
pos_embed_rescale (`float`, *optional*, defaults to 2.0):
    Amount to randomly rescale position embedding coordinates in log-uniform value in [1/rescale, rescale],
    applied only in training mode if not `None`.
reshape_hidden_states (`bool`, *optional*, defaults to `True`):
    Whether to reshape the hidden states to spatial dimensions when used as backbone.
use_mask_token (`bool`, *optional*, defaults to `False`):
    Whether to use a mask token in the embeddings (needed for masked image modeling pretraining).
rms_norm_eps (`float`, *optional*, defaults to 1e-6):
    Epsilon for the RMS normalization layers.
normalize_backbone_outputs (`bool`, *optional*, defaults to `True`):
    Whether to apply RMSNorm to the backbone `feature_maps` and `cls_tokens` outputs before
    returning them from the forward pass. Only applies when the model is used as a backbone.
use_qk_norm (`bool`, *optional*, defaults to `True`):
    Whether to apply RMSNorm to queries and keys before RoPE in attention layers.
num_key_value_heads_per_layer (`list[int]`, *optional*):
    Number of key/value heads for each transformer layer. Setting a layer's value equal to
    `num_attention_heads` gives full multi-head attention; a smaller value gives grouped-query
    attention. Defaults to `num_attention_heads` for the first `num_first_full_attention_layers`
    and last `num_last_full_attention_layers` layers and `num_key_value_attention_heads` for all other
    layers.
num_key_value_attention_heads (`int`):
    Number of key/value heads for layers that use grouped-query attention when `num_key_value_heads_per_layer`
    is not set. Ignored when `num_key_value_heads_per_layer` is set.
num_first_full_attention_layers (`int`, *optional*, defaults to 8):
    Number of leading transformer layers that use full multi-head attention.
    Only used when `num_key_value_heads_per_layer` is `None`.
num_last_full_attention_layers (`int`, *optional*, defaults to 8):
    Number of trailing transformer layers that use full multi-head attention.
    Only used when `num_key_value_heads_per_layer` is `None`.
semantic_loss_ignore_index (`int`, *optional*, defaults to 255):
    Label index ignored when computing the segmentation loss.
flip_pairs (`list[list[int]]`, *optional*):
    Pairs of keypoint indices that are mirrored horizontally (e.g., left ear â†” right ear).
    Each pair is a two-element list `[left_index, right_index]`. Used for test-time
    horizontal flip augmentation in pose estimation: pass these pairs to the second
    forward call so the model flips heatmaps back before returning them.
head_config (`Sapiens2HeadConfig`, *optional*):
    Configuration for the decode head. See [`Sapiens2HeadConfig`] for the available options.
Úsapiens2i   i   Úsilug        g{®Gáz”?g      Y@Tg      ð?Ng       @r   Fg�íµ ÷Æ°>c                ó  <€ V P                   fr   \        V P                  4       Uu. uFL  pW P                  8  g"   W P                  V P                  ,
          8¼  d   V P
                  MV P                  NKN  	  upV n         \        V P                  \        4      '       d   \        R/ V P                  B V n        V P                  e2   V P                  P                  V P                  V P                  R7       R.\        ^V P                  ^,           4       Uu. uF  pRV 2NK
  	  up,           V n        V P                  VP!                  RR 4      VP!                  RR 4      R7       \"        SV `H  ! R/ VB  R # u upi u upi )N)r"   r#   ÚstemÚstageÚout_indicesÚout_features)rQ   rR   r   )Únum_key_value_heads_per_layerÚrangeÚnum_hidden_layersÚnum_first_full_attention_layersÚnum_last_full_attention_layersÚnum_attention_headsÚnum_key_value_attention_headsr/   r   Údictr	   r8   r"   r#   Ústage_namesÚ"set_output_features_output_indicesÚpopr   r   )r   r   Úlayer_indexÚir   s   &,  €r   r   ÚSapiens2Config.__post_init__Þ   s^  ø€ Ø×-Ñ-Ò5ô $)¨×)?Ñ)?Ô#@ó2ñ $A�Kð	  ×"FÑ"FÔFØ"×&<Ñ&<¸t×?bÑ?bÕ&bÔbð ×(Ò(ð
 ×7Ñ7ò8ñ $Añ2ˆDÔ.ô �d×&Ñ&¬×-Ò-Ü1ÑE°D×4DÑ4DÑEˆDÔØ×ÑÒ'Ø×Ñ×9Ñ9ÀTÇ_Á_Ðae×apÑapÐ9ÔqØ"˜8¼EÀ!ÀT×E[ÑE[Ð^_ÕE_Ô<`Ó&aÑ<`°q¨¨q¨c£{Ñ<`Ñ&aÕaˆÔØ×/Ñ/ØŸ
™
 =°$Ó7ÀfÇjÁjÐQ_ÐaeÓFfð 	0ô 	
ô 	‰ÒÑ' Ô'ùò#2ùò 'bs   §AE<ÄFc                óR  <€ V ^8„  d   Qh/ S[ S[S[ ,          ,          S[S[ S[ 3,          ,          ;R&   S[ ;R&   S[ ;R&   S[ ;R&   S[ ;R&   S[;R&   S[S[ ,          ;R&   S[;R&   S[;R	&   S[ S[S[ ,          ,          S[S[ S[ 3,          ,          ;R
&   S[ ;R&   S[;R&   S[;R&   S[;R&   S[;R&   S[;R&   S[;R&   S[S[ ,          ;R&   S[;R&   S[ ;R&   S[R,          ;R&   S[R,          ;R&   S[R,          ;R&   S[S[,          R,          ;R&   S[S[ ,          R,          ;R&   S[;R&   S[;R&   S[;R&   S[;R&   S[;R&   S[S[ ,          R,          ;R &   S[ ;R!&   S[ ;R"&   S[ ;R#&   S[ ;R$&   S[S[S[ ,          ,          R,          ;R%&   S[S[,          R,          ;R&&   # )'r!   r#   Úhidden_sizeÚintermediate_sizerU   rX   Ú
hidden_actÚattention_dropoutÚinitializer_rangeÚ
rope_thetar"   Únum_channelsÚ
query_biasÚkey_biasÚ
value_biasÚ	proj_biasÚmlp_biasÚlayerscale_valueÚdrop_path_rateÚuse_gated_mlpÚnum_register_tokensNÚpos_embed_shiftÚpos_embed_jitterÚpos_embed_rescaleÚ_out_featuresÚ_out_indicesÚreshape_hidden_statesÚuse_mask_tokenÚrms_norm_epsÚnormalize_backbone_outputsÚuse_qk_normrS   rY   rV   rW   Úsemantic_loss_ignore_indexÚ
flip_pairsr   )r%   r&   r'   ÚstrÚfloatr=   r	   rZ   )r(   r)   s   "€r   r*   ÚSapiens2Config.__annotate__r   s   ø‡ ‚ ñH ‘d™3•i•¡%©©S¨¥/Õ1Ñ6ñI ñL ÑñM ñN Ñ!ñO ñP ÑñQ ñR Ñ!ñS ñT ÑñU ñV ™s•{Ñ(ñW ñX Ñ#ñY ñZ Ññ[ ñ\ ‘d™3•i•¡%©©S¨¥/Õ1Ñ7ñ] ñ^ Ññ_ ñ` Ñña ñb Ññc ñd Ññe ñf Ññg ñh Ññi ñj Ñ!ñk ñl ™C•KÑ%ñm ñn Ñño ñp Ñ ñq ñr ˜T•\Ñ(ñs ñt ˜d•lÑ)ñu ñv ˜t•|Ñ)ñw ñx ™•9˜tÕ#Ñ*ñy ñz ‘s•)˜dÕ"Ñ)ñ{ ñ|  Ñ&ñ} ñ@ Ñ ñA ñB ÑñC ñD !%Ñ+ñE ñF ÑñG ñH $(©¥9¨tÕ#3Ñ:ñI ñJ $'Ñ*ñK ñL &)Ñ,ñM ñN %(Ñ+ñO ñP !$Ñ)ñQ ñR ‘T™#•Y• $Õ&Ñ-ñS ñT $¡dÕ*¨TÕ1Ñ8òU r   )r   rS   r[   )2r>   r?   r@   rA   rB   rC   r#   rb   rc   rU   rX   rd   re   rf   rg   r"   rh   ri   rj   rk   rl   rm   rn   ro   rp   rq   rr   rs   rt   ru   rv   rw   r	   Úsub_configsrx   ry   rz   r{   rS   rY   rV   rW   r|   r}   r   r   rE   rF   rG   rH   rI   s   @@r   rK   rK   r   só   ù‡ € ñ=ð~ €Jà46€Jà€KØ!ÐØÐØ!ÐØ€JØ%(ÐØ#ÐØ€JØ47€JØ€LØ€JØ€HØ€JØ€IØ€HØ!ÐØ"%€NØ€MØ ÐØ$(€OØ%)ÐØ&)ÐØ&*€MØ%)€LØ"&ÐØ Ð"4Ð5€KØ €NØ€LØ'+ÐØ€KØ6:Ð!Ø)*Ð!Ø+,Ð#Ø*+Ð"Ø&)ÐØ)-€JØ48€Kõ(÷Y … r   rK   N)Úhuggingface_hub.dataclassesr   Úbackbone_utilsr   Úconfiguration_utilsr   Úutilsr   r	   rK   Ú__all__r   r   r   Ú<module>r‡      s‚   ðõ& /å 1Ý 3Ý #ñ Ð7Ô8ØôSjÐ)ó Sjó ó 9ðSjñl Ð<Ô=Øô}(Ð(Ð*:ó }(ó ó >ð}(ð@ Ð1Ð
2‚r   