
    Z j{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        /root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/transformers/models/auto/video_processing_auto.pyvideo_processor_class_from_namer:   R   s    "?"E"E"G"3K@K,,q->@UVFv22 #H -;;BBD	9j$/:= E )).9K{''{// " 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&DH(-!#-!!1166;8= M  	D # &( Jh$B1$Emq! )1HNO	
 *,-DE.#12C#D $05I5Q23P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)NzAutoVideoProcessor 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[%        XQXU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     @jLiqLis   )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 Hd+"JJ':DA#|+DDEbmflm +0F M#' ;??:r#BB'2:'>?S'T$ !(-E-M$/OO4JD$Q!$01F1N1NO_aq1r. 33QR^,J)#{z2'FF+6z+BCW+X(+C+K+KL\^n+o( !(-E-Mf&677#331EVZ` %,F4JD$Q!vz**/Cv/V+1??;O+P( ,$CDY$Z!2$>.d:ed6lNe>e, 1!J%<T&\%J
*ZZ021 // 8 > >t DQ G $ 9!.cp! 09L0I$A)Mj$unt$u!

?D1A!99;(889VjY_jcijj".(889VjY_jcijj&\44$;DL$I!$0,<<=Zn]cngmnn ())01  2F  G  ./L.M N11E0Fd;- X((3}Btyy@jLi@j7j6k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!;sE#*cDj:P4Q/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  Dju  u p 
,-ra ra .raj %&:
;r]   