Ë
    ÛÓ^j^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jZ                  e.«      Z/er e«       Zee0e0dz  f   e1d<   n eg d¢«      Z2 ejf                  e2«        ee!e«      Z4de0fd„Z5 G d„ d«      Z6ddgZ7y)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 ]<  \  }}| |v sŒt        |«      }t        j                  d|› �d«      }	 t        || «      c S  t        j                  j                  «       D ]  }t        |dd «      | k(  sŒ|c S  t        j                  d«      }t        || «      rt        || «      S y # t        $ r Y Œ¯w xY w)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         ús/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/transformers/models/auto/processing_auto.pyÚprocessor_class_from_namer]   Z   sÔ   € Ü#:×#@Ñ#@Ó#Bò Ñˆ�ZØ˜Ò#Ü3°KÓ@ˆKä×,Ñ,¨q°°Ð->Ð@UÓVˆFðÜ˜v zÓ2Ò2ðô '×5Ñ5×<Ñ<Ó>ò ˆ	Ü�9˜j¨$Ó/°:Ó=ØÒðô ×)Ñ)¨.Ó9€KÜˆ{˜JÔ'Ü�{ JÓ/Ð/àøô "ò Ùðús   ÁB9Â9	CÃCc                   óN   — e Zd ZdZd„ Ze ee«      d„ «       «       Ze	dd„«       Z
y)Ú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                 óX  — |j                  dd«      }|j                  dd«      }d|d<   d}d}d}|D �ci c]  }||v sŒ|||   “Œ }	}|	j                  ddddœ«       t        |t        fi |	¤Ž}
|
�Ft	        j
                  |fi |¤Ž\  }}|j                  d	«      }d
|j                  di «      v r|d   d
   }|�€t        |t        fi |	¤Ž}|�Gt        j                  |fi |¤Ž\  }}|j                  d	d«      }d
|j                  di «      v r|d   d
   }|€Zt        |t        fi |	¤Ž}|�Gt        j                  |fi |¤Ž\  }}|j                  d	d«      }d
|j                  di «      v r|d   d
   }|€\t        |t        fi |	¤Ž}|�I|€Gt        j                  |fi |¤Ž\  }}|j                  d	d«      }d
|j                  di «      v r|d   d
   }|€lt        |t        fi |	¤Ž}|�Yt!        |d¬«      5 }t#        j$                  |«      }ddd«       j                  d	d«      }d
|j                  di «      v r|d   d
   }|€_	 t'        |t(        «      st+        j,                  |fd|i|¤Ž}t/        |d	d«      }t1        |d«      rd
|j2                  v r|j2                  d
   }|�t7        |«      }|du}|duxs t9        |«      t:        v }|xr0 |xs t:        t9        |«         j<                  j?                  d«       }|s,|r*d|v r|jA                  d«      d   }nd}tC        |||||«      }|rH|rF|sDtE        ||fi |¤Ž}|j                  dd«      }|jG                  «         |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  t5        d|› d�«      ‚c c}w # 1 sw Y   �ŒýxY w# t4        $ r Y �Œ}w xY w# tP        $ r Y ŒXw xY w)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_agentF)Ú _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   rv   Ú
ValueErrorr]   ÚtyperS   Ú
__module__Ú
startswithÚsplitr   r   Úregister_for_auto_classr   r   r   r   Ú	Exception)ÚclsÚpretrained_model_name_or_pathÚkwargsrf   rg   ru   Úprocessor_auto_mapÚ_hub_valid_kwargsÚkeyÚ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€   sq  € ðD —‘˜H dÓ+ˆØ"ŸJ™JÐ':¸DÓAÐØ#ˆˆ|ÑàˆØ!Ðð

Ðð ;LÖ]°3ÈsÐV\Ê}˜c 6¨#¡;Ñ.Ð]ÐÐ]à×!Ñ!à49Ø9>Ø;@ñô	
ô !,Ð,IÌ>Ñ pÐ]oÑ pÐØ Ð,Ü+×>Ñ>Ð?\ÑgÐ`fÑg‰NˆK˜Ø)Ÿo™oÐ.?Ó@ˆOØ +§/¡/°*¸bÓ"AÑAØ%0°Ñ%<¸_Ñ%MÐ"àÑ"ä'2Ø-Ô/Eñ(ØI[ñ(Ð$ð (Ð3Ü!5×!NÑ!NÐOlÑ!wÐpvÑ!w‘�˜QØ"-§/¡/Ð2CÀTÓ"J�Ø" k§o¡o°jÀ"Ó&EÑEØ)4°ZÑ)@ÀÑ)QÐ&ð (Ð/Ü+6Ø1Ô3Gñ,ØK]ñ,Ð(ð ,Ð7Ü%7×%PÑ%PØ5ñ&Ø9?ñ&‘N�K ð '2§o¡oÐ6GÈÓ&N�OØ&¨+¯/©/¸*ÀbÓ*IÑIØ-8¸Ñ-DÀ_Ñ-UÐ*à'Ð/Ü+6Ø1Ô3Iñ,ØM_ñ,Ð(ð ,Ð7¸OÐ<SÜ%;×%VÑ%VØ5ñ&Ø9?ñ&‘N�K ð '2§o¡oÐ6GÈÓ&N�OØ&¨+¯/©/¸*ÀbÓ*IÑIØ-8¸Ñ-DÀ_Ñ-UÐ*àÐ"ä$/Ø-Ô/Dñ%ØHZñ%Ð!ð %Ð0ÜÐ/¸'ÔBð 4ÀfÜ"&§)¡)¨FÓ"3�K÷4ð #.§/¡/Ð2CÀTÓ"J�Ø" k§o¡o°jÀ"Ó&EÑEØ)4°ZÑ)@ÀÑ)QÐ&àÐ"ðÜ! &Ô*:Ô;Ü'×7Ñ7Ø5ñØIZðØ^dñ�Fô #*¨&Ð2CÀTÓ"J�Ü˜6 :Ô.°?ÀfÇoÁoÑ3UØ)/¯©¸Ñ)IÐ&ð Ð&Ü7¸ÓHˆOà,°DÐ8ˆØ(°Ð4ÒY¼¸V»ÔHYÐ8YˆØ,ò 1ØÒ>Ô0´°f³Ñ>ß
‰*—Z‘Z Ó0ð21Ðñ ¡/ØÐ)Ñ)Ø 2× 8Ñ 8¸Ó >¸qÑ A‘à $�Ü 9Ø!Ð#@À.ÐRaÐcpó!Ðñ Ñ0Ñ9LÜ;Ø"Ð$AñØEKñˆOð —
‘
˜?¨DÓ1ˆAØ×3Ñ3Ô5Ø2�?×2Ñ2Ø-ñØARðØV\ñð ð Ð(Ø2�?×2Ñ2Ø-ñØARðØV\ñð ô �&‹\Ô.Ñ.Ü$¤T¨&£\Ñ2×BÑBÐC`ÑkÐdjÑkÐkô $Ô%7Ô9KÔMaÐbò 	ˆEðØ,�u×,Ñ,Ø1ñØEVðØZ`ñò ð	ô Ø/Ð0MÐ/Nð Ogð gó
ð 	
ùòG ^÷x4ñ 4ûô, ò ò ðûô\ ò Ùðús;   ´	O;¾O;Ç/P È>AP ÏPÐ P
Ð	PÐPÐ	P)Ð(P)c                 ó4   — t         j                  | ||¬«       y)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_classru   rŸ   s      r\   r    zAutoProcessor.register_  s   € ô 	×"Ñ" <°È8Ð"ÕTrd   N)F)rL   r‡   Ú__qualname__Ú__doc__rc   Úclassmethodr   r   r„   Ústaticmethodr    © rd   r\   r_   r_   r   sH   „ ñò
ð Ù&Ð'>Ó?ñ[
ó @ó ð[
ðz ò	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_NAMESrz   rS   r]   r_   Ú__all__r¦   rd   r\   ú<module>r¾      sà   ðò ã Û Ý #Ý  õ 4ß \Ý >Ý :Ý .Ý 8ß gÕ gÝ 8Ý *Ý 2÷ó õ :Ý 5Ý ,Ý 5ð 
ˆ×	Ñ	˜HÓ	%€Ùñ =H»MÐ˜[¨¨c°D©j¨Ñ9ÔIá&1ò 	
ó"'Ð#ðF #Ð×"Ñ"Ð#BÔCá$Ð%9Ð;RÓSÐ ð¨#ó ÷0wUñ wUðt  Ð
0�rd   