ó
    pyüi{N  ã                   ó¢  • % S r SSKrSSKrSSKJr  SSKJr  SSKJr  SSK	J
r
Jr  SSKJrJrJrJrJrJrJrJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJrJrJ r J!r!  \RD                  " \#5      r$\(       a  \" 5       r\\%\&\%S-  \%S-  4   4   \'S'   O\" / SQ5      r(\RR                  " \(5        \RT                  " 5        H  u  r+r,\,r-\" 5       (       d  Sr-\-\\+'   M     \" \\5      r.S\%4S jr/      S S\%\R`                  -  S\%\R`                  -  S-  S\1S\2\%\%4   S-  S\1\%-  S-  S\%S-  S\14S jjr3\" SS9 " S S5      5       r4SS/r5g)!zAutoVideoProcessor class.é    N)ÚOrderedDict)ÚTYPE_CHECKINGé   )ÚPreTrainedConfig)Úget_class_from_dynamic_moduleÚresolve_trust_remote_code)ÚCONFIG_NAMEÚIMAGE_PROCESSOR_NAMEÚPROCESSOR_NAMEÚVIDEO_PROCESSOR_NAMEÚcached_fileÚis_torchvision_availableÚloggingÚsafe_load_json_file)Úrequires)ÚBaseVideoProcessoré   )Ú_LazyAutoMapping)ÚVIDEO_PROCESSOR_MAPPING_NAMES)ÚCONFIG_MAPPING_NAMESÚ
AutoConfigÚmodel_type_to_module_nameÚ!replace_list_option_in_docstringsr   )	)Ú	exaone4_5ÚQwen2VLVideoProcessor)ÚinstructblipÚInstructBlipVideoVideoProcessor)Úpe_audio_videoÚPeVideoVideoProcessor)Úqwen2_5_omnir   )Ú
qwen2_5_vlr   )Úqwen3_5ÚQwen3VLVideoProcessor)Úqwen3_5_moer#   )Úqwen3_omni_moer   )Úqwen3_vl_moer#   Ú
class_namec                 ó¨  • [         R                  " 5        H=  u  pX:X  d  M  [        U5      n[        R                  " SU 3S5      n [        X05      s  $    [        R                  R                  5        H  n[        USS 5      U :X  d  M  Us  $    [        R                  " S5      n[        X@5      (       a  [        X@5      $ g ! [         a     Mº  f = f)NÚ.ztransformers.modelsÚ__name__Útransformers)r   Úitemsr   Ú	importlibÚimport_moduleÚgetattrÚAttributeErrorÚVIDEO_PROCESSOR_MAPPINGÚ_extra_contentÚvaluesÚhasattr)r'   Úmodule_nameÚ	extractorÚmoduleÚmain_modules        Úk/home/mande/repo/quber/.venv/lib/python3.13/site-packages/transformers/models/auto/video_processing_auto.pyÚvideo_processor_class_from_namer:   R   sÅ   € Ü"?×"EÒ"EÖ"GÑˆØÕ"Ü3°KÓ@ˆKä×,Ò,¨q°°Ð->Ð@UÓVˆFðÜ˜vÓ2Ò2ñ #Hô -×;Ñ;×BÑBÖDˆ	Ü�9˜j¨$Ó/°:Õ=ØÒñ Eô ×)Ò)¨.Ó9€KÜˆ{×'Ñ'Ü�{Ó/Ð/àøô "ó Úðús   Á
CÃ
CÃCÚpretrained_model_name_or_pathÚ	cache_dirÚforce_downloadÚproxiesÚtokenÚrevisionÚlocal_files_onlyc                 óf  • [        U [        UUUUUUSSS9
n[        [        4 V	s/ s H  n	[        U U	UUUUUUSSSS9=n
  c  M  U
PM!     nn	U(       a  US   OSnU(       d  U(       d  [        R                  S5        0 $ 0 nUb  [        U5      nSU;   a  US   nUb  Uc  [        U5      nU$ s  sn	f )aR
  
Loads the video processor configuration from a pretrained model video processor configuration.

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

        - a string, the *model id* of a pretrained model configuration hosted inside a model repo on
          huggingface.co.
        - a path to a *directory* containing a configuration file saved using the
          [`~BaseVideoProcessor.save_pretrained`] method, e.g., `./my_model_directory/`.

    cache_dir (`str` or `os.PathLike`, *optional*):
        Path to a directory in which a downloaded pretrained model configuration 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 configuration 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`, 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.
    local_files_only (`bool`, *optional*, defaults to `False`):
        If `True`, will only try to load the video processor configuration from local files.

<Tip>

Passing `token=True` is required when you want to use a private model.

</Tip>

Returns:
    `Dict`: The configuration of the video processor.

Examples:

```python
# Download configuration from huggingface.co and cache.
video_processor_config = get_video_processor_config("llava-hf/llava-onevision-qwen2-0.5b-ov-hf")
# This model does not have a video processor config so the result will be an empty dict.
video_processor_config = get_video_processor_config("FacebookAI/xlm-roberta-base")

# Save a pretrained video processor locally and you can reload its config
from transformers import AutoVideoProcessor

video_processor = AutoVideoProcessor.from_pretrained("llava-hf/llava-onevision-qwen2-0.5b-ov-hf")
video_processor.save_pretrained("video-processor-test")
video_processor = get_video_processor_config("video-processor-test")
```F)	Úfilenamer<   r=   r>   r?   r@   rA   Ú _raise_exceptions_for_gated_repoÚ%_raise_exceptions_for_missing_entries)
rC   r<   r=   r>   r?   r@   rA   rD   rE   Ú'_raise_exceptions_for_connection_errorsNr   z8Could not locate the video processor configuration file.Úvideo_processor)r   r   r   r
   ÚloggerÚinfor   )r;   r<   r=   r>   r?   r@   rA   ÚkwargsÚresolved_processor_filerC   Úresolved_fileÚresolved_video_processor_filesÚresolved_video_processor_fileÚvideo_processor_dictÚprocessor_dicts                  r9   Úget_video_processor_configrQ   j   s  € ôD *Ø%ÜØØ%ØØØØ)Ø).Ø.3ñÐô .Ô/CÑDó&âDˆHä(Ø-Ø!Ø#Ø-ØØØ!Ø!1Ø16Ø6;Ø8=ñð ˆMð ð÷ 	ÙDð #ð &ö( JhÐ$BÀ1Ò$EÐmqÐ!ö )Ö1HÜ�‰ÐNÔOØˆ	ð
 ÐØÑ*Ü,Ð-DÓEˆØ Ó.Ø#1Ð2CÑ#DÐ à$Ñ0Ð5IÑ5QÜ2Ð3PÓQÐàÐùòO&s   ¥B.ÁB.)ÚvisionÚtorchvision)Úbackendsc                   óZ   • \ rS rSrSrS r\\" \5      S 5       5       r	\
 SS j5       rSrg)	ÚAutoVideoProcessoréâ   a  
This is a generic video processor class that will be instantiated as one of the video processor classes of the
library when created with the [`AutoVideoProcessor.from_pretrained`] class method.

This class cannot be instantiated directly using `__init__()` (throws an error).
c                 ó   • [        S5      e)Nz‡AutoVideoProcessor is designed to be instantiated using the `AutoVideoProcessor.from_pretrained(pretrained_model_name_or_path)` method.)ÚOSError)Úselfs    r9   Ú__init__ÚAutoVideoProcessor.__init__ë   s   € Üðdó
ð 	
ó    c                 ó  • UR                  SS5      nUR                  SS5      nSUS'   [        R                  " U40 UD6u  pgUR                  SS5      nSn	SUR                  S0 5      ;   a  US   S   n	Uch  U	ce  UR                  S	S5      n
U
b   U
R	                  S
S5      n[        U5      b  UnSUR                  S0 5      ;   a  US   S   nUR	                  S
S5      n	Ucn  U	ck  [        U[        5      (       d  [        R                  " U4SU0UD6n[        USS5      n[        US5      (       a  SUR                  ;   a  UR                  S   n	Ub  [        U5      nU	SLnUSL=(       d    [        U5      [        ;   nU=(       a9    U=(       d    [        [        U5         R                  R!                  S5      (       + nU(       a*  SU	;   a  U	R#                  S5      S   nOSn[%        XQXíU5      nU(       aU  U(       aN  U(       dG  U	n['        UU40 UD6nUR                  SS5      nUR)                  5         UR                  " U/UQ70 UD6$ Ub  UR                  " U/UQ70 UD6$ [        U5      [        ;   a+  [        [        U5         nUb  UR                  " U/UQ70 UD6$ [+        5       (       d  [-        U S35      e[-        SU S[.         S[0         S[0         SSR3                  S [4         5       5       3
5      e)aè  
Instantiate one of the video processor classes of the library from a pretrained model vocabulary.

The video processor class to instantiate is selected based on the `model_type` property of the config object
(either passed as an argument or loaded from `pretrained_model_name_or_path` if possible), or when it's
missing, by falling back to using pattern matching on `pretrained_model_name_or_path`:

List options

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

        - a string, the *model id* of a pretrained video_processor hosted inside a model repo on
          huggingface.co.
        - a path to a *directory* containing a video processor file saved using the
          [`~video_processing_utils.BaseVideoProcessor.save_pretrained`] method, e.g.,
          `./my_model_directory/`.
        - a path to a saved video processor JSON *file*, e.g.,
          `./my_model_directory/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`, 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.
    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.
    trust_remote_code (`bool`, *optional*, defaults to `False`):
        Whether or not to allow for custom models defined on the Hub in their own modeling files. This option
        should only be set to `True` for repositories you trust and in which you have read the code, as it will
        execute code present on the Hub on your local machine.
    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.

<Tip>

Passing `token=True` is required when you want to use a private model.

</Tip>

Examples:

```python
>>> from transformers import AutoVideoProcessor

>>> # Download video processor from huggingface.co and cache.
>>> video_processor = AutoVideoProcessor.from_pretrained("llava-hf/llava-onevision-qwen2-0.5b-ov-hf")

>>> # If video processor files are in a directory (e.g. video processor was saved using *save_pretrained('./test/saved_model/')*)
>>> # video_processor = AutoVideoProcessor.from_pretrained("./test/saved_model/")
```ÚconfigNÚtrust_remote_codeTÚ
_from_autoÚvideo_processor_typerV   Úauto_mapÚimage_processor_typeÚImageProcessorÚVideoProcessorÚAutoImageProcessorztransformers.z--r   Úcode_revisionzT requires `torchvision` to be installed. Please install `torchvision` and try again.z Unrecognized video processor in z2. Should have a `video_processor_type` key in its z of z3, or one of the following `model_type` keys in its z: z, c              3   ó$   #   • U  H  ov •  M     g 7f)N© )Ú.0Úcs     r9   Ú	<genexpr>Ú5AutoVideoProcessor.from_pretrained.<locals>.<genexpr>ƒ  s   é € Ð@jÒLiÀqÄÒLiùs   ‚)Úpopr   Úget_video_processor_dictÚgetÚreplacer:   Ú
isinstancer   r   Úfrom_pretrainedr/   r4   rc   Útyper1   Ú
__module__Ú
startswithÚsplitr   r   Úregister_for_auto_classr   Ú
ValueErrorr   r	   Újoinr   )Úclsr;   ÚinputsrJ   r_   r`   Úconfig_dictÚ_Úvideo_processor_classÚvideo_processor_auto_mapÚimage_processor_classÚvideo_processor_class_inferredÚimage_processor_auto_mapÚhas_remote_codeÚhas_local_codeÚexplicit_local_codeÚupstream_repoÚ	class_refs                     r9   rt   Ú"AutoVideoProcessor.from_pretrainedñ   sf  € ðL —‘˜H dÓ+ˆØ"ŸJ™JÐ':¸DÓAÐØ#ˆˆ|Ñä+×DÒDÐEbÑmÐflÑm‰ˆØ +§¡Ð0FÈÓ MÐØ#'Ð Ø ;§?¡?°:¸rÓ#BÓBØ'2°:Ñ'>Ð?SÑ'TÐ$ð !Ñ(Ð-EÑ-MØ$/§O¡OÐ4JÈDÓ$QÐ!Ø$Ñ0Ø1F×1NÑ1NÐO_ÐaqÓ1rÐ.ô 3Ð3QÓRÑ^Ø,JÐ)Ø# {§¡°zÀ2Ó'FÓFØ+6°zÑ+BÐCWÑ+XÐ(Ø+C×+KÑ+KÐL\Ð^nÓ+oÐ(ð !Ñ(Ð-EÑ-MÜ˜fÔ&6×7Ñ7Ü#×3Ò3Ø1ñØEVðØZ`ñ�ô %,¨FÐ4JÈDÓ$QÐ!Ü�v˜z×*Ñ*Ð/CÀvÇÁÓ/VØ+1¯?©?Ð;OÑ+PÐ(à Ñ,Ü$CÐDYÓ$ZÐ!à2¸$Ð>ˆØ.°dÐ:×e¼dÀ6»lÔNeÑ>eˆØ,÷ 1Ø!×JÔ%<¼TÀ&»\Ñ%Jß
‰*—Z‘Z Ó0ô21Ðö ØÐ/Ó/Ø 8× >Ñ >¸tÓ DÀQÑ G‘à $�Ü 9Ø!À.Ðcpó!Ðö Ö0Ö9LØ0ˆIÜ$AÀ)ÐMjÑ$uÐntÑ$uÐ!Ø—
‘
˜?¨DÓ1ˆAØ!×9Ñ9Ô;Ø(×8Ò8Ð9VÐjÐY_ÒjÐciÑjÐjØ"Ñ.Ø(×8Ò8Ð9VÐjÐY_ÒjÐciÑjÐjä�&‹\Ô4Ó4Ü$;¼DÀ»LÑ$IÐ!Ø$Ñ0Ø,×<Ò<Ð=ZÐnÐ]cÒnÐgmÑnÐnô (×)Ñ)ÜØ0Ð1ð  2Fð  Góð ô Ø.Ð/LÐ.Mð N1Ü1EÐ0FÀdÌ;È-ð X(Ü(3 }°B°t·y±yÑ@jÕLiÓ@jÓ7jÐ6kðmó
ð 	
r]   c                 ó,   • [         R                  XUS9  g)zÿ
Register a new video processor for this class.

Args:
    config_class ([`PreTrainedConfig`]):
        The configuration corresponding to the model to register.
    video_processor_class ([`BaseVideoProcessor`]):
        The video processor to register.
)Úexist_okN)r1   Úregister)Úconfig_classr€   rŒ   s      r9   r�   ÚAutoVideoProcessor.register†  s   € ô 	 ×(Ñ(¨ÐW_Ð(Ò`r]   rj   N)F)r*   rv   Ú__qualname__Ú__firstlineno__Ú__doc__r[   Úclassmethodr   r   rt   Ústaticmethodr�   Ú__static_attributes__rj   r]   r9   rV   rV   â   sM   † ñò
ð Ù&Ð'DÓEñQ
ó Fó ðQ
ðf ð óaó óar]   rV   r1   )NFNNNF)6r’   r-   ÚosÚcollectionsr   Útypingr   Úconfiguration_utilsr   Údynamic_module_utilsr   r   Úutilsr	   r
   r   r   r   r   r   r   Úutils.import_utilsr   Úvideo_processing_utilsr   Úauto_factoryr   Úauto_mappingsr   Úconfiguration_autor   r   r   r   Ú
get_loggerr*   rH   ÚstrÚtupleÚ__annotations__Ú%MISSING_VIDEO_PROCESSOR_MAPPING_NAMESÚupdater,   Ú
model_typeÚvideo_processorsÚfast_video_processor_classr1   r:   ÚPathLikeÚboolÚdictrQ   rV   Ú__all__rj   r]   r9   Ú<module>r®      sÎ  ðò  ã Û 	Ý #Ý  õ 4ß \÷	÷ 	ó 	õ +Ý 8Ý *Ý 8÷ó ð 
×	Ò	˜HÓ	%€ö ñ VaÓUbÐ! ;¨s°E¸#À¹*ÀcÈDÁjÐ:PÑ4QÐ/QÑ#RÔbñ -8ò
	
ó-Ð)ð "×(Ò(Ð)NÔOà$A×$GÒ$GÖ$IÑ €JÐ Ø!1Ðñ $×%Ñ%Ø%)Ð"à0JÐ! *Ó-ñ %Jñ +Ð+?ÐA^Ó_Ð ð°ô ð4 +/Ø Ø%)Ø#ØØ"ñu Ø#&¨¯©Ñ#4ðu à�R—[‘[Ñ  4Ñ'ðu ð ðu ð �#�s�(‰^˜dÑ"ð	u ð
 �#‰:˜Ñðu ð �D‰jðu ð õu ñp 
Ð,Ñ-÷rað raó .ðraðj %Ð&:Ð
;�r]   