
    fThL                     l   S r SSKrSSKrSSKrSSKrSSKrSSKJr  SSKJ	r	  SSK
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Jr  SSKJr  SSKJr  SSKJ r J!r!J"r"J#r#  SSK$J%r%  SSK&J'r'  SSK(J)r)  \RT                  " \+5      r,\" / SQ5      r-\" \ \-5      r.S\/4S jr0 " S S5      r1SS/r2g)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VIDEO_PROCESSOR_NAMEcached_filelogging)BaseVideoProcessor   )_LazyAutoMapping)CONFIG_MAPPING_NAMES
AutoConfigmodel_type_to_module_name!replace_list_option_in_docstrings)AutoFeatureExtractor)AutoImageProcessor)AutoTokenizer)U)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)granite_speechGraniteSpeechProcessor)zgrounding-dinoGroundingDinoProcessor)groupvitr1   )hubertWav2Vec2Processor)ideficsIdeficsProcessor)idefics2Idefics2Processor)idefics3Idefics3Processor)instructblipInstructBlipProcessor)instructblipvideoInstructBlipVideoProcessor)internvlInternVLProcessor)janusJanusProcessor)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)	moonshinerI   )	oneformerOneFormerProcessor)owlv2Owlv2Processor)owlvitOwlViTProcessor)	paligemmaPaliGemmaProcessor)phi4_multimodalPhi4MultimodalProcessor)
pix2structPix2StructProcessor)pixtralrm   )	pop2pianoPop2PianoProcessor)qwen2_5_omniQwen2_5OmniProcessor)
qwen2_5_vlQwen2_5_VLProcessor)qwen2_audioQwen2AudioProcessor)qwen2_vlQwen2VLProcessor)samSamProcessor)sam_hqSamHQProcessor)seamless_m4tSeamlessM4TProcessor)sewrI   )zsew-drI   )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)	unispeechrI   )zunispeech-satrI   )video_llavaVideoLlavaProcessor)viltViltProcessor)vipllavar`   )zvision-text-dual-encoderVisionTextDualEncoderProcessor)wav2vec2rI   )zwav2vec2-bertrI   )zwav2vec2-conformerrI   )wavlmrI   )whisperWhisperProcessor)xclipXCLIPProcessor
class_namec                    [         R                  5        H=  u  p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[        XP5      (       a  [        XP5      $ g ! [         a     M  f = f)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         `/var/www/auris/envauris/lib/python3.13/site-packages/transformers/models/auto/processing_auto.pyprocessor_class_from_namer      s    #:#@#@#B#3K@K,,q->@UVFv22 $C '55<<>	9j$/:= ? )).9K{''{// " s   
C
CCc                   X    \ rS rSrSrS r\\" \5      S 5       5       r	\
SS j5       rSrg)	AutoProcessor   a  
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                     [        S5      e)Nz}AutoProcessor is designed to be instantiated using the `AutoProcessor.from_pretrained(pretrained_model_name_or_path)` method.)EnvironmentError)selfs    r   __init__AutoProcessor.__init__   s    _
 	
    c                 	   UR                  SS5      nUb=  [        R                  " S[        5        UR	                  SS5      b  [        S5      eX2S'   UR                  SS5      nUR                  SS5      nSUS	'   SnSn[        R                  " [        5      R                  R                  5        Vs0 s H  oU;   d  M
  XU   _M     n	nU	R                  S
S
S
S.5        [        U[        40 U	D6n
U
bI  [        R                  " U40 UD6u  pUR	                  SS5      nSUR	                  S0 5      ;   a  US   S   nUGc   [        U[        40 U	D6nUbI  [         R"                  " U40 UD6u  pUR	                  SS5      nSUR	                  S0 5      ;   a  US   S   nUc]  [        U[$        40 U	D6nUbI  [&        R(                  " U40 UD6u  pUR	                  SS5      nSUR	                  S0 5      ;   a  US   S   nUc`  [        U[        40 U	D6nUbL  UcI  [*        R,                  " U40 UD6u  pUR	                  SS5      nSUR	                  S0 5      ;   a  US   S   nUcm  [        U[.        40 U	D6nUbY  [1        USS9 n[2        R4                  " U5      nSSS5        WR	                  SS5      nSUR	                  S0 5      ;   a  US   S   nUck  [7        U[8        5      (       d  [:        R<                  " U4SU0UD6n[?        USS5      n[A        US5      (       a  SURB                  ;   a  URB                  S   nUb  [E        U5      nUSLnUSL=(       d    [G        U5      [H        ;   n[K        XQUU5      nU(       an  U(       ag  [M        Xq40 UD6nUR                  SS5      n[N        RP                  RS                  U5      (       a  URU                  5         UR<                  " U4SU0UD6$ Ub  UR<                  " U4SU0UD6$ [G        U5      [H        ;   a#  [H        [G        U5         R<                  " U40 UD6$  [V        R<                  " U4SU0UD6$ s  snf ! , (       d  f       GN= f! [X         aZ     [Z        R<                  " U4SU0UD6s $ ! [X         a     Of = f [\        R<                  " U4SU0UD6s $ ! [X         a      Of = ff = f[        SU S35      e)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   r   get_video_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   AutoProcessor.from_pretrained   s   J  $4d;%MM E zz'4(4 l  -7OHd+"JJ':DA#|!
 )0(9(9+(F(Q(Q(V(V(X
(Xci\iC(X 	 
 	!!499>;@	
 !,,I> p]o p ,+>>?\g`fgNK)oo.?FO+//*b"AA%0%<_%M""'2-/E(I[($ (3!5!N!NOl!wpv!w"-//2CT"J"kooj"&EE)4Z)@)Q& (/+613G,K],( ,7%7%P%P5&9?&NK '2oo6G&NO&+//*b*II-8-D_-U* (/+613I,M_,( ,7O<S%;%V%V5&9?&NK '2oo6G&NO&+//*b*II-8-D_-U*"$/-/D%HZ%! %0/'Bf"&))F"3K C #.//2CT"J"kooj"&EE)4Z)@)Q&"f&677#331EVZ`
 &f.?FOvz**&///Q%+___%E"&7HO,D8(4YVHY8Y5no
 0;"EKO 

?D1Aww}}:;;779"22-ARV\  ("22-ARV\  &\..$T&\2BBC`kdjkk	 00-ARV\ a
~ CBh  	)991EVZ`   +;;1EVZ`   	 /0M/N OE E
 	
sl   4	Q	QQ Q0 
Q-0
S;RS
R# S"R##S'S?S
SSSSc                 ,    [         R                  XUS9  g)z
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  AutoProcessor.register  s     	""<8"Tr    N)F)r   
__module____qualname____firstlineno____doc__r   classmethodr   r   r   staticmethodr  __static_attributes__r
  r   r   r   r      sH    
 &'>?^
 @ ^
@ 	U 	Ur   r   r   )3r  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   r   video_processing_utilsr   auto_factoryr   configuration_autor   r   r   r   feature_extraction_autor   image_processing_autor   tokenization_autor   
get_loggerr   loggerr   r   strr   r   __all__r
  r   r   <module>r$     s        	  # 4 \ > : . 7  9 *  : 5 , 
		H	%%VX t %%9;RS # 0zU zUz 
0r   