+
    QV-j"™  ã                   óâ  € ^ RI t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^ RI	t
^ RIHt ^ RIHt ^RIHt ^RIHt ^R	IHt ^R
IHtHtHtHt ^RIHtHt ^RIHtHtH t H!t!H"t"H#t#H$t$H%t%H&t&H't'H(t( ^RI)H*t*H+t+ ^RI,H-t- ^RI.H/t/H0t0H1t1H2t2H3t3H4t4H5t5H6t6H7t7 ]$! 4       '       d   ^ RI8t8]&! 4       '       d   ^ RI9H:u H;u H<t= ]! 4       '       d   ^RIH>t> ]'P~                  ! ]@4      tARtB]"! R]B4      ]-! RR7       ! R R]4      4       4       tC]#! ]CPˆ                  4      ]CnD        ]CPˆ                  PŠ                  e:   ]CPˆ                  PŠ                  P�                  RRRR7      ]CPˆ                  nE        R# R# )é    N)ÚCallable)Úpartial)ÚAny)Úis_offline_mode)Úvalidate_typed_dict)Úcustom_object_save)ÚTorchvisionBackend©ÚBatchFeature)ÚChannelDimensionÚSizeDictÚis_vision_availableÚvalidate_kwargs©ÚUnpackÚVideosKwargs)ÚIMAGE_PROCESSOR_NAMEÚPROCESSOR_NAMEÚVIDEO_PROCESSOR_NAMEÚ
TensorTypeÚadd_start_docstringsÚ	copy_funcÚis_torch_availableÚis_torchcodec_availableÚis_torchvision_v2_availableÚloggingÚsafe_load_json_file)Úcached_fileÚhf_api)Úrequires)	Ú
VideoInputÚVideoMetadataÚgroup_videos_by_shapeÚinfer_channel_dimension_formatÚis_valid_videoÚ
load_videoÚmake_batched_metadataÚmake_batched_videosÚreorder_videos)ÚPILImageResamplingaÊ  
    Args:
        do_resize (`bool`, *optional*, defaults to `self.do_resize`):
            Whether to resize the video's (height, width) dimensions to the specified `size`. Can be overridden by the
            `do_resize` parameter in the `preprocess` method.
        size (`dict`, *optional*, defaults to `self.size`):
            Size of the output video after resizing. Can be overridden by the `size` parameter in the `preprocess`
            method.
        size_divisor (`int`, *optional*, defaults to `self.size_divisor`):
            The size by which to make sure both the height and width can be divided.
        default_to_square (`bool`, *optional*, defaults to `self.default_to_square`):
            Whether to default to a square video when resizing, if size is an int.
        resample (`PILImageResampling`, *optional*, defaults to `self.resample`):
            Resampling filter to use if resizing the video. Only has an effect if `do_resize` is set to `True`. Can be
            overridden by the `resample` parameter in the `preprocess` method.
        do_center_crop (`bool`, *optional*, defaults to `self.do_center_crop`):
            Whether to center crop the video to the specified `crop_size`. Can be overridden by `do_center_crop` in the
            `preprocess` method.
        crop_size (`dict[str, int]` *optional*, defaults to `self.crop_size`):
            Size of the output video after applying `center_crop`. Can be overridden by `crop_size` in the `preprocess`
            method.
        do_rescale (`bool`, *optional*, defaults to `self.do_rescale`):
            Whether to rescale the video by the specified scale `rescale_factor`. Can be overridden by the
            `do_rescale` parameter in the `preprocess` method.
        rescale_factor (`int` or `float`, *optional*, defaults to `self.rescale_factor`):
            Scale factor to use if rescaling the video. Only has an effect if `do_rescale` is set to `True`. Can be
            overridden by the `rescale_factor` parameter in the `preprocess` method.
        do_normalize (`bool`, *optional*, defaults to `self.do_normalize`):
            Whether to normalize the video. Can be overridden by the `do_normalize` parameter in the `preprocess`
            method. Can be overridden by the `do_normalize` parameter in the `preprocess` method.
        image_mean (`float` or `list[float]`, *optional*, defaults to `self.image_mean`):
            Mean to use if normalizing the video. This is a float or list of floats the length of the number of
            channels in the video. Can be overridden by the `image_mean` parameter in the `preprocess` method. Can be
            overridden by the `image_mean` parameter in the `preprocess` method.
        image_std (`float` or `list[float]`, *optional*, defaults to `self.image_std`):
            Standard deviation to use if normalizing the video. This is a float or list of floats the length of the
            number of channels in the video. Can be overridden by the `image_std` parameter in the `preprocess` method.
            Can be overridden by the `image_std` parameter in the `preprocess` method.
        do_convert_rgb (`bool`, *optional*, defaults to `self.image_std`):
            Whether to convert the video to RGB.
        video_metadata (`VideoMetadata`, *optional*):
            Metadata of the video containing information about total duration, fps and total number of frames.
        do_sample_frames (`int`, *optional*, defaults to `self.do_sample_frames`):
            Whether to sample frames from the video before processing or to process the whole video.
        num_frames (`int`, *optional*, defaults to `self.num_frames`):
            Maximum number of frames to sample when `do_sample_frames=True`.
        fps (`int` or `float`, *optional*, defaults to `self.fps`):
            Target frames to sample per second when `do_sample_frames=True`.
        return_tensors (`str` or `TensorType`, *optional*):
            Returns stacked tensors if set to `pt, otherwise returns a list of tensors.
        data_format (`ChannelDimension` or `str`, *optional*, defaults to `ChannelDimension.FIRST`):
            The channel dimension format for the output video. Can be one of:
            - `"channels_first"` or `ChannelDimension.FIRST`: video in (num_channels, height, width) format.
            - `"channels_last"` or `ChannelDimension.LAST`: video in (height, width, num_channels) format.
            - Unset: Use the channel dimension format of the input video.
        input_data_format (`ChannelDimension` or `str`, *optional*):
            The channel dimension format for the input video. If unset, the channel dimension format is inferred
            from the input video. Can be one of:
            - `"channels_first"` or `ChannelDimension.FIRST`: video in (num_channels, height, width) format.
            - `"channels_last"` or `ChannelDimension.LAST`: video in (height, width, num_channels) format.
            - `"none"` or `ChannelDimension.NONE`: video in (height, width) format.
        device (`torch.device`, *optional*):
            The device to process the videos on. If unset, the device is inferred from the input videos.
        return_metadata (`bool`, *optional*):
            Whether to return video metadata or not.
        z!Constructs a base VideoProcessor.)Úbackendsc                   ó.  a a€ ] tR t^‘t oR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RtRtRtRtRtRt]t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+V3R lR lltR+V3R lR lltR+V3R lR llt] ! ]!4      V3R lR l4       t"R,V3R lR llt#]$R-V3R lR ll4       t%R.V3R lR llt&]$V3R lR l4       t']$V3R lR l4       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3R$ lR% l4       t-]$R/R& l4       t.R,V3R' lR( llt/R)t0Vt1V ;t2# )0ÚBaseVideoProcessorNTFÚpixel_values_videosc                ó4   <€ V ^8„  d   QhRS[ S[,          RR/# )é   ÚkwargsÚreturnNr   )ÚformatÚ__classdict__s   "€Út/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/transformers/video_processing_utils.pyÚ__annotate__ÚBaseVideoProcessor.__annotate__®   s    ø€ ÷ #ñ #¡©Õ!5ð #¸$ñ #ó    c                ó(   <€ \         SV `  ! R/ VB  R # )N© )ÚsuperÚ__init__)Úselfr1   Ú	__class__s   &,€r5   r<   ÚBaseVideoProcessor.__init__®   s   ø€ Ü‰ÒÑ"˜6Ô"r8   c                ó    <€ V ^8„  d   QhRS[ /# ©r0   r2   r
   )r3   r4   s   "€r5   r6   r7   ±   s   ø€ ÷ 1ñ 1©Lñ 1r8   c                ó(   € V P                   ! V3/ VB # ©N)Ú
preprocess)r=   Úvideosr1   s   &&,r5   Ú__call__ÚBaseVideoProcessor.__call__±   s   € Ø�Š˜vÑ0¨Ñ0Ð0r8   c                ó$   <€ V ^8„  d   QhRRRS[ /# )r0   Úvideoútorch.Tensorr2   )r!   )r3   r4   s   "€r5   r6   r7   ´   s   ø€ ÷ ñ àðñ 
ñr8   c                ó,  € \         P                  ! V4      pVP                  R,          ^8X  g!   VR,          ^ÿ8  P                  4       '       g   V# VR,          R,          p^VR,          ,
          ^ÿ,          VR,          VR,          ,          ,           pV# )z—
Converts a video to RGB format.

Args:
    video (`"torch.Tensor"`):
        The video to convert.

Returns:
    `torch.Tensor`: The converted video.
g     ào@éýÿÿÿ).é   ºNNNrN   ).NrN   rN   ).:NrM   NrN   rN   )ÚtvFÚgrayscale_to_rgbÚshapeÚany)r=   rI   Úalphas   && r5   Úconvert_to_rgbÚ!BaseVideoProcessor.convert_to_rgb´   s€   € ô ×$Ò$ UÓ+ˆØ�;‰;�r�?˜aÔ¨¨lÕ(;¸cÑ(A×'FÑ'F×'HÒ'HØˆLð �lÕ# eÕ+ˆØ�U˜?Õ+Õ+¨sÕ2°U¸?Õ5KÈeÐTaÕNbÕ5bÕbˆØˆr8   c                óX   <€ V ^8„  d   QhRS[ RS[R,          RS[S[,          R,          /# )r0   ÚmetadataÚ
num_framesNÚfps)r"   ÚintÚfloat)r3   r4   s   "€r5   r6   r7   Í   s6   ø€ ÷ 3ñ 3áð3ñ ˜$•Jð3ñ ‘5�[˜4Õñ	3r8   c                óø  € Ve   Ve   \        R4      hVe   TMV P                  pVe   TMV P                  pVP                  pVfD   Ve@   Ve   VP                  f   \        R4      h\	        WQP                  ,          V,          4      pW%8”  d   \        RV RV R24      hVe/   \
        P                  ! ^ WUV,          4      P	                  4       pV# \
        P                  ! ^ V4      P	                  4       pV# )aµ  
Default sampling function which uniformly samples the desired number of frames between 0 and total number of frames.
If `fps` is passed along with metadata, `fps` frames per second are sampled uniformty. Arguments `num_frames`
and `fps` are mutually exclusive.

Args:
    metadata (`VideoMetadata`):
        Metadata of the video containing information about total duration, fps and total number of frames.
    num_frames (`int`, *optional*):
        Maximum number of frames to sample. Defaults to `self.num_frames`.
    fps (`int` or `float`, *optional*):
        Target frames to sample per second. Defaults to `self.fps`.

Returns:
    np.ndarray:
        Indices to sample video frames.
zc`num_frames`, `fps`, and `sample_indices_fn` are mutually exclusive arguments, please use only one!zÈAsked to sample `fps` frames per second but no video metadata was provided which is required when sampling with `fps`. Please pass in `VideoMetadata` object or use a fixed `num_frames` per input videoz(Video can't be sampled. The `num_frames=z` exceeds `total_num_frames=z`. )Ú
ValueErrorrX   rY   Útotal_num_framesrZ   ÚtorchÚarange)r=   rW   rX   rY   r1   r^   Úindicess   &&&&,  r5   Úsample_framesÚ BaseVideoProcessor.sample_framesÍ   s
  € ð0 Š?˜zÒ5ÜØuóð ð $.Ò#9‘Z¸t¿¹ˆ
Ø’_‰c¨$¯(©(ˆØ#×4Ñ4Ðð Ò #¢/ØÒ 8§<¡<Ò#7Ü ðhóð ô Ð-·±Õ<¸sÕBÓCˆJàÔ(ÜØ:¸:¸,ÐFbÐcsÐbtÐtwÐxóð ð Ò!Ü—l’l 1Ð&6È:Õ8UÓV×ZÑZÓ\ˆGð ˆô —l’l 1Ð&6Ó7×;Ñ;Ó=ˆGØˆr8   c                ór   <€ V ^8„  d   QhRS[ RS[S[,          RS[R,          RS[R,          RS[R,          /# )r0   rE   Úvideo_metadataÚdo_sample_framesNÚsample_indices_fnr2   rJ   )r!   r"   ÚdictÚboolr   Úlist)r3   r4   s   "€r5   r6   r7     sO   ø€ ÷ &&ñ &&áð&&ñ &©Õ,ð&&ñ  �+ð	&&ñ
 $ d�?ð&&ñ 
ˆnÕ	ñ&&r8   c                ó¤  € \        V4      p\        WR7      p\        V^ ,          4      '       d_   V'       dW   . p. p\        W4       F<  w  rxV! VR7      p	W˜n        VP                  Wy,          4       VP                  V4       K>  	  TpTpW3# \        V^ ,          4      '       gŸ   \        V^ ,          \        4      '       dn   V P                  V4       U
Uu. uF9  p
\        P                  ! V
 Uu. uF  q°P                  V4      NK  	  up^ R7      NK;  	  pp
pV'       d   \        R4      h W3# V P                  WR7      w  rW3# u upi u upp
i )z2
Decode input videos and sample frames if needed.
)re   )rW   )ÚdimzUSampling frames from a list of images is not supported! Set `do_sample_frames=False`.©rg   )r(   r'   r%   ÚzipÚframes_indicesÚappendÚ
isinstancerj   Úfetch_imagesr_   ÚstackÚprocess_imager]   Úfetch_videos)r=   rE   re   rf   rg   Úsampled_videosÚsampled_metadatarI   rW   ra   ÚimagesÚimages   &&&&&       r5   Ú_decode_and_sample_videosÚ,BaseVideoProcessor._decode_and_sample_videos  sQ  € ô % VÓ,ˆÜ.¨vÔUˆô ˜& �)×$Ò$×)9ØˆNØ!ÐÜ#& vÖ#>‘�Ù+°XÔ>�Ø*1Ô'Ø×%Ñ% e¥nÔ5Ø ×'Ñ'¨Ö1ñ	 $?ð
 $ˆFØ-ˆNð Ð%Ð%ô    q¥	×*Ò*Ü˜& �)¤T×*Ò*ð #'×"3Ñ"3°FÔ";ôá";˜ô —K’KÉÓ OÉ¸u×!3Ñ!3°EÖ!:ÉÑ OÐUV×WÙ";ð ñ ÷ $Ü$Øoóð ð $ð Ð%Ð%ð *.×):Ñ):¸6Ð):Ó)gÑ&�àÐ%Ð%ùò !Pùós   ÃEÃ0EÄ	EÅEc          	      ól   <€ V ^8„  d   QhRS[ RS[S[,          R,          RS[R,          RS[R,          /# )r0   rE   Úinput_data_formatNÚdevicer2   rJ   )r!   Ústrr   rj   )r3   r4   s   "€r5   r6   r7   *  sG   ø€ ÷  ñ  áð ñ Ñ!1Õ1°DÕ8ð ñ �d•
ð	 ñ
 
ˆnÕ	ñ r8   c                ó|  € . pV F³  p\        V\        P                  4      '       d%   \        P                  ! V4      P                  4       pVf   \        V4      pV\        P                  8X  d#   VP                  ^ ^^^4      P                  4       pVe   VP                  V4      pVP                  V4       Kµ  	  V# )z*
Prepare the input videos for processing.
)rq   ÚnpÚndarrayr_   Ú
from_numpyÚ
contiguousr$   r   ÚLASTÚpermuteÚtorp   )r=   rE   r}   r~   Úprocessed_videosrI   s   &&&&  r5   Ú_prepare_input_videosÚ(BaseVideoProcessor._prepare_input_videos*  s§   € ð ÐÛˆEä˜%¤§¡×,Ò,ä×(Ò(¨Ó/×:Ñ:Ó<�ð !Ò(Ü$BÀ5Ó$IÐ!à Ô$4×$9Ñ$9Ô9ØŸ™ a¨¨A¨qÓ1×<Ñ<Ó>�àÒ!ØŸ™ Ó(�à×#Ñ# EÖ*ñ! ð"  Ðr8   c                ó<   <€ V ^8„  d   QhRS[ RS[S[,          RS[/# )r0   rE   r1   r2   )r!   r   r   r   )r3   r4   s   "€r5   r6   r7   J  s.   ø€ ÷ *#ñ *#áð*#ñ ™Õ&ð*#ñ 
ñ	*#r8   c           	     ó(  € \        VP                  4       \        V P                  P                  P                  4       4      R .,           R7       \        V P                  V4       V P                  P                   F  pVP                  V\        WR4      4       K!  	  VP                  R4      pVP                  R4      pVP                  R4      pVP                  R4      pV'       d   \        V P                  3/ VB MRpV P                  VVVVR7      w  rV P                  WVR7      pV P                  ! R/ VB pV P                  ! R/ VB  VP                  R	4       VP                  R
4      p	V P                  ! RRV/VB p
V	'       d   WzR&   V
# )Úreturn_tensors)Úcaptured_kwargsÚvalid_processor_keysNr}   rf   r~   re   )re   rf   rg   )rE   r}   r~   Údata_formatÚreturn_metadatarE   r:   )r   Úkeysrj   Úvalid_kwargsÚ__annotations__r   Ú
setdefaultÚgetattrÚpopr   rb   rz   r‰   Ú_standardize_kwargsÚ_validate_preprocess_kwargsÚ_preprocess)r=   rE   r1   Ú
kwarg_namer}   rf   r~   re   rg   r‘   Úpreprocessed_videoss   &&,        r5   rD   ÚBaseVideoProcessor.preprocessG  s  € ô 	Ø"ŸK™K›MÜ!% d×&7Ñ&7×&GÑ&G×&LÑ&LÓ&NÓ!OÐScÐRdÕ!dõ	
ô 	˜D×-Ñ-¨vÔ6ð ×+Ñ+×;Ô;ˆJØ×Ñ˜j¬'°$ÀDÓ*IÖJñ <ð #ŸJ™JÐ':Ó;ÐØ!Ÿ:™:Ð&8Ó9ÐØ—‘˜HÓ%ˆØŸ™Ð$4Ó5ˆçEUœG D×$6Ñ$6ÑA¸&ÒAÐ[_ÐØ!%×!?Ñ!?ØØ)Ø-Ø/ð	 "@ó "
Ñˆð ×+Ñ+°6ÐgmÐ+Ónˆà×)Ò)Ñ3¨FÑ3ˆØ×(Ò(Ñ2¨6Ò2ð 	�
‰
�=Ô!Ø Ÿ*™*Ð%6Ó7ˆà"×.Ò.ÑG°fÐGÀÑGÐßØ4BÐ 0Ñ1Ø"Ð"r8   c                óô   <€ V ^8„  d   QhRS[ R,          RS[RS[RS[RRRS[R	S[R
S[RS[RS[RS[S[ S[,          ,          R,          RS[S[ S[,          ,          R,          RS[S[,          R,          RS[/# )r0   rE   rJ   Údo_convert_rgbÚ	do_resizeÚsizeÚresamplez7PILImageResampling | tvF.InterpolationMode | int | NoneÚdo_center_cropÚ	crop_sizeÚ
do_rescaleÚrescale_factorÚdo_normalizeÚ
image_meanNÚ	image_stdr�   r2   )rj   ri   r   r[   r   r   r   )r3   r4   s   "€r5   r6   r7   v  sÓ   ø€ ÷ +hñ +há�^Õ$ð+hñ ð+hñ ð	+hñ
 ð+hð Lð+hñ ð+hñ ð+hñ ð+hñ ð+hñ ð+hñ ™D¡�KÕ'¨$Õ.ð+hñ ™4¡�;Õ&¨Õ-ð+hñ ™jÕ(¨4Õ/ð+hñ  
ñ!+hr8   c           	     óÐ  € \        V4      w  pp/ pVP                  4        F?  w  ppV'       d   V P                  V4      pV'       d   V P                  VWER 7      pVVV&   KA  	  \	        VV4      p\        V4      w  pp/ pVP                  4        F9  w  ppV'       d   V P                  VV4      pV P                  VW‰W«V4      pVVV&   K;  	  \	        VV4      p\        RV/VR7      # ))r¡   r¢   r.   )ÚdataÚtensor_type)r#   ÚitemsrT   Úresizer)   Úcenter_cropÚrescale_and_normalizer   )r=   rE   rŸ   r    r¡   r¢   r£   r¤   r¥   r¦   r§   r¨   r©   r�   r1   Úgrouped_videosÚgrouped_videos_indexÚresized_videos_groupedrQ   Ústacked_videosÚresized_videosÚprocessed_videos_groupedrˆ   s   &&&&&&&&&&&&&&,        r5   rš   ÚBaseVideoProcessor._preprocessv  s	  € ô$ 0EÀVÓ/LÑ,ˆÐ,Ø!#ÐØ%3×%9Ñ%9Ö%;Ñ!ˆE�>ßØ!%×!4Ñ!4°^Ó!D�ßØ!%§¡¨^À$ Ó!Z�Ø,:Ð" 5Ó)ñ &<ô (Ð(>Ð@TÓUˆô 0EÀ^Ó/TÑ,ˆÐ,Ø#%Ð Ø%3×%9Ñ%9Ö%;Ñ!ˆE�>ßØ!%×!1Ñ!1°.À)Ó!L�à!×7Ñ7Ø 
¸LÐV_óˆNð /=Ð$ UÓ+ñ &<ô *Ð*BÐDXÓYÐäÐ"7Ð9IÐ!JÐXfÔgÐgr8   c                ó²   <€ V ^8„  d   QhRS[ S[P                  ,          RS[ S[P                  ,          R,          RS[RS[RS[ S[,          R,          RS[ /# )r0   Úpretrained_model_name_or_pathÚ	cache_dirNÚforce_downloadÚlocal_files_onlyÚtokenÚrevision©r   ÚosÚPathLikeri   )r3   r4   s   "€r5   r6   r7   ¤  so   ø€ ÷ `=ñ `=á'*©R¯[©[Õ'8ð`=ñ ™Ÿ™Õ$ tÕ+ð`=ñ ð	`=ñ
 ð`=ñ ‘T�z˜DÕ ð`=ñ ñ`=r8   c                ó‚   € W'R&   W7R&   WGR&   WgR&   Ve   WWR&   V P                   ! V3/ VB w  r‡V P                  ! V3/ VB # )aC  
Instantiate a type of [`~video_processing_utils.VideoProcessorBase`] from an video processor.

Args:
    pretrained_model_name_or_path (`str` or `os.PathLike`):
        This can be either:

        - a string, the *model id* of a pretrained video hosted inside a model repo on
          huggingface.co.
        - a path to a *directory* containing a video processor file saved using the
          [`~video_processing_utils.VideoProcessorBase.save_pretrained`] method, e.g.,
          `./my_model_directory/`.
        - a path to a saved video processor JSON *file*, e.g.,
          `./my_model_directory/video_preprocessor_config.json`.
    cache_dir (`str` or `os.PathLike`, *optional*):
        Path to a directory in which a downloaded pretrained model video processor should be cached if the
        standard cache should not be used.
    force_download (`bool`, *optional*, defaults to `False`):
        Whether or not to force to (re-)download the video processor files and override the cached versions if
        they exist.
    proxies (`dict[str, str]`, *optional*):
        A dictionary of proxy servers to use by protocol or endpoint, e.g., `{'http': 'foo.bar:3128',
        'http://hostname': 'foo.bar:4012'}.` The proxies are used on each request.
    token (`str` or `bool`, *optional*):
        The token to use as HTTP bearer authorization for remote files. If `True`, or not specified, will use
        the token generated when running `hf auth login` (stored in `~/.huggingface`).
    revision (`str`, *optional*, defaults to `"main"`):
        The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
        git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any
        identifier allowed by git.


        <Tip>

        To test a pull request you made on the Hub, you can pass `revision="refs/pr/<pr_number>"`.

        </Tip>

    return_unused_kwargs (`bool`, *optional*, defaults to `False`):
        If `False`, then this function returns just the final video processor object. If `True`, then this
        functions returns a `Tuple(video_processor, unused_kwargs)` where *unused_kwargs* is a dictionary
        consisting of the key/value pairs whose keys are not video processor attributes: i.e., the part of
        `kwargs` which has not been used to update `video_processor` and is otherwise ignored.
    subfolder (`str`, *optional*, defaults to `""`):
        In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can
        specify the folder name here.
    kwargs (`dict[str, Any]`, *optional*):
        The values in kwargs of any keys which are video processor attributes will be used to override the
        loaded values. Behavior concerning key/value pairs whose keys are *not* video processor attributes is
        controlled by the `return_unused_kwargs` keyword parameter.

Returns:
    A video processor of type [`~video_processing_utils.ImagVideoProcessorBase`].

Examples:

```python
# We can't instantiate directly the base class *VideoProcessorBase* so let's show the examples on a
# derived class: *LlavaOnevisionVideoProcessor*
video_processor = LlavaOnevisionVideoProcessor.from_pretrained(
    "llava-hf/llava-onevision-qwen2-0.5b-ov-hf"
)  # Download video_processing_config from huggingface.co and cache.
video_processor = LlavaOnevisionVideoProcessor.from_pretrained(
    "./test/saved_model/"
)  # E.g. video processor (or model) was saved using *save_pretrained('./test/saved_model/')*
video_processor = LlavaOnevisionVideoProcessor.from_pretrained("./test/saved_model/video_preprocessor_config.json")
video_processor = LlavaOnevisionVideoProcessor.from_pretrained(
    "llava-hf/llava-onevision-qwen2-0.5b-ov-hf", do_normalize=False, foo=False
)
assert video_processor.do_normalize is False
video_processor, unused_kwargs = LlavaOnevisionVideoProcessor.from_pretrained(
    "llava-hf/llava-onevision-qwen2-0.5b-ov-hf", do_normalize=False, foo=False, return_unused_kwargs=True
)
assert video_processor.do_normalize is False
assert unused_kwargs == {"foo": False}
```rº   r»   r¼   r¾   r½   )Úget_video_processor_dictÚ	from_dict)	Úclsr¹   rº   r»   r¼   r½   r¾   r1   Úvideo_processor_dicts	   &&&&&&&, r5   Úfrom_pretrainedÚ"BaseVideoProcessor.from_pretrained£  sd   € ðn (ˆ{ÑØ#1ÐÑ Ø%5Ð!Ñ"Ø%ˆzÑàÒØ#�7‰Oà'*×'CÒ'CÐDaÑ'lÐekÑ'lÑ$Ðà�}Š}Ð1Ñ<°VÑ<Ð<r8   c                óJ   <€ V ^8„  d   QhRS[ S[P                  ,          RS[/# )r0   Úsave_directoryÚpush_to_hubr¿   )r3   r4   s   "€r5   r6   r7     s$   ø€ ÷ .-ñ .-©c±B·K±KÕ.?ð .-Édñ .-r8   c           	     óî  € \         P                  P                  V4      '       d   \        RV R24      h\         P                  ! VRR7       V'       d‹   VP                  RR4      pVP                  RVP                  \         P                  P                  4      R,          4      p\        4       P                  ! V3RR/VB P                  pV P                  V4      pV P                  e   \        WV R	7       \         P                  P                  V\        4      pV P!                  V4       \"        P%                  R
V 24       V'       d&   V P'                  VXXXVP)                  R4      R7       V.# )a  
Save an video processor object to the directory `save_directory`, so that it can be re-loaded using the
[`~video_processing_utils.VideoProcessorBase.from_pretrained`] class method.

Args:
    save_directory (`str` or `os.PathLike`):
        Directory where the video processor JSON file will be saved (will be created if it does not exist).
    push_to_hub (`bool`, *optional*, defaults to `False`):
        Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the
        repository you want to push to with `repo_id` (will default to the name of `save_directory` in your
        namespace).
    kwargs (`dict[str, Any]`, *optional*):
        Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method.
zProvided path (z#) should be a directory, not a fileT)Úexist_okÚcommit_messageNÚrepo_idrÍ   )ÚconfigzVideo processor saved in r½   )rÎ   r½   éÿÿÿÿ)rÀ   ÚpathÚisfileÚAssertionErrorÚmakedirsr—   ÚsplitÚsepr   Úcreate_reporÏ   Ú_get_files_timestampsÚ_auto_classr   Újoinr   Úto_json_fileÚloggerÚinfoÚ_upload_modified_filesÚget)r=   rÊ   rË   r1   rÎ   rÏ   Úfiles_timestampsÚoutput_video_processor_files   &&&,    r5   Úsave_pretrainedÚ"BaseVideoProcessor.save_pretrained  s8  € ô �7‰7�>‰>˜.×)Ò)Ü  ?°>Ð2BÐBeÐ!fÓgÐgä
�Š�N¨TÕ2çØ#ŸZ™ZÐ(8¸$Ó?ˆNØ—j‘j ¨N×,@Ñ,@ÄÇÁÇÁÓ,MÈbÕ,QÓRˆGÜ“h×*Ò*¨7ÑL¸TÐLÀVÑL×TÑTˆGØ#×9Ñ9¸.ÓIÐð ×ÑÒ'Ü˜t¸DÕAô ')§g¡g§l¡l°>ÔCWÓ&XÐ#à×ÑÐ5Ô6Ü�‰Ð/Ð0KÐ/LÐMÔNçØ×'Ñ'ØØØ Ø-Ø—j‘j Ó)ð (ô ð ,Ð,Ð,r8   c                óŒ   <€ V ^8„  d   QhRS[ S[P                  ,          RS[S[S[ S[3,          S[S[ S[3,          3,          /# )r0   r¹   r2   )r   rÀ   rÁ   Útuplerh   r   )r3   r4   s   "€r5   r6   r7   7  sD   ø€ ÷ {,ñ {,Ù,/±"·+±+Õ,=ð{,á	‰t‘C™�H�~™t¡C© H�~Ð-Õ	.ñ{,r8   c                óÆ  € VP                  RR4      pVP                  RR4      pVP                  RR4      pVP                  RR4      pVP                  RR4      pVP                  RR4      pVP                  R	R
4      p	VP                  RR4      p
VP                  RR4      pRRRV/pV
e   W¬R&   \        4       '       d    V'       g   \        P                  R4       Rp\	        V4      p\
        P                  P                  V4      p\
        P                  P                  V4      '       d   TpRpRpMi\        p \        V\        VVVVVVVV	RR7      pV\        3 Uu. uF#  p\        VVVVVVVVVV	RR7      ;p  f   K!  VNK%  	  ppV'       d
   V^ ,          MRpRpVe   \        V4      pRV9   d
   VR,          pVe   Vf   \        V4      pVf   \        RV RV RX R24      hV'       d   \        P                  RV 24       VV3# \        P                  RX RV 24       VV3# u upi   \         d    h \         d    \        RT RT RT R24      hi ; i)a¶  
From a `pretrained_model_name_or_path`, resolve to a dictionary of parameters, to be used for instantiating a
video processor of type [`~video_processing_utils.VideoProcessorBase`] using `from_dict`.

Parameters:
    pretrained_model_name_or_path (`str` or `os.PathLike`):
        The identifier of the pre-trained checkpoint from which we want the dictionary of parameters.
    subfolder (`str`, *optional*, defaults to `""`):
        In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can
        specify the folder name here.

Returns:
    `tuple[Dict, Dict]`: The dictionary(ies) that will be used to instantiate the video processor object.
rº   Nr»   FÚproxiesr½   r¼   r¾   Ú	subfolderÚ Ú_from_pipelineÚ
_from_autoÚ	file_typeúvideo processorÚfrom_auto_classÚusing_pipelinez+Offline mode: forcing local_files_only=TrueT)
Úfilenamerº   r»   rè   r¼   r½   Ú
user_agentr¾   ré   Ú%_raise_exceptions_for_missing_entriesz Can't load video processor for 'zœ'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'z2' is the correct path to a directory containing a z fileÚvideo_processorzloading configuration file z from cache at )r—   r   rÝ   rÞ   r   rÀ   rÒ   ÚisdirrÓ   r   r   r   r   ÚOSErrorÚ	Exceptionr   )rÅ   r¹   r1   rº   r»   rè   r½   r¼   r¾   ré   Úfrom_pipelinerï   rò   Úis_localÚresolved_video_processor_fileÚresolved_processor_fileÚvideo_processor_filerñ   Úresolved_fileÚresolved_video_processor_filesrÆ   Úprocessor_dicts   &&,                   r5   rÃ   Ú+BaseVideoProcessor.get_video_processor_dict6  sÿ  € ð$ —J‘J˜{¨DÓ1ˆ	ØŸ™Ð$4°eÓ<ˆØ—*‘*˜Y¨Ó-ˆØ—
‘
˜7 DÓ)ˆØ!Ÿ:™:Ð&8¸%Ó@ÐØ—:‘:˜j¨$Ó/ˆØ—J‘J˜{¨BÓ/ˆ	àŸ
™
Ð#3°TÓ:ˆØ Ÿ*™* \°5Ó9ˆà!Ð#4Ð6GÈÐYˆ
ØÒ$Ø+8Ð'Ñ(ä×Ò×%5Ü�K‰KÐEÔFØ#Ðä(+Ð,IÓ(JÐ%Ü—7‘7—=‘=Ð!>Ó?ˆÜ�7‰7�>‰>Ð7×8Ò8Ø,IÐ)Ø&*Ð#Ø‰Hä#7Ð ð2ô +6Ø1Ü+Ø'Ø#1Ø#Ø%5ØØ)Ø%Ø'Ø:?ô+Ð'ð &:Ô;OÑ$Pó2á$P˜ä)4Ø9Ø%-Ø&/Ø+9Ø$+Ø-=Ø"'Ø'1Ø%-Ø&/ØBGô*ð ˜ð  ð ÷ "�MÙ$Pð /ð 2÷* :XÐ2°1Ö5Ð]að .ð&  $ÐØ"Ò.Ü0Ð1HÓIˆNØ  NÔ2Ø'5Ð6GÕ'HÐ$à(Ò4Ð9MÒ9UÜ#6Ð7TÓ#UÐ àÒ'ÜØ2Ð3PÐ2Qð R5à5RÐ4Sð T+Ø+?Ð*@ÀðGóð ÷ Ü�K‰KÐ5Ð6SÐ5TÐUÔVð $ VÐ+Ð+ô	 �K‰KØ-Ð.BÐ-CÀ?ÐSpÐRqÐrôð $ VÐ+Ð+ùò2øô. ô ð Üô äØ6Ð7TÐ6Uð V9à9VÐ8Wð X/Ø/CÐ.DÀEðKóð ðús*   Ä=$H4 Å!H/ÆH/Æ
H4 È/H4 È4I É	I c                ó6   <€ V ^8„  d   QhRS[ S[S[3,          /# )r0   rÆ   ©rh   r   r   )r3   r4   s   "€r5   r6   r7   µ  s   ø€ ÷ &#ñ &#©T±#±s°(­^ñ &#r8   c           	     ó´  € VP                  4       pVP                  RR4      pTP                  VP                  4        UUu/ uF#  w  rEW@P                  P
                  9   g   K!  WEbK%  	  upp4       V ! R/ VB p. p\        \        VP                  4       4      4       F_  p\        Wh4      '       g   K  W€P                  P
                  9  g   K2  \        WhVP                  VR4      4       VP                  V4       Ka  	  V'       d'   \        P                  RV P                   RV R24       \        P                  RV 24       V'       d   Wb3# V# u uppi )	a‡  
Instantiates a type of [`~video_processing_utils.VideoProcessorBase`] from a Python dictionary of parameters.

Args:
    video_processor_dict (`dict[str, Any]`):
        Dictionary that will be used to instantiate the video processor object. Such a dictionary can be
        retrieved from a pretrained checkpoint by leveraging the
        [`~video_processing_utils.VideoProcessorBase.to_dict`] method.
    kwargs (`dict[str, Any]`):
        Additional parameters from which to initialize the video processor object.

Returns:
    [`~video_processing_utils.VideoProcessorBase`]: The video processor object instantiated from those
    parameters.
Úreturn_unused_kwargsFNzImage processor z	: kwargs zÍ were applied for backward compatibility. To avoid this warning, add them to valid_kwargs: create a custom TypedDict extending ImagesKwargs with these keys and set it as the `valid_kwargs` class attribute.zVideo processor r:   )Úcopyr—   Úupdater­   r“   r”   Úreversedrj   r’   ÚhasattrÚsetattrrp   rÝ   Úwarning_onceÚ__name__rÞ   )	rÅ   rÆ   r1   r  ÚkÚvrô   Ú
extra_keysÚkeys	   &&,      r5   rÄ   ÚBaseVideoProcessor.from_dict´  s-  € ð"  4×8Ñ8Ó:ÐØ%Ÿz™zÐ*@À%ÓHÐØ×#Ñ#°f·l±l´nÔ$n±n©d¨aÈ×M]ÑM]×MmÑMmÑHm¤T Q¢T±nÒ$nÔoÙÑ5Ð 4Ñ5ˆð ˆ
ÜœD §¡£Ó/Ö0ˆCÜ�×,Ô,°×<LÑ<L×<\Ñ<\Ö1\Ü˜¨f¯j©j¸¸dÓ.CÔDØ×!Ñ! #Ö&ñ 1÷ Ü×ÑØ" 3§<¡< .°	¸*¸ð Fað bôô 	�‰Ð& Ð&7Ð8Ô9ßØ"Ð*Ð*à"Ð"ùó) %os   ÁE
Á$E
c                ó6   <€ V ^8„  d   QhRS[ S[S[3,          /# rA   r  )r3   r4   s   "€r5   r6   r7   Ý  s   ø€ ÷ ñ ™™c¡3˜h�ñ r8   c                óz   <€ \         SV `  4       pVP                  RR4       V P                  P                  VR&   V# )zŸ
Serializes this instance to a Python dictionary.

Returns:
    `dict[str, Any]`: Dictionary of all the attributes that make up this video processor instance.
Úimage_processor_typeNÚvideo_processor_type)r;   Úto_dictr—   r>   r  )r=   Úfiltered_dictr>   s   & €r5   r  ÚBaseVideoProcessor.to_dictÝ  s=   ø€ ô ™™Ó)ˆØ×ÑÐ0°$Ô7Ø04·±×0GÑ0GˆÐ,Ñ-àÐr8   c                ó    <€ V ^8„  d   QhRS[ /# rA   )r   )r3   r4   s   "€r5   r6   r7   ê  s   ø€ ÷ Gñ G¡ñ Gr8   c                óü   € V P                  4       pVP                  4        F9  w  r#\        V\        P                  4      '       g   K'  VP                  4       W&   K;  	  \        P                  ! V^RR7      R,           # )z£
Serializes this instance to a JSON string.

Returns:
    `str`: String containing all the attributes that make up this feature_extractor instance in JSON format.
T)ÚindentÚ	sort_keysÚ
)r  r­   rq   r�   r‚   ÚtolistÚjsonÚdumps)r=   Ú
dictionaryr  Úvalues   &   r5   Úto_json_stringÚ!BaseVideoProcessor.to_json_stringê  s\   € ð —\‘\“^ˆ
à$×*Ñ*Ö,‰JˆCÜ˜%¤§¡×,Ô,Ø"'§,¡,£.�
“ñ -ô �zŠz˜*¨Q¸$Ô?À$ÕFÐFr8   c                óD   <€ V ^8„  d   QhRS[ S[P                  ,          /# )r0   Újson_file_path©r   rÀ   rÁ   )r3   r4   s   "€r5   r6   r7   ù  s   ø€ ÷ 	0ñ 	0©3±·±Õ+<ñ 	0r8   c                óª   € \        VRRR7      ;_uu_ 4       pVP                  V P                  4       4       RRR4       R#   + '       g   i     R# ; i)z¹
Save this instance to a JSON file.

Args:
    json_file_path (`str` or `os.PathLike`):
        Path to the JSON file in which this image_processor instance's parameters will be saved.
Úwúutf-8©ÚencodingN)ÚopenÚwriter"  )r=   r%  Úwriters   && r5   rÜ   ÚBaseVideoProcessor.to_json_fileù  s9   € ô �. #°×8Õ8¸FØ�L‰L˜×,Ñ,Ó.Ô/÷ 9×8×8Ò8ús   — AÁA	c                óT   € V P                   P                   R V P                  4        2# )Ú )r>   r  r"  )r=   s   &r5   Ú__repr__ÚBaseVideoProcessor.__repr__  s(   € Ø—.‘.×)Ñ)Ð*¨!¨D×,?Ñ,?Ó,AÐ+BÐCÐCr8   c                óD   <€ V ^8„  d   QhRS[ S[P                  ,          /# )r0   Ú	json_filer&  )r3   r4   s   "€r5   r6   r7     s   ø€ ÷ +ñ +¡s©R¯[©[Õ'8ñ +r8   c                óÂ   € \        VRRR7      ;_uu_ 4       pVP                  4       pRRR4       \        P                  ! X4      pV ! R/ VB #   + '       g   i     L.; i)a„  
Instantiates a video processor of type [`~video_processing_utils.VideoProcessorBase`] from the path to a JSON
file of parameters.

Args:
    json_file (`str` or `os.PathLike`):
        Path to the JSON file containing the parameters.

Returns:
    A video processor of type [`~video_processing_utils.VideoProcessorBase`]: The video_processor object
    instantiated from that JSON file.
Úrr)  r*  Nr:   )r,  Úreadr  Úloads)rÅ   r5  ÚreaderÚtextrÆ   s   &&   r5   Úfrom_json_fileÚ!BaseVideoProcessor.from_json_file  sL   € ô �)˜S¨7×3Õ3°vØ—;‘;“=ˆD÷ 4ä#Ÿzšz¨$Ó/ÐÙÑ*Ð)Ñ*Ð*÷ 4×3ús   —AÁA	c                ó¦   € \        V\        4      '       g   VP                  p^ RIHu Hp \        W!4      '       g   \        V R24      hWn        R# )aÁ  
Register this class with a given auto class. This should only be used for custom video processors as the ones
in the library are already mapped with `AutoVideoProcessor `.

<Tip warning={true}>

This API is experimental and may have some slight breaking changes in the next releases.

</Tip>

Args:
    auto_class (`str` or `type`, *optional*, defaults to `"AutoVideoProcessor "`):
        The auto class to register this new video processor with.
Nz is not a valid auto class.)	rq   r   r  Útransformers.models.autoÚmodelsÚautor  r]   rÚ   )rÅ   Ú
auto_classÚauto_modules   && r5   Úregister_for_auto_classÚ*BaseVideoProcessor.register_for_auto_class  sE   € ô  ˜*¤c×*Ò*Ø#×,Ñ,ˆJç6Ð6ä�{×/Ò/Ü 
˜|Ð+FÐGÓHÐHà$Žr8   c                óp   <€ V ^8„  d   QhRS[ S[S[ ,          ,          S[S[S[ ,          ,          ,          /# )r0   Úvideo_url_or_urls)r   rj   )r3   r4   s   "€r5   r6   r7   4  s,   ø€ ÷ gñ g©c±D¹µI­oÁÁTÉ#ÅYÅÕ.Oñ gr8   c                ó  € Rp\        4       '       g   \        P                  ! R4       Rp\        V\        4      '       d2   \	        \        V Uu. uF  q@P                  WBR7      NK  	  up!  4      # \        WVR7      # u upi )zÈ
Convert a single or a list of urls into the corresponding `np.array` objects.

If a single url is passed, the return value will be a single object. If a list is passed a list of objects is
returned.
Ú
torchcodeczÇ`torchcodec` is not installed and cannot be used to decode the video by default. Falling back to `torchvision`. Note that `torchvision` decoding is deprecated and will be removed in future versions. Útorchvisionrm   )Úbackendrg   )r   ÚwarningsÚwarnrq   rj   rn   ru   r&   )r=   rG  rg   rK  Úxs   &&&  r5   ru   ÚBaseVideoProcessor.fetch_videos4  s}   € ð ˆÜ&×(Ò(Ü�MŠMðIôð $ˆGäÐ'¬×.Ò.ÜœÑarÓsÑarÐ\]×/Ñ/°Ð/ÖWÑarÑsÑtÓuÐuäÐ/ÐTeÔfÐfùò ts   ÁA?r:   gp?)NNrC   )NFFNÚmain)F)ÚAutoVideoProcessor)3r  Ú
__module__Ú__qualname__Ú__firstlineno__rÚ   r¢   r¨   r©   r¡   Úsize_divisorÚdefault_to_squarer¤   r    r£   r¥   r¦   r§   rŸ   rf   rY   rX   re   r‘   r   r“   Úmodel_input_namesr<   rF   rT   rb   rz   r‰   r   ÚBASE_VIDEO_PROCESSOR_DOCSTRINGrD   rš   ÚclassmethodrÇ   rã   rÃ   rÄ   r  r"  rÜ   r2  r<  rD  ru   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r>   r4   s   @@r5   r-   r-   ‘   s’  ù‡ € ð €Kà€HØ€JØ€IØ€DØ€LØÐØ€IØ€IØ€NØ€JØ€NØ€LØ€NØÐØ
€CØ€JØ€NØ€OØ€LØ.Ð/Ð÷#ó #÷1ð 1÷ð ÷23ò 3÷j&&ò &&÷P ò  ñ: Ø&ó÷*#óð*#÷X+hò +hðZ ÷`=ñ `=ó ð`=÷D.-ò .-ð` ÷{,ó ð{,ðz ÷&#ó ð&#÷Pó ÷Gð G÷	0ð 	0òDð ÷+ó ð+ð$ ó%ó ð%÷2g÷ gò gr8   r-   rî   rQ  zvideo processor file)ÚobjectÚobject_classÚobject_files)ÚvisionrJ  )Gr  rÀ   rL  Úcollections.abcr   Ú	functoolsr   Útypingr   Únumpyr�   Úhuggingface_hubr   Úhuggingface_hub.dataclassesr   Údynamic_module_utilsr   Úimage_processing_backendsr	   Úimage_processing_utilsr   Úimage_utilsr   r   r   r   Úprocessing_utilsr   r   Úutilsr   r   r   r   r   r   r   r   r   r   r   Ú	utils.hubr   r   Úutils.import_utilsr    Úvideo_utilsr!   r"   r#   r$   r%   r&   r'   r(   r)   r_   Ú$torchvision.transforms.v2.functionalÚ
transformsÚv2Ú
functionalrO   r*   Ú
get_loggerr  rÝ   rX  r-   rË   Ú__doc__r3   r:   r8   r5   Ú<module>rv     sK  ðó Û 	Û Ý $Ý Ý ã Ý +Ý ;å 4Ý 9Ý 0÷ó ÷ 3÷÷ ÷ ñ ÷ +Ý (÷
÷ 
õ 
ñ ×ÒÛá× Ò ß6Ó6á×ÒÝ/ð 
×	Ò	˜HÓ	%€ðA"Ð ñH Ø'Ø"óñ 
Ð,Ô-ôp
gÐ+ó p
gó .ó	ð
p
gñf "+Ð+=×+IÑ+IÓ!JÐ Ô Ø×!Ñ!×)Ñ)Ò5Ø-?×-KÑ-K×-SÑ-S×-ZÑ-ZØ Ð/CÐRhð .[ó .Ð×"Ñ"Ö*ñ 6r8   