+
    œ°³jT  ã                   ó’  € R t ^ RIHt ^ RIt^ RIHt ^ RIHt ^RIHt	 ^RI
HtHt ^RIHt ^RIHt ^R	IHt ^R
IHtHt ^RIHtHtHtHtHt ^RIHt ^RIHt ^RI H!t! ^RI"H#t#H$t$ ]! RR7      ] ! R R]4      4       4       t% ! R R]RR7      t& ! R R]!4      t' ! R R]#4      t( ! R R]PR                  4      t* ! R R]4      t+ ! R  R!]PR                  4      t, ! R" R#]PR                  4      t- ! R$ R%]PR                  4      t. ! R& R']PR                  4      t/] ! R( R)]4      4       t0]! R*R+7       ! R, R-]04      4       t1. R.Ot2R# )/u9   CHMv2 model â€” Canopy Height Model v2, adapted from DPT.)ÚLiteralN)Ústrict)Únn)Úinitialization)Ú%consolidate_backbone_kwargs_to_configÚload_backbone)ÚPreTrainedConfig)ÚDepthEstimatorOutput)ÚPreTrainedModel)ÚImagesKwargsÚUnpack)Ú
TensorTypeÚTransformersKwargsÚauto_docstringÚcan_return_tupleÚrequires_backends)Ú
AutoConfig)Ú DepthAnythingPreActResidualLayer)ÚDPTImageProcessor)ÚDPTReassembleLayerÚ_get_backbone_hidden_sizez%facebook/dinov3-vitl16-chmv2-dpt-head)Ú
checkpointc                   ó‚   a a€ ] tR t^%t oRtRtR]/tRt^t	Rt
RtRtRt^€tRtRtRtR	tR
tR
tV 3R ltV3R ltRtVtV ;t# )ÚCHMv2Configa%  
backbone_config (`Union[dict, "PreTrainedConfig"]`, *optional*):
    The configuration of the backbone model. Only DINOv3ViTConfig is currently supported.
patch_size (`int`, *optional*, defaults to 16):
    The patch size used by the backbone vision transformer.
reassemble_factors (`list[float]`, *optional*, defaults to `[4, 2, 1, 0.5]`):
    The up/downsampling factors of the reassemble layers.
post_process_channels (`list[int]`, *optional*, defaults to `[128, 256, 512, 1024]`):
    The output channel sizes of the reassemble stage for each backbone feature level.
fusion_hidden_size (`int`, *optional*, defaults to 256):
    The number of channels before fusion.
head_hidden_size (`int`, *optional*, defaults to 128):
    The number of channels in the hidden layer of the depth estimation head.
number_output_channels (`int`, *optional*, defaults to 256):
    Number of output channels for the CHMv2 head (number of depth bins).
readout_type (`str`, *optional*, defaults to `"project"`):
    Type of readout operation for the CLS token. One of `["ignore", "add", "project"]`.
min_depth (`float`, *optional*, defaults to 0.001):
    The minimum depth value for depth bin calculation.
max_depth (`float`, *optional*, defaults to 96.0):
    The maximum depth value for depth bin calculation.
bins_strategy (`str`, *optional*, defaults to `"chmv2_mixlog"`):
    The strategy for depth bins distribution. One of `["linear", "log", "chmv2_mixlog"]`.
norm_strategy (`str`, *optional*, defaults to `"chmv2_mixlog"`):
    The normalization strategy for depth prediction. One of `["linear", "softmax", "sigmoid", "chmv2_mixlog"]`.

```python
>>> from transformers import CHMv2Config, CHMv2ForDepthEstimation

>>> configuration = CHMv2Config()
>>> model = CHMv2ForDepthEstimation(configuration)
>>> configuration = model.config
```
Úchmv2Úbackbone_configNg{®Gáz”?é   Úprojectgü©ñÒMbP?g      X@Úchmv2_mixlogc                ó  <€ V P                   f
   . ROV n         V P                  f
   . ROV n        RRRRRRR^R^R	^R
RR. RORRRRRRRR/p\        RRV P                  RRRV/VB w  V n        p\        SV `  ! R/ VB  R # )Né   Ú
image_sizei   Úhidden_sizeÚintermediate_sizei   Únum_attention_headsÚnum_hidden_layersÚnum_register_tokensÚkey_biasTÚout_indicesÚreshape_hidden_statesÚapply_layernormÚlayer_norm_epsg�íµ ÷Æ°>Úreturn_class_tokenr   Údefault_config_typeÚ
dinov3_vitÚdefault_config_kwargs)é   é   é   g      à?)é€   r   i   r    )é   é   é   é   © )Úreassemble_factorsÚpost_process_channelsr   r   ÚsuperÚ__post_init__)ÚselfÚkwargsr/   Ú	__class__s   &, €Úh/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/models/chmv2/modular_chmv2.pyr<   ÚCHMv2Config.__post_init__\   sÂ   ø€ Ø×"Ñ"Ò*Ú&4ˆDÔ#Ø×%Ñ%Ò-Ú)>ˆDÔ&ð ˜#Ø˜4Ø Ø! 2Ø Ø! 1Ø˜Øš?Ø# TØ˜tØ˜dØ  $ð!
Ðô (Mñ (
Ø ×0Ñ0ð(
à ,ð(
ð #8ð(
ð ñ	(
Ñ$ˆÔ˜fô 	‰ÒÑ' Ô'ó    c                ó<  <€ V ^8„  d   Qh/ S[ S[,          R,          ;R&   S[;R&   S[;R&   S[S[S[,          ,          R,          ;R&   S[S[,          R,          ;R&   S[;R&   S[;R&   S[;R	&   S[;R
&   S[;R&   S[;R&   S[R,          ;R&   S[R,          ;R&   # )r1   Nr   Ú
patch_sizeÚinitializer_ranger9   r:   Úfusion_hidden_sizeÚhead_hidden_sizeÚnumber_output_channelsÚreadout_typeÚ	min_depthÚ	max_depthÚbins_strategyÚnorm_strategy)ÚlinearÚlogr   )rN   ÚsoftmaxÚsigmoidr   )Údictr   ÚintÚfloatÚlistÚstrr   )ÚformatÚ__classdict__s   "€r@   Ú__annotate__ÚCHMv2Config.__annotate__%   sö   ø‡ ‚ ñR Ñ,Õ,¨tÕ3Ñ:ñS ñT ÑñU ñV Ñ#ñW ñX ™U¡S�[Õ)¨DÕ0Ñ7ñY ñZ  ¡�9 tÕ+Ñ2ñ[ ñ\ Ñ!ñ] ñ^ Ññ_ ñ`  Ñ%ña ñb Ñ!ñc ñd Ññe ñf Ññg ñh Ð:Õ;ÑLñi ñj ÐIÕJÑ[òk rB   )r   r:   r9   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú
model_typer   Úsub_configsr   rD   rE   r9   r:   rF   rG   rH   rI   rJ   rK   rL   rM   r<   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__Ú__classcell__©r?   rX   s   @@r@   r   r   %   sp   ù‡ € ñ!ðF €JØ$ jÐ1€Kà6:€OØ€JØ#ÐØ37ÐØ.2ÐØ!ÐØÐØ"%ÐØ!€LØ€IØ€IØ>L€MØM[€Mõ(÷o … rB   r   c                   ó0   a € ] tR t^{t o RtV 3R ltRtV tR# )ÚCHMv2ImageProcessorKwargsa  
ensure_multiple_of (`int`, *optional*, defaults to 1):
    If `do_resize` is `True`, the image is resized to a size that is a multiple of this value. Can be overridden
    by `ensure_multiple_of` in `preprocess`.
keep_aspect_ratio (`bool`, *optional*, defaults to `False`):
    If `True`, the image is resized to the largest possible size such that the aspect ratio is preserved. Can
    be overridden by `keep_aspect_ratio` in `preprocess`.
do_reduce_labels (`bool`, *optional*, defaults to `self.do_reduce_labels`):
    Whether or not to reduce all label values of segmentation maps by 1. Usually used for datasets where 0
    is used for background, and background itself is not included in all classes of a dataset (e.g.
    ADE20k). The background label will be replaced by 255.
c                óJ   <€ V ^8„  d   Qh/ S[ ;R&   S[ ;R&   S[;R&   S[;R&   # )r1   Úensure_multiple_ofÚsize_divisorÚkeep_aspect_ratioÚdo_reduce_labels)rS   Úbool)rW   rX   s   "€r@   rY   Ú&CHMv2ImageProcessorKwargs.__annotate__{   s9   ø‡ ‚ ñ Ññ ñ Ññ ñ  Ññ! ñ" Ñò# rB   r8   N)r[   r\   r]   r^   r_   rb   rc   rd   ©rX   s   @r@   rh   rh   {   s   ø‡ € ñ÷ ƒ rB   rh   F)Útotalc                   ó^   a € ] tR t^�t o RtRt^t^tRt. ROt	. ROt
]tR	V 3R lR lltRtV tR# )
ÚCHMv2ImageProcessorFTNc          	      ó¢   <€ V ^8„  d   QhRRRS[ S[S[S[S[3,          ,          ,          R,          R,          RS[S[S[S[ 3,          ,          /# )r1   Úoutputsr	   Útarget_sizesNÚreturn)r   rU   ÚtuplerS   rR   rV   )rW   rX   s   "€r@   rY   Ú CHMv2ImageProcessor.__annotate__™   sS   ø€ ÷ 'ñ 'à'ð'ñ !¡4©©c±3¨h­Õ#8Õ8¸4Õ?À$ÕFð'ñ 
‰d‘3™
�?Õ#Õ	$ñ	'rB   c                ó–  € \        V R4       VP                  pVe%   \        V4      \        V4      8w  d   \        R4      h. pVf   R.\        V4      ,          MTp\	        W24       F^  w  rVVeC   \
        P                  P                  P                  VR,          VRRR7      P                  4       pVP                  RV/4       K`  	  V# )	aj  
Converts the raw output of [`DepthEstimatorOutput`] into final depth predictions and depth PIL images.
Only supports PyTorch.

Args:
    outputs ([`DepthEstimatorOutput`]):
        Raw outputs of the model.
    target_sizes (`TensorType` or `List[Tuple[int, int]]`, *optional*):
        Tensor of shape `(batch_size, 2)` or list of tuples (`Tuple[int, int]`) containing the target size
        (height, width) of each image in the batch. If left to None, predictions will not be resized.

Returns:
    `List[Dict[str, TensorType]]`: A list of dictionaries of tensors representing the processed depth
    predictions.
ÚtorchNz]Make sure that you pass in as many target sizes as the batch dimension of the predicted depthÚbilinearT©ÚsizeÚmodeÚalign_cornersÚpredicted_depth)NN.)r   r�   ÚlenÚ
ValueErrorÚzipr{   r   Ú
functionalÚinterpolateÚsqueezeÚappend)r=   ru   rv   r�   ÚresultsÚdepthÚtarget_sizes   &&&    r@   Úpost_process_depth_estimationÚ1CHMv2ImageProcessor.post_process_depth_estimation™   sÌ   € ô( 	˜$ Ô(à!×1Ñ1ˆàÒ$¬3¨Ó+?Ä3À|ÓCTÔ+TÜØoóð ð ˆØ8DÒ8L˜�v¤ OÓ 4Ö4ÐR^ˆÜ"% oÖ"DÑˆEØÒ&ÜŸ™×+Ñ+×7Ñ7Ø˜/Õ*°À:Ð]að 8ó ç‘'“)ð ð �N‰NÐ-¨uÐ5Ö6ñ #Eð ˆrB   r8   )gáz®GáÚ?gçû©ñÒMÚ?g‹lçû©ñÒ?)gÝ$�•CË?g+‡ÙÎ÷Ã?gçû©ñÒMÂ?©N)r[   r\   r]   r^   Ú	do_resizeÚdo_padrk   rj   rl   Ú
image_meanÚ	image_stdrh   Úvalid_kwargsrŒ   rc   rd   rp   s   @r@   rs   rs   �   s>   ø‡ € Ø€IØ€FØ€LØÐØÐÚ&€JÚ%€IØ,€L÷'÷ 'ð 'rB   rs   c                   ó   € ] tR t^ÃtRtR# )ÚCHMv2ReassembleLayerr8   N©r[   r\   r]   r^   rc   r8   rB   r@   r•   r•   Ã   ó   † ÛrB   r•   c                   óX   a a€ ] tR t^Çt oRtV3R lV 3R lltRV3R lR lltRtVtV ;t	# )ÚCHMv2ReassembleStagez�
Reassemble stage that processes hidden states from the backbone into image-like feature
representations at various resolutions.
c                ó    <€ V ^8„  d   QhRS[ /# ©r1   Úconfig©r   )rW   rX   s   "€r@   rY   Ú!CHMv2ReassembleStage.__annotate__Í   s   ø€ ÷ pñ p™{ñ prB   c           	     óž  <€ \         SV `  4        Wn        VP                  V n        \        P
                  ! 4       V n        \        VP                  VP                  4       F,  w  r#V P                  P                  \        VVVR 7      4       K.  	  \        V4      pV P                  R8X  d¡   \        P
                  ! 4       V n        \        \        V P                  4      4       Fb  pV P                  P                  \        P                   ! \        P"                  ! ^V,          V4      \        P$                  ! 4       4      4       Kd  	  R# R# ))rœ   ÚchannelsÚfactorr   N)r;   Ú__init__rœ   rI   r   Ú
ModuleListÚlayersr„   r:   r9   rˆ   r•   r   Úreadout_projectsÚranger‚   Ú
SequentialÚLinearÚGELU)r=   rœ   Úout_channelsr¡   r"   Ú_r?   s   &&    €r@   r¢   ÚCHMv2ReassembleStage.__init__Í   sð   ø€ Ü‰ÑÔØŒØ"×/Ñ/ˆÔä—m’m“oˆŒÜ$'¨×(DÑ(DÀf×F_ÑF_Ö$`Ñ ˆLØ�K‰K×ÑÜ$Ø!Ø)Ø!ôöñ %aô 0°Ó7ˆØ×Ñ 	Ô)Ü$&§M¢M£OˆDÔ!Üœ3˜tŸ{™{Ó+Ö,�Ø×%Ñ%×,Ñ,¬R¯]ª]¼2¿9º9ÀQÈÅ_ÐVaÓ;bÔdf×dkÒdkÓdmÓ-nÖoó -ñ *rB   c                ón   <€ V ^8„  d   QhRS[ S[P                  ,          RS[ S[P                  ,          /# )r1   Úhidden_statesrw   )rU   r{   ÚTensor)rW   rX   s   "€r@   rY   rž   â   s1   ø€ ÷ ñ ¡T©%¯,©,Õ%7ð ÑaeÑfk×frÑfrÕasñ rB   c                ó¾  € . p\        V4       EFÊ  w  rV\        V\        \        34      '       Ed   \	        V4      ^8X  Ed   V^ ,          V^,          rvVP
                  pV P                  R8X  d”   VP                  ^4      P                  ^^4      pVP                  ^4      P                  V4      p	V P                  V,          ! \        P                  ! Wi3R4      4      pVP                  ^ ^^4      P                  V4      pM«V P                  R8X  d9   VP                  ^4      VP                  R4      ,           pVP                  V4      pMaVP!                  4       ^8X  dM   VR,          pVP
                  w  r«pVP                  W¢W<4      pVP                  ^ ^^^4      P#                  4       pV P$                  V,          ! V4      pVP'                  V4       EKÍ  	  V# )r1   r   Úaddéÿÿÿÿ):NNN:r2   NN)Ú	enumerateÚ
isinstancerx   rU   r‚   ÚshaperI   ÚflattenÚ	transposeÚ	unsqueezeÚ	expand_asr¥   r{   ÚcatÚpermuteÚreshapeÚdimÚ
contiguousr¤   rˆ   )r=   r®   Úpatch_heightÚpatch_widthÚoutÚ	layer_idxÚhidden_stateÚ	cls_tokenÚfeature_shapeÚreadoutÚ
batch_sizer«   Únum_channelss   &&&&         r@   ÚforwardÚCHMv2ReassembleStage.forwardâ   sž  € Øˆä'0°×'?Ñ#ˆIÜ˜,¬´¨×6Ó6¼3¸|Ó;LÐPQÕ;QØ*6°q­/¸<È½?˜iØ ,× 2Ñ 2�à×$Ñ$¨	Ô1Ø#/×#7Ñ#7¸Ó#:×#DÑ#DÀQÈÓ#J�LØ'×1Ñ1°!Ó4×>Ñ>¸|ÓL�GØ#'×#8Ñ#8¸Ö#CÄEÇIÂIÈ|ÐNeÐgiÓDjÓ#k�LØ#/×#7Ñ#7¸¸1¸aÓ#@×#HÑ#HÈÓ#W‘LØ×&Ñ&¨%Ô/Ø#/×#7Ñ#7¸Ó#:¸Y×=PÑ=PÐQSÓ=TÕ#T�LØ#/×#7Ñ#7¸Ó#F�Løà×#Ñ#Ó%¨Ô*Ø#/°Õ#6�LØ2>×2DÑ2DÑ/�J <Ø#/×#7Ñ#7¸
ÐR]Ó#l�LØ#/×#7Ñ#7¸¸1¸aÀÓ#C×#NÑ#NÓ#P�LàŸ;™; yÖ1°,Ó?ˆLØ�J‰J�|×$ñ+ (@ð. ˆ
rB   )rœ   r¤   r¥   rI   ©NN©
r[   r\   r]   r^   r_   r¢   rÉ   rc   rd   re   rf   s   @@r@   r™   r™   Ç   s%   ù‡ € ñ÷
pó p÷*÷ ò rB   r™   c                   ó   € ] tR t^ÿtRtR# )ÚCHMv2PreActResidualLayerr8   Nr–   r8   rB   r@   rÎ   rÎ   ÿ   r—   rB   rÎ   c                   óL   a a€ ] tR tRt oRV3R lV 3R llltRR ltRtVtV ;t# )ÚCHMv2FeatureFusionLayeri  c                ó&   <€ V ^8„  d   QhRS[ RS[/# )r1   rœ   Úis_first_layer)r   rn   )rW   rX   s   "€r@   rY   Ú$CHMv2FeatureFusionLayer.__annotate__  s   ø€ ÷ 	@ñ 	@™{ð 	@¹Dñ 	@rB   c                óæ   <€ \         SV `  4        W n        \        P                  ! VP
                  VP
                  ^RR7      V n        V'       g   \        V4      V n        \        V4      V n	        R# )r2   T)Úkernel_sizeÚbiasN)
r;   r¢   rÒ   r   ÚConv2drF   Ú
projectionrÎ   Úresidual_layer1Úresidual_layer2)r=   rœ   rÒ   r?   s   &&&€r@   r¢   Ú CHMv2FeatureFusionLayer.__init__  sU   ø€ Ü‰ÑÔØ,ÔäŸ)š) F×$=Ñ$=¸v×?XÑ?XÐfgÐnrÔsˆŒçÜ#;¸FÓ#CˆDÔ ä7¸Ó?ˆÖrB   c                ó¨  € Vey   V P                   '       gg   VP                  VP                  8w  d5   VP                  w   rEp\        P                  P	                  W%V3RRR7      pWP                  V4      ,           pV P                  V4      pVf   R^/MRV/p\        P                  P                  ! V3/ VBRRRR/B pV P                  V4      pV# )	Nr|   Fr}   Úscale_factorr~   r   r€   T)rÒ   rµ   r   r…   r†   rÙ   rÚ   rØ   )r=   rÃ   Úresidualr~   r«   ÚheightÚwidthÚmodifiers   &&&&    r@   rÉ   ÚCHMv2FeatureFusionLayer.forward  sÞ   € ØÒ¨×(;×(;Ð(;Ø×!Ñ! X§^¡^Ô3Ø&2×&8Ñ&8Ñ#��1˜eÜŸ=™=×4Ñ4Ø¨E ?¸ÐSXð 5ó �ð (×*>Ñ*>¸xÓ*HÕHˆLà×+Ñ+¨LÓ9ˆà*.ª,�N AÑ&¸VÀT¸Nˆä—}‘}×0Ò0Øñ
àñ
ð ð
ð ò	
ˆð —‘ |Ó4ˆàÐrB   )rÒ   rØ   rÙ   rÚ   )FrË   )	r[   r\   r]   r^   r¢   rÉ   rc   rd   re   rf   s   @@r@   rÐ   rÐ     s   ù‡ € ÷	@õ 	@÷ô rB   rÐ   c                   ó@   a a€ ] tR tRt oRtRV 3R lltR tRtVtV ;t	# )ÚCHMv2UpsampleConvHeadi(  z€
Convolutional head with intermediate upsampling.

Architecture: Conv3x3 -> 2x bilinear upsample -> Conv3x3 -> ReLU -> Conv1x1.
c                óf  <€ \         SV `  4        \        P                  ! \        P                  ! W^,          ^^^R7      \        P
                  ! ^RRR7      \        P                  ! V^,          V^^^R7      \        P                  ! 4       \        P                  ! W2^^^ R7      .4      V n        R# )r1   )rÕ   ÚstrideÚpaddingr|   T)rÝ   r   r€   N)r;   r¢   r   r£   r×   ÚUpsampleÚReLUÚhead)r=   ÚfeaturesrH   Ún_hidden_channelsr?   s   &&&&€r@   r¢   ÚCHMv2UpsampleConvHead.__init__/  s„   ø€ Ü‰ÑÔÜ—M’Mä—	’	˜(°¥M¸qÈÐTUÔVÜ—’¨°È4ÔPÜ—	’	˜( a�-Ð):ÈÐRSÐ]^Ô_Ü—’“	Ü—	’	Ð+ÐQRÐ[\ÐfgÔhðó
ˆŽ	rB   c                ó<   € V P                    F  pV! V4      pK  	  V# rŽ   ©rê   )r=   r®   Úlayers   && r@   rÉ   ÚCHMv2UpsampleConvHead.forward;  s    € Ø—Y”YˆEÙ! -Ó0ŠMñ àÐrB   rï   )r3   rÌ   rf   s   @@r@   rä   rä   (  s   ù‡ € ñ÷

÷ò rB   rä   c                   óf   a a€ ] tR tRt oRtV3R lV 3R lltV3R lR ltV3R lR ltR	tVt	V ;t
# )
Ú	CHMv2HeadiA  z€
CHMv2 dense-prediction head adapted from DPT.

Integrates reassemble, projection convs, feature fusion, and UpConv depth head.
c                ó    <€ V ^8„  d   QhRS[ /# r›   r�   )rW   rX   s   "€r@   rY   ÚCHMv2Head.__annotate__H  s   ø€ ÷ 
ñ 
™{ñ 
rB   c                óT  <€ \         SV `  4        Wn        \        V4      V n        \
        P                  ! 4       V n        VP                   F@  pV P                  P                  \
        P                  ! W!P                  ^^RR7      4       KB  	  \
        P                  ! 4       V n        \        \        VP                  4      4       F+  pV P                  P                  \        W^ 8H  R7      4       K-  	  \!        VP                  VP"                  VP$                  R7      V n        R# )é   F)rÕ   rç   rÖ   )rÒ   )rë   rH   rì   N)r;   r¢   rœ   r™   Úreassemble_stager   r£   Úconvsr:   rˆ   r×   rF   Úfusion_layersr¦   r‚   rÐ   rä   rH   rG   Ú
conv_depth)r=   rœ   ÚchannelÚidxr?   s   &&  €r@   r¢   ÚCHMv2Head.__init__H  sÚ   ø€ Ü‰ÑÔØŒä 4°VÓ <ˆÔä—]’]“_ˆŒ
Ø×3Ô3ˆGØ�J‰J×ÑœbŸiši¨×1JÑ1JÐXYÐcdÐkpÔqÖrñ 4ô  Ÿ]š]›_ˆÔÜœ˜V×9Ñ9Ó:Ö;ˆCØ×Ñ×%Ñ%Ô&=¸fÐ]^ÑV^Ô&`Öañ <ô 0Ø×.Ñ.Ø#)×#@Ñ#@Ø$×5Ñ5ô
ˆŽrB   c                ój   <€ V ^8„  d   QhRS[ S[P                  ,          RS[RS[RS[P                  /# ©r1   r®   r¿   rÀ   rw   ©rU   r{   r¯   rS   )rW   rX   s   "€r@   rY   rõ   \  s;   ø€ ÷ 
"ñ 
"©d±5·<±<Õ.@ð 
"ÑPSð 
"Ñbeð 
"Ñjo×jvÑjvñ 
"rB   c                óŒ  € V P                  WV4      p\        V4       UUu. uF  w  rEV P                  V,          ! V4      NK   	  pppVP                  4        V P                  ^ ,          ! V^ ,          4      p\        ^\        V P                  4      4       F#  pV P                  V,          ! WvV,          4      pK%  	  V# u uppi )é    )rø   r³   rù   Úreverserú   r¦   r‚   )r=   r®   r¿   rÀ   ÚiÚfeaturerë   Úfused_hidden_states   &&&&    r@   Úforward_featuresÚCHMv2Head.forward_features\  sª   € Ø×-Ñ-¨mÈ;ÓWˆä=FÀ}Ô=UÔVÑ=U©z¨q�D—J‘J˜q–M 'Ö*Ñ=UˆÑVØ×ÑÔà!×/Ñ/°Ö2°8¸Aµ;Ó?ÐÜ�qœ#˜d×0Ñ0Ó1Ö2ˆAØ!%×!3Ñ!3°AÖ!6Ð7IÐTUÍ;Ó!WÒñ 3ð "Ð!ùó Ws   ¡$C c                ój   <€ V ^8„  d   QhRS[ S[P                  ,          RS[RS[RS[P                  /# r   r  )rW   rX   s   "€r@   rY   rõ   h  s:   ø€ ÷ ñ ¡T©%¯,©,Õ%7ð Ásð ÑY\ð Ñaf×amÑamñ rB   c                óL   € V P                  WV4      pV P                  V4      pV# rŽ   )r  rû   )r=   r®   r¿   rÀ   rÁ   s   &&&& r@   rÉ   ÚCHMv2Head.forwardh  s'   € Ø×#Ñ# MÀÓMˆØ�o‰o˜cÓ"ˆØˆ
rB   )rœ   rû   rù   rú   rø   )r[   r\   r]   r^   r_   r¢   r  rÉ   rc   rd   re   rf   s   @@r@   ró   ró   A  s-   ù‡ € ñ÷
ó 
÷(
"ð 
"÷÷ ð rB   ró   c                   óx   a a€ ] tR tRt oRtV3R lV 3R lltV3R lR ltV3R lR ltV3R	 lR
 ltRt	Vt
V ;t# )ÚCHMv2FeaturesToDepthin  zJConverts raw logits from the CHMv2 head into a depth map using depth bins.c                ó    <€ V ^8„  d   QhRS[ /# r›   r�   )rW   rX   s   "€r@   rY   Ú!CHMv2FeaturesToDepth.__annotate__q  s   ø€ ÷ !ñ !™{ñ !rB   c                óÖ   <€ \         SV `  4        VP                  V n        VP                  V n        VP                  V n        VP
                  V n        R V n        RV n        RV n        R# )g-Cëâ6?g:Œ0âŽyE>gê-�™—q=N)	r;   r¢   rJ   rK   rL   rM   Ú_mixlog_max_clamp_valueÚ_mixlog_eps_shiftÚ_mixlog_eps©r=   rœ   r?   s   &&€r@   r¢   ÚCHMv2FeaturesToDepth.__init__q  s\   ø€ Ü‰ÑÔØ×)Ñ)ˆŒØ×)Ñ)ˆŒØ#×1Ñ1ˆÔØ#×1Ñ1ˆÔØ'+ˆÔ$Ø!%ˆÔØ ˆÖrB   c                óT   <€ V ^8„  d   QhRS[ RS[P                  RS[P                  /# )r1   Ún_binsÚdevicerw   )rS   r{   r  r¯   )rW   rX   s   "€r@   rY   r  {  s*   ø€ ÷ ñ ©#ð ±u·|±|ð ÉÏÉñ rB   c                óø  € V P                   R,          p\        P                  ! V P                  W1VR7      p\        P                  ! \        P                  ! \        P
                  ! \        P                  ! RV P                  VR7      4      \        P
                  ! \        P                  ! RW2R7      4      VVR7      4      p\        P                  ! RRWR7      pWe,          RV,
          V,          ,           pV# )zÎ
Creates mixed log bins interpolated between linear and log distributions.

The max_depth is divided by 8.0 internally; this scaling is reversed in
`_create_outputs_with_mixlog_norm` by multiplying by 8.0.
ç       @©r  ç      ð?ç        r8   )rK   r{   ÚlinspacerJ   ÚexprO   Úfull)r=   r  r  Úscaled_max_depthrN   rO   Úinterp_weightÚbinss   &&&     r@   Ú_create_mixlog_binsÚ(CHMv2FeaturesToDepth._create_mixlog_bins{  s°   € ð  Ÿ>™>¨CÕ/ÐÜ—’ §¡Ð0@ÐQWÔXˆÜ�iŠiÜ�NŠNÜ—	’	œ%Ÿ*š* R¨¯©ÀÔGÓHÜ—	’	œ%Ÿ*š* RÐ)9ÔIÓJØØô	ó
ˆô Ÿš s¨C°ÔGˆØÕ" c¨MÕ&9¸VÕ%CÕCˆØˆrB   c                óh   <€ V ^8„  d   QhRS[ P                  RS[ P                  RS[ P                  /# )r1   Úinputr$  rw   ©r{   r¯   )rW   rX   s   "€r@   rY   r  �  s1   ø€ ÷ ñ ±e·l±lð É%Ï,É,ð Ñ[`×[gÑ[gñ rB   c                óL  € \         P                  ! V4      pVP                  ^RR7      pV) P                  R4      P	                  V P
                  4      V P                  ,           pW5,           pVP                  ^RR7      p\         P                  ! VRRRR7      P                  V P                  4      pWg,          pVP                  ^R^^4      P                  V P                  4      p	W‰,          P                  ^RR7      P                  V P                  4      p
V
R,          p
V
# )zEConverts depth bin logits to depth values using mixlog normalization.T©r½   Úkeepdimr  r  )ÚnanÚposinfÚneginfr  r²   )r{   ÚreluÚaminÚ	clamp_minÚ	clamp_maxr  r  ÚsumÚ
nan_to_numr  Úview)r=   r(  r$  ÚlogitsÚmin_per_sampleÚshiftÚ
logits_posÚdenomÚweightsÚbins_broadcastÚoutputs   &&&        r@   Ú _create_outputs_with_mixlog_normÚ5CHMv2FeaturesToDepth._create_outputs_with_mixlog_norm�  sö   € ä—’˜EÓ"ˆàŸ™¨°D˜Ó9ˆØ �×+Ñ+¨CÓ0×:Ñ:¸4×;WÑ;WÓXÐ[_×[qÑ[qÕqˆØ•^ˆ
à—‘ 1¨d�Ó3ˆÜ× Ò  ¨C¸ÀCÔH×RÑRÐSW×ScÑScÓdˆØÕ$ˆàŸ™ 1 b¨!¨QÓ/×9Ñ9¸$×:JÑ:JÓKˆØÕ*×/Ñ/°A¸tÐ/ÓD×NÑNÈt×O_ÑO_Ó`ˆà˜#•ˆàˆrB   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# )r1   Úxrw   r)  )rW   rX   s   "€r@   rY   r  £  s#   ø€ ÷ "ñ "™Ÿ™ð "©%¯,©,ñ "rB   c                ó˜  € VP                   ^,          pV^8”  Ed   V P                  R8X  d9   \        P                  ! V P                  V P
                  W!P                  R7      pMËV P                  R8X  d    \        P                  ! \        P                  ! \        P                  ! V P                  4      4      \        P                  ! \        P                  ! V P
                  4      4      VVP                  R7      p\        P                  ! V4      pMV P                  W!P                  4      pV P                  R
9   dÏ   V P                  R8X  d;   \        P                  ! V4      pRpWE,           pWDP                  ^RR7      ,          pMYV P                  R8X  d   \        P                  ! V^R7      pM/\        P                  ! V4      pWDP                  ^RR7      ,          p\        P                   ! R	WC.4      P#                  ^R7      pV# V P%                  W4      p V# \        P                  ! V4      V P                  ,           pV# )r2   rN   r  rO   rP   gš™™™™™¹?Tr+  ©r½   zikmn,k->imn)rN   rP   rQ   )rµ   rL   r{   r  rJ   rK   r  rO   Útensorr   r%  rM   r0  r4  rP   rQ   Úeinsumr¸   r?  )r=   rB  r  r$  ÚlogitÚepsr>  s   &&     r@   rÉ   ÚCHMv2FeaturesToDepth.forward£  s©  € Ø—‘˜•ˆà�A�:Ø×!Ñ! XÔ-Ü—~’~ d§n¡n°d·n±nÀf×U]ÑU]Ô^‘Ø×#Ñ# uÔ,Ü—~’~Ü—I’IœeŸlšl¨4¯>©>Ó:Ó;Ü—I’IœeŸlšl¨4¯>©>Ó:Ó;ØØŸ8™8ô	�ô —y’y “‘à×/Ñ/°¿¹ÓA�à×!Ñ!Ð%EÔEØ×%Ñ%¨Ô1Ü!ŸJšJ q›M�EØ�CØ!�K�EØ!§I¡I°!¸T IÓ$BÕB‘EØ×'Ñ'¨9Ô4Ü!ŸMšM¨!°Ô3‘Eä!ŸMšM¨!Ó,�EØ!§I¡I°!¸T IÓ$BÕB�EÜŸš m°e°]ÓC×MÑMÐRSÐMÓT�ð ˆð	 ×>Ñ>¸qÓG‘ð ˆô —Z’Z “] T§^¡^Õ3ˆFàˆrB   )r  r  r  rL   rK   rJ   rM   )r[   r\   r]   r^   r_   r¢   r%  r?  rÉ   rc   rd   re   rf   s   @@r@   r  r  n  s5   ù‡ € ÙT÷!ó !÷ð ÷*ð ÷&"÷ "ð "rB   r  c                   ój   a a€ ] tR tRt oRtRtR	tRtRtRt	Rt
RtV3R lV 3R lltV3R ltRtVtV ;t# )
ÚCHMv2PreTrainedModeliÈ  r   Úpixel_valuesTc                ó   <€ V ^8„  d   QhRR/# )r1   rw   Nr8   )rW   rX   s   "€r@   rY   Ú!CHMv2PreTrainedModel.__annotate__Ô  s   ø€ ÷ )ñ ) tñ )rB   c                óv  <€ \         SV `  V4       \        V\        P                  \        P
                  \        P                  34      '       dj   \        P                  ! VP                  R V P                  P                  R7       VP                  e#   \        P                  ! VP                  4       R# R# R# )r  )ÚmeanÚstdN)r;   Ú_init_weightsr´   r   r¨   r×   ÚConvTranspose2dÚinitÚtrunc_normal_Úweightrœ   rE   rÖ   Úzeros_)r=   Úmoduler?   s   &&€r@   rR  Ú"CHMv2PreTrainedModel._init_weightsÔ  sw   ø€ Ü‰Ñ˜fÔ%Ü�fœrŸy™y¬"¯)©)´R×5GÑ5GÐH×IÒIÜ×Ò˜vŸ}™}°3¸D¿K¹K×<YÑ<YÕZØ�{‰{Ò&Ü—’˜FŸK™KÖ(ñ 'ñ JrB   c                ó&   <€ V ^8„  d   Qh/ S[ ;R&   # r›   r�   )rW   rX   s   "€r@   rY   rN  È  s   ø‡ ‚ áÑò rB   r8   )Úimage)r[   r\   r]   r^   Úbase_model_prefixÚmain_input_nameÚinput_modalitiesÚsupports_gradient_checkpointingÚ_supports_sdpaÚ_supports_flash_attnÚ_supports_flex_attnÚ_supports_attention_backendrR  rb   rc   rd   re   rf   s   @@r@   rK  rK  È  sF   ù‡ € ð  ÐØ$€OØ!ÐØ&*Ð#Ø€NØÐØÐØ"&Ð÷)ó )÷ … rB   rK  z…
    CHMv2 Model with a depth estimation head on top (consisting of convolutional layers) e.g. for canopy height
    estimation.
    )Úcustom_introc                   ón   a a€ ] tR tRt oV3R lV 3R lltR t]]RV3R lR ll4       4       tRt	Vt
V ;t# )	ÚCHMv2ForDepthEstimationiÜ  c                ó    <€ V ^8„  d   QhRS[ /# r›   r�   )rW   rX   s   "€r@   rY   Ú$CHMv2ForDepthEstimation.__annotate__ã  s   ø€ ÷ ñ ™{ñ rB   c                ó¦   <€ \         SV `  V4       \        V4      V n        \	        V4      V n        \        V4      V n        V P                  4        R # rŽ   )	r;   r¢   r   Úbackboneró   rê   r  Úfeatures_to_depthÚ	post_initr  s   &&€r@   r¢   Ú CHMv2ForDepthEstimation.__init__ã  s?   ø€ Ü‰Ñ˜Ô ä% fÓ-ˆŒÜ˜fÓ%ˆŒ	Ü!5°fÓ!=ˆÔà�‰ÖrB   c                ó6   € V P                   P                  4       # rŽ   )rj  Úget_input_embeddings)r=   s   &r@   ro  Ú,CHMv2ForDepthEstimation.get_input_embeddingsì  s   € Ø�}‰}×1Ñ1Ó3Ð3rB   c                óx   <€ V ^8„  d   QhRS[ P                  RS[ P                  R,          RS[S[,          RS[/# )r1   rL  ÚlabelsNr>   rw   )r{   ÚFloatTensorÚ
LongTensorr   r   r	   )rW   rX   s   "€r@   rY   rh  ñ  sJ   ø€ ÷  
ñ  
á×'Ñ'ð 
ñ × Ñ  4Õ'ð 
ñ Ñ+Õ,ð	 
ñ
 
ñ 
rB   c                ó¸  € RpVe   \        R4      hVP                  w   rVpV P                  P                  pWh,          p	Wx,          p
V P                  ! V3/ VB p\        \        VP                  VP                  4      4      pV P                  WÉV
4      pV P                  V4      pVP                  ^R7      p\        VVVP                  VP                  R7      # )z�
labels (`torch.LongTensor` of shape `(batch_size, height, width)`, *optional*):
    Ground truth depth estimation maps for computing the loss.
NzTraining is not implemented yetrD  )Úlossr�   r®   Ú
attentions)ÚNotImplementedErrorrµ   rœ   rD   rj  rU   r„   Úfeature_mapsÚ
cls_tokensrê   rk  r‡   r	   r®   rw  )r=   rL  rr  r>   rv  r«   rß   rà   rD   r¿   rÀ   Úbackbone_outputÚintermediate_featuresÚhead_outputr�   s   &&&,           r@   rÉ   ÚCHMv2ForDepthEstimation.forwardï  sÖ   € ð ˆØÒÜ%Ð&GÓHÐHà*×0Ñ0Ñˆˆ1�eØ—[‘[×+Ñ+ˆ
ØÕ+ˆØÕ)ˆàŸ-š-¨Ñ?¸Ñ?ˆÜ $¤S¨×)EÑ)EÀ×GaÑGaÓ%bÓ cÐà—i‘iÐ 5À[ÓQˆà×0Ñ0°Ó=ˆØ)×1Ñ1°aÐ1Ó8ˆä#ØØ+Ø)×7Ñ7Ø&×1Ñ1ô	
ð 	
rB   )rj  rk  rê   rŽ   )r[   r\   r]   r^   r¢   ro  r   r   rÉ   rc   rd   re   rf   s   @@r@   rf  rf  Ü  s:   ù‡ € ÷ó ò4ð Ø÷ 
ñ  
ó ó ÷ 
ð  
rB   rf  )r   rs   rf  rK  )3r_   Útypingr   r{   Úhuggingface_hub.dataclassesr   r   Ú r   rT  Úbackbone_utilsr   r   Úconfiguration_utilsr   Úmodeling_outputsr	   Úmodeling_utilsr
   Úprocessing_utilsr   r   Úutilsr   r   r   r   r   Úautor   Ú&depth_anything.modeling_depth_anythingr   Údpt.image_processing_dptr   Údpt.modeling_dptr   r   r   rh   rs   r•   ÚModuler™   rÎ   rÐ   rä   ró   r  rK  rf  Ú__all__r8   rB   r@   Ú<module>rŽ     sC  ðñ @å ã Ý .Ý å &ß RÝ 3Ý 4Ý -ß 4ß hÕ hÝ õõ 9ß Lñ ÐBÔCØôQ(Ð"ó Q(ó ó DðQ(ôh °Eõ ô(1Ð+ô 1ôh	Ð-ô 	ô5˜2Ÿ9™9ô 5ôp	Ð?ô 	ô"˜bŸi™iô "ôJ˜BŸI™Iô ô2*�—	‘	ô *ôZW˜2Ÿ9™9ô Wðt ô)˜?ó )ó ð)ñ& ðôô/
Ð2ó /
óð/
òd‚rB   