Ë
    S^(hÙG  ã                   óR  — d Z ddlZddlZddlZddlZddl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 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&  ejN                  e(«      Z) eg d¢«      Z* eee*«      Z+de,fd„Z- G d„ d«      Z.y)zAutoProcessor class.é    N)ÚOrderedDicté   )ÚPretrainedConfig)Úget_class_from_dynamic_moduleÚresolve_trust_remote_code)ÚFeatureExtractionMixin)ÚImageProcessingMixin)ÚProcessorMixin)ÚTOKENIZER_CONFIG_FILE)ÚFEATURE_EXTRACTOR_NAMEÚPROCESSOR_NAMEÚcached_fileÚloggingé   )Ú_LazyAutoMapping)ÚCONFIG_MAPPING_NAMESÚ
AutoConfigÚmodel_type_to_module_nameÚ!replace_list_option_in_docstrings)ÚAutoFeatureExtractor)ÚAutoImageProcessor)ÚAutoTokenizer)P)ÚalignÚAlignProcessor)ÚaltclipÚAltCLIPProcessor)ÚariaÚAriaProcessor)Ú
aya_visionÚAyaVisionProcessor)ÚbarkÚBarkProcessor)ÚblipÚBlipProcessor)zblip-2ÚBlip2Processor)ÚbridgetowerÚBridgeTowerProcessor)Ú	chameleonÚChameleonProcessor)Úchinese_clipÚChineseCLIPProcessor)ÚclapÚClapProcessor)ÚclipÚCLIPProcessor)ÚclipsegÚCLIPSegProcessor)ÚclvpÚClvpProcessor)ÚcolpaliÚColPaliProcessor)Úemu3ÚEmu3Processor)ÚflavaÚFlavaProcessor)ÚfuyuÚFuyuProcessor)Úgemma3ÚGemma3Processor)ÚgitÚGitProcessor)Úgot_ocr2ÚGotOcr2Processor)zgrounding-dinoÚGroundingDinoProcessor)Úgroupvitr/   )ÚhubertÚWav2Vec2Processor)ÚideficsÚIdeficsProcessor)Úidefics2ÚIdefics2Processor)Úidefics3ÚIdefics3Processor)ÚinstructblipÚInstructBlipProcessor)ÚinstructblipvideoÚInstructBlipVideoProcessor)zkosmos-2ÚKosmos2Processor)Ú
layoutlmv2ÚLayoutLMv2Processor)Ú
layoutlmv3ÚLayoutLMv3Processor)Úllama4ÚLlama4Processor)ÚllavaÚLlavaProcessor)Ú
llava_nextÚLlavaNextProcessor)Úllava_next_videoÚLlavaNextVideoProcessor)Úllava_onevisionÚLlavaOnevisionProcessor)ÚmarkuplmÚMarkupLMProcessor)ÚmctctÚMCTCTProcessor)zmgp-strÚMgpstrProcessor)Úmistral3ÚPixtralProcessor)ÚmllamaÚMllamaProcessor)Ú	moonshinerE   )Ú	oneformerÚOneFormerProcessor)Úowlv2ÚOwlv2Processor)ÚowlvitÚOwlViTProcessor)Ú	paligemmaÚPaliGemmaProcessor)Úphi4_multimodalÚPhi4MultimodalProcessor)Ú
pix2structÚPix2StructProcessor)Úpixtralre   )Ú	pop2pianoÚPop2PianoProcessor)Ú
qwen2_5_vlÚQwen2_5_VLProcessor)Úqwen2_audioÚQwen2AudioProcessor)Úqwen2_vlÚQwen2VLProcessor)ÚsamÚSamProcessor)Úseamless_m4tÚSeamlessM4TProcessor)ÚsewrE   )zsew-drE   )Úshieldgemma2ÚShieldGemma2Processor)ÚsiglipÚSiglipProcessor)Úsiglip2ÚSiglip2Processor)Úspeech_to_textÚSpeech2TextProcessor)Úspeech_to_text_2ÚSpeech2Text2Processor)Úspeecht5ÚSpeechT5Processor)ÚtrocrÚTrOCRProcessor)ÚtvltÚTvltProcessor)ÚtvpÚTvpProcessor)ÚudopÚUdopProcessor)Ú	unispeechrE   )zunispeech-satrE   )Úvideo_llavaÚVideoLlavaProcessor)ÚviltÚViltProcessor)ÚvipllavarX   )zvision-text-dual-encoderÚVisionTextDualEncoderProcessor)Úwav2vec2rE   )zwav2vec2-bertrE   )zwav2vec2-conformerrE   )ÚwavlmrE   )ÚwhisperÚWhisperProcessor)ÚxclipÚXCLIPProcessorÚ
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)ÚPROCESSOR_MAPPING_NAMESÚitemsr   Ú	importlibÚimport_moduleÚgetattrÚAttributeErrorÚPROCESSOR_MAPPINGÚ_extra_contentÚvaluesÚhasattr)r¤   Úmodule_nameÚ
processorsÚmoduleÚ	processorÚmain_modules         úf/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/auto/processing_auto.pyÚprocessor_class_from_namer¹   †   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.)ÚEnvironmentError)Úselfs    r¸   Ú__init__zAutoProcessor.__init__¦   s   € Üð_ó
ð 	
ó    c                 óZ  — |j                  dd«      }|�<t        j                  dt        «       |j	                  dd«      �t        d«      ‚||d<   |j                  dd«      }|j                  dd«      }d|d	<   d}d}t        j                  t        «      j                  j                  «       D �ci c]  }||v sŒ|||   “Œ }	}|	j                  d
d
d
dœ«       t        |t        fi |	¤Ž}
|
�Gt        j                  |fi |¤Ž\  }}|j	                  d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   }|�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   }|€^t1        |t2        «      st5        j6                  |fd|i|¤Ž}t9        |dd«      }t;        |d«      rd|j<                  v r|j<                  d   }|�t?        |«      }|du}|duxs tA        |«      tB        v }tE        ||||«      }|re|rctG        ||fi |¤Ž}|j                  dd«      }tH        jJ                  jM                  |«      r|jO                  «         |j6                  |fd|i|¤ŽS |� |j6                  |fd|i|¤ŽS tA        |«      tB        v r"tC        tA        |«         j6                  |fi |¤ŽS 	 tQ        j6                  |fd|i|¤ŽS c c}w # 1 sw Y   �Œ�xY w# tR        $ rW 	 tU        j6                  |fd|i|¤ŽcY S # tR        $ r Y nw xY w	 tW        j6                  |fd|i|¤ŽcY S # tR        $ r Y nw xY wY nw xY wt        d|› d�«      ‚)aï  
        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.
            resume_download:
                Deprecated and ignored. All downloads are now resumed by default when possible.
                Will be removed in v5 of Transformers.
            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 `huggingface-cli 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/")
        ```Úuse_auth_tokenNzrThe `use_auth_token` argument is deprecated and will be removed in v5 of Transformers. Please use `token` instead.ÚtokenzV`token` and `use_auth_token` are both specified. Please set only the argument `token`.ÚconfigÚtrust_remote_codeTÚ
_from_autoF)Ú _raise_exceptions_for_gated_repoÚ%_raise_exceptions_for_missing_entriesÚ'_raise_exceptions_for_connection_errorsÚprocessor_classr»   Úauto_mapzutf-8)ÚencodingÚcode_revisionz!Unrecognized processing class in zÀ. Can't instantiate a processor, a tokenizer, an image processor or a feature extractor for this model. Make sure the repository contains the files of at least one of those processing classes.),ÚpopÚwarningsÚwarnÚFutureWarningÚgetÚ
ValueErrorÚinspectÚ	signaturer   Ú
parametersÚkeysÚupdater   r
   Úget_processor_dictr   r	   Úget_image_processor_dictr   Úget_feature_extractor_dictr   ÚopenÚjsonÚloadÚ
isinstancer   r   Úfrom_pretrainedr­   r²   rË   r¹   Útyper¯   r   r   ÚosÚpathÚisdirÚregister_for_auto_classr   Ú	Exceptionr   r   )ÚclsÚpretrained_model_name_or_pathÚkwargsrÂ   rÄ   rÅ   rÊ   Úprocessor_auto_mapÚkeyÚcached_file_kwargsÚprocessor_config_fileÚconfig_dictÚ_Úpreprocessor_config_fileÚtokenizer_config_fileÚreaderÚhas_remote_codeÚhas_local_codes                     r¸   rà   zAutoProcessor.from_pretrained¬   s>  € ðJ  Ÿ™Ð$4°dÓ;ˆØÐ%Ü�M‰Mð EÜôð �z‰z˜' 4Ó(Ð4Ü Ølóð ð -ˆF�7‰Oà—‘˜H dÓ+ˆØ"ŸJ™JÐ':¸DÓAÐØ#ˆˆ|ÑàˆØ!Ðô
 )0×(9Ñ(9¼+Ó(F×(QÑ(Q×(VÑ(VÓ(Xö
Ø!$Ð\_ÐciÒ\iˆC�˜‘Ñð
Ðð 
ð 	×!Ñ!à49Ø9>Ø;@ñô	
ô !,Ð,IÌ>Ñ pÐ]oÑ pÐØ Ð,Ü+×>Ñ>Ð?\ÑgÐ`fÑg‰NˆK˜Ø)Ÿo™oÐ.?ÀÓFˆ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Ð&ð (Ð3¸Ð8OÜ!7×!RÑ!RØ1ñ"Ø5;ñ"‘�˜Qð #.§/¡/Ð2CÀTÓ"J�Ø" k§o¡o°jÀ"Ó&EÑEØ)4°ZÑ)@ÀÑ)QÐ&àÐ"ä$/Ø-Ô/Dñ%ØHZñ%Ð!ð %Ð0ÜÐ/¸'ÔBð 4ÀfÜ"&§)¡)¨FÓ"3�K÷4ð #.§/¡/Ð2CÀTÓ"J�Ø" k§o¡o°jÀ"Ó&EÑEØ)4°ZÑ)@ÀÑ)QÐ&àÐ"ä˜fÔ&6Ô7Ü#×3Ñ3Ø1ñØEVðØZ`ñ�ô
 & fÐ.?ÀÓFˆOÜ�v˜zÔ*¨À&Ç/Á/Ñ/QØ%+§_¡_°_Ñ%EÐ"àÐ&Ü7¸ÓHˆOà,°DÐ8ˆØ(°Ð4ÒY¼¸V»ÔHYÐ8YˆÜ5ØÐ<¸nÈoó
Ðñ Ñ0Ü;Ø"Ð$AñØEKñˆOð —
‘
˜?¨DÓ1ˆAÜ�w‰w�}‰}Ð:Ô;Ø×7Ñ7Ô9Ø2�?×2Ñ2Ø-ñØARðØV\ñð ð Ð(Ø2�?×2Ñ2Ø-ñØARðØV\ñð ô �&‹\Ô.Ñ.Ü$¤T¨&£\Ñ2×BÑBÐC`ÑkÐdjÑkÐkð	Ü ×0Ñ0Ø-ñØARðØV\ñð ùò
÷\4ñ 4ûôh ò 	ðÜ)×9Ñ9Ø1ñØEVðØZ`ñò øô ò ÙðúðÜ+×;Ñ;Ø1ñØEVðØZ`ñò øô ò ÙðúÙð	úô Ø/Ð0MÐ/Nð OEð Eó
ð 	
sr   Â1	N)Â;N)Ç=N.ÎN; Î.N8Î;	PÏOÏPÏ	O+Ï(PÏ*O+Ï+PÏ/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)r¯   Úregister)Úconfig_classrÊ   rö   s      r¸   r÷   zAutoProcessor.register}  s   € ô 	×"Ñ" <°È8Ð"ÕTrÀ   N)F)r§   Ú
__module__Ú__qualname__Ú__doc__r¿   Úclassmethodr   r©   rà   Ústaticmethodr÷   © rÀ   r¸   r»   r»   ž   sH   „ ñò
ð Ù&Ð'>Ó?ñM
ó @ó ðM
ð^ ò	Uó ñ	UrÀ   r»   )/rû   r«   rÔ   rÝ   râ   rÏ   Úcollectionsr   Úconfiguration_utilsr   Údynamic_module_utilsr   r   Úfeature_extraction_utilsr   Úimage_processing_utilsr	   Úprocessing_utilsr
   Útokenization_utilsr   Úutilsr   r   r   r   Úauto_factoryr   Úconfiguration_autor   r   r   r   Úfeature_extraction_autor   Úimage_processing_autor   Útokenization_autor   Ú
get_loggerr§   Úloggerr©   r¯   Ústrr¹   r»   rþ   rÀ   r¸   ú<module>r     s    ðñ ã Û Û Û 	Û Ý #õ 4ß \Ý >Ý :Ý .Ý 7ß QÓ QÝ *÷ó õ :Ý 5Ý ,ð 
ˆ×	Ñ	˜HÓ	%€á%òQóSÐ ñj %Ð%9Ð;RÓSÐ ð¨#ó ÷0iUò iUrÀ   