§
    ‚Štj^F  ã                   óâ  — U d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl	m
Z
mZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZmZmZmZmZ ddlmZ ddlmZ ddlmZ ddl m!Z!m"Z"m#Z#m$Z$ ddl%m&Z& ddl'm(Z( ddl)m*Z* ddl+m,Z,  ej-        e.¦  «        Z/er e¦   «         Zee0e0dz  f         e1d<   n eg d¢¦  «        Z2 ej3        e2¦  «          ee!e¦  «        Z4de0fd„Z5 G d„ d¦  «        Z6ddgZ7dS )zAutoProcessor class.é    N)ÚOrderedDict)ÚTYPE_CHECKINGé   )ÚPreTrainedConfig)Úget_class_from_dynamic_moduleÚresolve_trust_remote_code)ÚFeatureExtractionMixin)ÚImageProcessingMixin)ÚProcessorMixin)ÚTOKENIZER_CONFIG_FILE)ÚFEATURE_EXTRACTOR_NAMEÚPROCESSOR_NAMEÚVIDEO_PROCESSOR_NAMEÚcached_fileÚlogging)ÚBaseVideoProcessoré   )Ú_LazyAutoMapping)ÚPROCESSOR_MAPPING_NAMES)ÚCONFIG_MAPPING_NAMESÚ
AutoConfigÚmodel_type_to_module_nameÚ!replace_list_option_in_docstrings)ÚAutoFeatureExtractor)ÚAutoImageProcessor)ÚAutoTokenizer)ÚAutoVideoProcessorr   ))Úaimv2ÚCLIPProcessor)Údiffusion_gemmaÚGemma4Processor)ÚedgetamÚSam2Processor)Ú	glm4v_moeÚGlm4vProcessor)Úgranite_speech_plusÚGraniteSpeechProcessor)Úgroupvitr   )ÚhubertÚWav2Vec2Processor)Úinkling_mm_modelÚInklingProcessor)Úlasr_ctcÚLasrProcessor)Úlasr_encoderr.   )Ú
metaclip_2r   )Úmistral3ÚPixtralProcessor)zmm-grounding-dinoÚGroundingDinoProcessor)ÚmodernvbertÚIdefics3Processor)Ú	moonshiner*   )Úparakeet_ctcÚParakeetProcessor)Úparakeet_rnntr8   )Úparakeet_tdtr8   )Úqwen3_5ÚQwen3VLProcessor)Úqwen3_5_moer<   )Úqwen3_vl_moer<   )Úsam3_lite_textÚSam3Processor)Úsewr*   )zsew-dr*   )Út5gemma2ÚGemma3Processor)Út5gemma2_encoderrC   )Ú	unispeechr*   )zunispeech-satr*   )ÚvipllavaÚLlavaProcessor)zwav2vec2-conformerr*   )Úwavlmr*   Ú
class_namec                 ó°  — t          j        ¦   «         D ]S\  }}| |v rJt          |¦  «        }t          j        d|› �d¦  «        }	 t          || ¦  «        c S # t          $ r Y ŒOw xY wŒTt          j         	                    ¦   «         D ]}t          |dd ¦  «        | k    r|c S Œt          j        d¦  «        }t          || ¦  «        rt          || ¦  «        S d S )Nú.ztransformers.modelsÚ__name__Útransformers)r   Úitemsr   Ú	importlibÚimport_moduleÚgetattrÚAttributeErrorÚPROCESSOR_MAPPINGÚ_extra_contentÚvaluesÚhasattr)rI   Úmodule_nameÚ
processorsÚmoduleÚ	processorÚmain_modules         úf/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/transformers/models/auto/processing_auto.pyÚprocessor_class_from_namer]   Z   s  € Ý#:Ô#@Ñ#BÔ#Bð ð Ñˆ�ZØ˜Ð#Ð#Ý3°KÑ@Ô@ˆKåÔ,Ð->°Ð->Ð->Ð@UÑVÔVˆFðÝ˜v zÑ2Ô2Ð2Ð2Ð2øÝ!ð ð ð Ø�ðøøøð $õ 'Ô5×<Ò<Ñ>Ô>ð ð ˆ	Ý�9˜j¨$Ñ/Ô/°:Ò=Ð=ØÐÐÐð >õ
 Ô)¨.Ñ9Ô9€KÝˆ{˜JÑ'Ô'ð 0Ý�{ JÑ/Ô/Ð/àˆ4s   ÁAÁ
A$Á#A$c                   óh   — e Zd ZdZd„ Ze ee¦  «        d„ ¦   «         ¦   «         Ze	dd„¦   «         Z
dS )ÚAutoProcessora  
    This is a generic processor class that will be instantiated as one of the processor classes of the library when
    created with the [`AutoProcessor.from_pretrained`] class method.

    This class cannot be instantiated directly using `__init__()` (throws an error).
    c                 ó    — t          d¦  «        ‚)Nz}AutoProcessor is designed to be instantiated using the `AutoProcessor.from_pretrained(pretrained_model_name_or_path)` method.)ÚOSError)Úselfs    r\   Ú__init__zAutoProcessor.__init__z   s   € Ýð_ñ
ô 
ð 	
ó    c                 ó 	  ‡— ‰                      dd¦  «        }‰                      dd¦  «        }d‰d<   d}d}d}ˆfd„|D ¦   «         }|                     dddd	œ¦  «         t          |t          fi |¤Ž}	|	�Pt	          j        |fi ‰¤Ž\  }
}|
                     d
¦  «        }d|
                     di ¦  «        v r|
d         d         }|�€8t          |t          fi |¤Ž}|�Qt          j	        |fi ‰¤Ž\  }
}|
                     d
d¦  «        }d|
                     di ¦  «        v r|
d         d         }|€ft          |t          fi |¤Ž}|�Qt          j        |fi ‰¤Ž\  }
}|
                     d
d¦  «        }d|
                     di ¦  «        v r|
d         d         }|€ht          |t          fi |¤Ž}|�S|€Qt          j        |fi ‰¤Ž\  }
}|
                     d
d¦  «        }d|
                     di ¦  «        v r|
d         d         }|€Žt          |t          fi |¤Ž}|�yt!          |d¬¦  «        5 }t#          j        |¦  «        }
ddd¦  «         n# 1 swxY w Y   |
                     d
d¦  «        }d|
                     di ¦  «        v r|
d         d         }|€r	 t'          |t(          ¦  «        st+          j        |fd|i‰¤Ž}t/          |d
d¦  «        }t1          |d¦  «        rd|j        v r|j        d         }n# t4          $ r Y nw xY w|�t7          |¦  «        }|du}|dupt9          |¦  «        t:          v }|o4|pt:          t9          |¦  «                 j                             d¦  «         }|s7|r5d|v r|                      d¦  «        d         }nd}tC          |||||¦  «        }|rL|rJ|sHtE          ||fi ‰¤Ž}‰                      dd¦  «        }| #                    ¦   «           |j        |fd|i‰¤ŽS |� |j        |fd|i‰¤ŽS t9          |¦  «        t:          v r%t;          t9          |¦  «                 j        |fi ‰¤ŽS tH          tJ          tL          tN          fD ]$}	  |j        |fd|i‰¤Žc S # tP          $ r Y Œ!w xY wt5          d|› d�¦  «        ‚)a3  
        Instantiate one of the processor classes of the library from a pretrained model vocabulary.

        The 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):

        List options

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

                - a string, the *model id* of a pretrained feature_extractor hosted inside a model repo on
                  huggingface.co.
                - a path to a *directory* containing a processor files saved using the `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 feature extractor 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 feature extractor 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 feature extractor object. If `True`, then this
                functions returns a `Tuple(feature_extractor, unused_kwargs)` where *unused_kwargs* is a dictionary
                consisting of the key/value pairs whose keys are not feature extractor attributes: i.e., the part of
                `kwargs` which has not been used to update `feature_extractor` 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 feature extractor attributes will be used to override the
                loaded values. Behavior concerning key/value pairs whose keys are *not* feature extractor 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 AutoProcessor

        >>> # Download processor from huggingface.co and cache.
        >>> processor = AutoProcessor.from_pretrained("facebook/wav2vec2-base-960h")

        >>> # If processor files are in a directory (e.g. processor was saved using *save_pretrained('./test/saved_model/')*)
        >>> # processor = AutoProcessor.from_pretrained("./test/saved_model/")
        ```ÚconfigNÚtrust_remote_codeTÚ
_from_auto)	Ú	cache_dirÚforce_downloadÚproxiesÚtokenÚrevisionÚlocal_files_onlyÚ	subfolderÚ	repo_typeÚ
user_agentc                 ó*   •— i | ]}|‰v ¯|‰|         “ŒS © rs   )Ú.0ÚkeyÚkwargss     €r\   ú
<dictcomp>z1AutoProcessor.from_pretrained.<locals>.<dictcomp>Ö   s%   ø€ Ð]Ð]Ð]°3ÈsÐV\È}È}˜c 6¨#¤;È}È}È}rd   F)Ú _raise_exceptions_for_gated_repoÚ%_raise_exceptions_for_missing_entriesÚ'_raise_exceptions_for_connection_errorsÚprocessor_classr_   Úauto_mapzutf-8)Úencodingztransformers.z--r   Úcode_revisionz!Unrecognized processing class in zÓ. Can't instantiate a processor, a tokenizer, an image processor, a video processor or a feature extractor for this model. Make sure the repository contains the files of at least one of those processing classes.))ÚpopÚupdater   r   r   Úget_processor_dictÚgetr   r
   Úget_image_processor_dictr   r   Úget_video_processor_dictr	   Úget_feature_extractor_dictr   ÚopenÚjsonÚloadÚ
isinstancer   r   Úfrom_pretrainedrQ   rV   r|   Ú
ValueErrorr]   ÚtyperS   Ú
__module__Ú
startswithÚsplitr   r   Úregister_for_auto_classr   r   r   r   Ú	Exception)ÚclsÚpretrained_model_name_or_pathrv   rf   rg   r{   Úprocessor_auto_mapÚ_hub_valid_kwargsÚcached_file_kwargsÚprocessor_config_fileÚconfig_dictÚ_Úpreprocessor_config_fileÚtokenizer_config_fileÚreaderÚhas_remote_codeÚhas_local_codeÚexplicit_local_codeÚupstream_repoÚklasss     `                 r\   rŠ   zAutoProcessor.from_pretrained€   s×  ø€ ðD —’˜H dÑ+Ô+ˆØ"ŸJšJÐ':¸DÑAÔAÐØ#ˆˆ|ÑàˆØ!Ðð

Ðð ^Ð]Ð]Ð]Ð:KÐ]Ñ]Ô]Ðà×!Ò!à49Ø9>Ø;@ðð ñ	
ô 	
ð 	
õ !,Ð,IÍ>Ð pÐ pÐ]oÐ pÐ pÐØ Ð,Ý+Ô>Ð?\ÐgÐgÐ`fÐgÐg‰NˆK˜Ø)ŸošoÐ.?Ñ@Ô@ˆOØ +§/¢/°*¸bÑ"AÔ"AÐAÐAØ%0°Ô%<¸_Ô%MÐ"àÑ"å'2Ø-Õ/Eð(ð (ØI[ð(ð (Ð$ð (Ð3Ý!5Ô!NÐOlÐ!wÐ!wÐpvÐ!wÐ!w‘�˜QØ"-§/¢/Ð2CÀTÑ"JÔ"J�Ø" k§o¢o°jÀ"Ñ&EÔ&EÐEÐEØ)4°ZÔ)@ÀÔ)QÐ&ð (Ð/Ý+6Ø1Õ3Gð,ð ,ØK]ð,ð ,Ð(ð ,Ð7Ý%7Ô%PØ5ð&ð &Ø9?ð&ð &‘N�K ð '2§o¢oÐ6GÈÑ&NÔ&N�OØ&¨+¯/ª/¸*ÀbÑ*IÔ*IÐIÐIØ-8¸Ô-DÀ_Ô-UÐ*à'Ð/Ý+6Ø1Õ3Ið,ð ,ØM_ð,ð ,Ð(ð ,Ð7¸OÐ<SÝ%;Ô%VØ5ð&ð &Ø9?ð&ð &‘N�K ð '2§o¢oÐ6GÈÑ&NÔ&N�OØ&¨+¯/ª/¸*ÀbÑ*IÔ*IÐIÐIØ-8¸Ô-DÀ_Ô-UÐ*àÐ"å$/Ø-Õ/Dð%ð %ØHZð%ð %Ð!ð %Ð0ÝÐ/¸'ÐBÑBÔBð 4ÀfÝ"&¤)¨FÑ"3Ô"3�Kð4ð 4ð 4ñ 4ô 4ð 4ð 4ð 4ð 4ð 4ð 4øøøð 4ð 4ð 4ð 4ð #.§/¢/Ð2CÀTÑ"JÔ"J�Ø" k§o¢o°jÀ"Ñ&EÔ&EÐEÐEØ)4°ZÔ)@ÀÔ)QÐ&àÐ"ðÝ! &Õ*:Ñ;Ô;ð Ý'Ô7Ø5ðð ØIZðØ^dðð �Fõ #*¨&Ð2CÀTÑ"JÔ"J�Ý˜6 :Ñ.Ô.ð J°?ÀfÄoÐ3UÐ3UØ)/¬¸Ô)IÐ&øøÝð ð ð ð �ðøøøð
 Ð&Ý7¸ÑHÔHˆOà,°DÐ8ˆØ(°Ð4ÐY½¸V¹¼ÕHYÐ8YˆØ,ð 1ØÐ>Õ0µ°f±´Ô>Ü
—Z’Z Ñ0Ô0ð21Ðð ð 	 /ð 	ØÐ)Ð)Ð)Ø 2× 8Ò 8¸Ñ >Ô >¸qÔ A��à $�Ý 9Ø!Ð#@À.ÐRaÐcpñ!ô !Ðð ð 	lÐ0ð 	lÐ9Lð 	lÝ;Ø"Ð$Aðð ØEKðð ˆOð —
’
˜?¨DÑ1Ô1ˆAØ×3Ò3Ñ5Ô5Ð5Ø2�?Ô2Ø-ðð ØARðØV\ðð ð ð Ð(Ø2�?Ô2Ø-ðð ØARðØV\ðð ð õ �&‰\Œ\Õ.Ð.Ð.Ý$¥T¨&¡\¤\Ô2ÔBÐC`ÐkÐkÐdjÐkÐkÐkõ $Õ%7Õ9KÕMaÐbð 	ð 	ˆEðØ,�uÔ,Ø1ðð ØEVðØZ`ðð ð ð ð øõ ð ð ð Ø�ðøøøõ ðgÐ0Mð gð gð gñ
ô 
ð 	
s7   È(I	É	IÉIÊA K4 Ë4
LÌ LÑQ-Ñ-
Q:Ñ9Q:Fc                 ó@   — t                                | ||¬¦  «         dS )a  
        Register a new processor for this class.

        Args:
            config_class ([`PreTrainedConfig`]):
                The configuration corresponding to the model to register.
            processor_class ([`ProcessorMixin`]): The processor to register.
        )Úexist_okN)rS   Úregister)Úconfig_classr{   r£   s      r\   r¤   zAutoProcessor.register_  s%   € õ 	×"Ò" <°È8Ð"ÑTÔTÐTÐTÐTrd   N)F)rL   r�   Ú__qualname__Ú__doc__rc   Úclassmethodr   r   rŠ   Ústaticmethodr¤   rs   rd   r\   r_   r_   r   sŠ   € € € € € ðð ð
ð 
ð 
ð Ø&Ð&Ð'>Ñ?Ô?ð[
ð [
ñ @Ô?ñ „[ð[
ðz ð	Uð 	Uð 	Uñ „\ð	Uð 	Uð 	Urd   r_   rS   )8r§   rO   r‡   Úcollectionsr   Útypingr   Úconfiguration_utilsr   Údynamic_module_utilsr   r   Úfeature_extraction_utilsr	   Úimage_processing_utilsr
   Úprocessing_utilsr   Útokenization_pythonr   Úutilsr   r   r   r   r   Úvideo_processing_utilsr   Úauto_factoryr   Úauto_mappingsr   Úconfiguration_autor   r   r   r   Úfeature_extraction_autor   Úimage_processing_autor   Útokenization_autor   Úvideo_processing_autor   Ú
get_loggerrL   ÚloggerÚstrÚ__annotations__ÚMISSING_PROCESSOR_MAPPING_NAMESr€   rS   r]   r_   Ú__all__rs   rd   r\   ú<module>rÁ      sœ  ðð Ð Ð à Ð Ð Ð Ø €€€Ø #Ð #Ð #Ð #Ð #Ð #Ø  Ð  Ð  Ð  Ð  Ð  ð 4Ð 3Ð 3Ð 3Ð 3Ð 3Ø \Ð \Ð \Ð \Ð \Ð \Ð \Ð \Ø >Ð >Ð >Ð >Ð >Ð >Ø :Ð :Ð :Ð :Ð :Ð :Ø .Ð .Ð .Ð .Ð .Ð .Ø 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø gÐ gÐ gÐ gÐ gÐ gÐ gÐ gÐ gÐ gÐ gÐ gÐ gÐ gØ 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø *Ð *Ð *Ð *Ð *Ð *Ø 2Ð 2Ð 2Ð 2Ð 2Ð 2ðð ð ð ð ð ð ð ð ð ð ð ð :Ð 9Ð 9Ð 9Ð 9Ð 9Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5ð 
ˆÔ	˜HÑ	%Ô	%€Øð (Dð =H¸K¹M¼MÐ˜[¨¨c°D©j¨Ô9ÐIÐIÑIÐIà&1 kð 	
ð  	
ð  	
ñ"'ô "'Ð#ðF #ÐÔ"Ð#BÑCÔCÐCà$Ð$Ð%9Ð;RÑSÔSÐ ð¨#ð ð ð ð ð0wUð wUð wUð wUð wUñ wUô wUð wUðt  Ð
0€€€rd   