+
    "Ý³j4  ã                   óZ  € ^ RI t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
 ]P                  P                  ]P                  P                  ]
P                  ^ ,          R4      4      '       d	   ]! R4      hRRR	RR
RRRRRRRRRRR /tRRR. R3R ltRRR. R3R ltR tR tR tR tR# )!é    N)Úcompose)Úinstantiate)Ú	OmegaConf)Úsam2r   aè  You're likely running Python from the parent directory of the sam2 repository (i.e. the directory where https://github.com/facebookresearch/sam2 is cloned into). This is not supported since the `sam2` Python package could be shadowed by the repository name (the repository is also named `sam2` and contains the Python package in `sam2/sam2`). Please run Python from another directory (e.g. from the repo dir rather than its parent dir, or from your home directory) after installing SAM 2.zfacebook/sam2-hiera-tinyzfacebook/sam2-hiera-smallzfacebook/sam2-hiera-base-pluszfacebook/sam2-hiera-largezfacebook/sam2.1-hiera-tinyzfacebook/sam2.1-hiera-smallzfacebook/sam2.1-hiera-base-pluszfacebook/sam2.1-hiera-largeÚcudaÚevalTc                 ó$  € V'       d   VP                  4       pV. RO,          p\        WR7      p\        P                  ! V4       \	        VP
                  RR7      p\        W�4       VP                  V4      pVR8X  d   VP                  4        V# )úH++model.sam_mask_decoder_extra_args.dynamic_multimask_via_stability=true©Úconfig_nameÚ	overridesT©Ú_recursive_r   )r
   úJ++model.sam_mask_decoder_extra_args.dynamic_multimask_stability_delta=0.05úK++model.sam_mask_decoder_extra_args.dynamic_multimask_stability_thresh=0.98)	Úcopyr   r   Úresolver   ÚmodelÚ_load_checkpointÚtor   )	Úconfig_fileÚ	ckpt_pathÚdeviceÚmodeÚhydra_overrides_extraÚapply_postprocessingÚkwargsÚcfgr   s	   &&&&&&,  Ú_/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torchao/_models/sam2/build_sam.pyÚ
build_sam2r    G   s{   € ÷ Ø 5× :Ñ :Ó <ÐØò "
õ 	
Ðô ˜kÔ
K€CÜ×Ò�cÔÜ˜Ÿ	™	¨tÔ4€EÜ�UÔ&Ø�H‰H�VÓ€EØˆv„~Ø�
‰
ŒØ€Ló    c                 óL  € R .pV'       d   VP                  4       pV. RO,          pVP                  V4       \        WR7      p\        P                  ! V4       \        VP                  RR7      p	\        W‘4       V	P                  V4      p	VR8X  d   V	P                  4        V	# )zM++model._target_=torchao._models.sam2.sam2_video_predictor.SAM2VideoPredictorr   Tr   r   )r
   r   r   z/++model.binarize_mask_from_pts_for_mem_enc=truez++model.fill_hole_area=8)
r   Úextendr   r   r   r   r   r   r   r   )
r   r   r   r   r   r   r   Úhydra_overridesr   r   s
   &&&&&&,   r   Úbuild_sam2_video_predictorr%   c   s™   € ð 	Xð€O÷ Ø 5× :Ñ :Ó <ÐØò 	"
õ 		
Ðð ×ÑÐ0Ô1ô ˜kÔ
E€CÜ×Ò�cÔÜ˜Ÿ	™	¨tÔ4€EÜ�UÔ&Ø�H‰H�VÓ€EØˆv„~Ø�
‰
ŒØ€Lr!   c                 óD   € ^ RI Hp \        V ,          w  r#V! WR7      pW$3# )r   )Úhf_hub_download)Úrepo_idÚfilename)Úhuggingface_hubr'   ÚHF_MODEL_ID_TO_FILENAMES)Úmodel_idr'   r   Úcheckpoint_namer   s   &    r   Ú_hf_downloadr.   ˆ   s%   € Ý/ä#;¸HÕ#EÑ €KÙ¨ÔK€IØÐ!Ð!r!   c                 ó:   € \        V 4      w  r#\        RR VRV/VB # ©r   r   © )r.   r    ©r,   r   r   r   s   &,  r   Úbuild_sam2_hfr3   �   s'   € Ü)¨(Ó3Ñ€KÜÑM +ÐM¸ÐMÀfÑMÐMr!   c                 ó:   € \        V 4      w  r#\        RR VRV/VB # r0   )r.   r%   r2   s   &,  r   Úbuild_sam2_video_predictor_hfr5   •   s4   € Ü)¨(Ó3Ñ€KÜ%ñ ØðØ+4ðØ8>ñð r!   c                 óD  € Veœ   \         P                  ! VRRR7      R,          pV P                  V4      w  r4V'       d!   \        P                  ! V4       \        4       hV'       d!   \        P                  ! V4       \        4       h\        P                  ! R4       R # R # )NÚcpuT)Úmap_locationÚweights_onlyr   zLoaded checkpoint sucessfully)ÚtorchÚloadÚload_state_dictÚloggingÚerrorÚRuntimeErrorÚinfo)r   r   ÚsdÚmissing_keysÚunexpected_keyss   &&   r   r   r   œ   sr   € ØÒÜ�ZŠZ˜	°ÀDÔIÈ'ÕRˆØ(-×(=Ñ(=¸bÓ(AÑ%ˆßÜ�MŠM˜,Ô'Ü“.Ð ßÜ�MŠM˜/Ô*Ü“.Ð Ü�ŠÐ4Ö5ñ r!   )zconfigs/sam2/sam2_hiera_t.yamlzsam2_hiera_tiny.pt)zconfigs/sam2/sam2_hiera_s.yamlzsam2_hiera_small.pt)zconfigs/sam2/sam2_hiera_b+.yamlzsam2_hiera_base_plus.pt)zconfigs/sam2/sam2_hiera_l.yamlzsam2_hiera_large.pt)z"configs/sam2.1/sam2.1_hiera_t.yamlzsam2.1_hiera_tiny.pt)z"configs/sam2.1/sam2.1_hiera_s.yamlzsam2.1_hiera_small.pt)z#configs/sam2.1/sam2.1_hiera_b+.yamlzsam2.1_hiera_base_plus.pt)z"configs/sam2.1/sam2.1_hiera_l.yamlzsam2.1_hiera_large.pt)r=   Úosr:   Úhydrar   Úhydra.utilsr   Ú	omegaconfr   Útorchao._modelsr   ÚpathÚisdirÚjoinÚ__path__r?   r+   r    r%   r.   r3   r5   r   r1   r!   r   Ú<module>rM      sù   ðó Û 	ã Ý Ý #Ý å  ð
 ‡7�7‡=�=�—‘—‘˜dŸm™m¨AÕ.°Ó7×8Ò8ñ
 ð	[óð ð ð !ð  ð "ð $ð &ð  ð "ð !ð #ð "ð $ð &ð (ð "ð $ð;!Ð ðL ØØ	ØØôð< ØØ	ØØô"òJ"òNò
ô
6r!   