
    Z j?L                        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J	r	  SSK
Jr  SSKJrJrJrJrJrJr  S	S
KJr  S	SKJrJrJrJr  \R4                  " \5      r\" / SQ5      r\" \\5      rS\4S jr       SS\\RB                  -  S\\RB                  -  S-  S\"S\#\\4   S-  S\"\-  S-  S\S-  S\"4S jjr$ " S S5      r%SS/r&g)zAutoFeatureExtractor class.    N)OrderedDict   )PreTrainedConfig)get_class_from_dynamic_moduleresolve_trust_remote_code)FeatureExtractionMixin)CONFIG_NAMEFEATURE_EXTRACTOR_NAMEPROCESSOR_NAMEcached_fileloggingsafe_load_json_file   )_LazyAutoMapping)CONFIG_MAPPING_NAMES
AutoConfigmodel_type_to_module_name!replace_list_option_in_docstrings)6)zaudio-spectrogram-transformerASTFeatureExtractor)audioflamingo3WhisperFeatureExtractor)clapClapFeatureExtractor)clvpClvpFeatureExtractor)
cohere_asrCohereAsrFeatureExtractor)csmEncodecFeatureExtractor)dacDacFeatureExtractor)zdata2vec-audioWav2Vec2FeatureExtractor)diaDiaFeatureExtractor)encodecr   )gemma3nGemma3nAudioFeatureExtractor)gemma4Gemma4AudioFeatureExtractor)glmasrr   )granite_speechGraniteSpeechFeatureExtractor)granite_speech_plusr,   )higgs_audio_v2_tokenizerr!   )hubertr"   )kyutai_speech_to_text"KyutaiSpeechToTextFeatureExtractor)lasr_ctcLasrFeatureExtractor)lasr_encoderr3   )markuplmMarkupLMFeatureExtractor)mimir   )	moonshiner"   )moshir   )musicgenr   )musicgen_melodyMusicgenMelodyFeatureExtractor)parakeet_ctcParakeetFeatureExtractor)parakeet_encoderr>   )pe_audioPeAudioFeatureExtractor)pe_audio_videorA   )phi4_multimodalPhi4MultimodalFeatureExtractor)	pop2pianoPop2PianoFeatureExtractor)qwen2_5_omnir   )qwen2_audior   )qwen3_omni_moer   )seamless_m4tSeamlessM4TFeatureExtractor)seamless_m4t_v2rK   )sewr"   )zsew-dr"   )speech_to_textSpeech2TextFeatureExtractor)speecht5SpeechT5FeatureExtractor)	unispeechr"   )zunispeech-satr"   )univnetUnivNetFeatureExtractor)vibevoice_acoustic_tokenizer*VibeVoiceAcousticTokenizerFeatureExtractor)vibevoice_asrrV   )voxtralr   )voxtral_realtimeVoxtralRealtimeFeatureExtractor)wav2vec2r"   )zwav2vec2-bertr"   )zwav2vec2-conformerr"   )wavlmr"   )whisperr   )xcodecr!   
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)FEATURE_EXTRACTOR_MAPPING_NAMESitemsr   	importlibimport_modulegetattrAttributeErrorFEATURE_EXTRACTOR_MAPPING_extra_contentvalueshasattr)r_   module_name
extractorsmodule	extractormain_modules         ځ/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/transformers/models/auto/feature_extraction_auto.py!feature_extractor_class_from_namert   b   s    #B#H#H#J#3K@K,,q->@UVFv22 $K /==DDF	9j$/:= G )).9K{''{// " s   
C
CCpretrained_model_name_or_path	cache_dirforce_downloadproxiestokenrevisionlocal_files_onlyc                     [        U [        UUUUUUSSS9
n[        U [        UUUUUUSSS9
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
$ )ae
  
Loads the feature extractor configuration from a pretrained model feature extractor 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
          [`~FeatureExtractionMixin.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 feature extractor 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 feature extractor.

Examples:

```python
# Download configuration from huggingface.co and cache.
feature_extractor_config = get_feature_extractor_config("facebook/wav2vec2-base-960h")
# This model does not have a feature extractor config so the result will be an empty dict.
feature_extractor_config = get_feature_extractor_config("FacebookAI/xlm-roberta-base")

# Save a pretrained feature extractor locally and you can reload its config
from transformers import AutoFeatureExtractor

feature_extractor = AutoFeatureExtractor.from_pretrained("facebook/wav2vec2-base-960h")
feature_extractor.save_pretrained("feature-extractor-test")
feature_extractor_config = get_feature_extractor_config("feature-extractor-test")
```F)	filenamerv   rw   rx   ry   rz   r{    _raise_exceptions_for_gated_repo%_raise_exceptions_for_missing_entriesz:Could not locate the feature extractor configuration file.feature_extractor)r   r   r
   loggerinfor   )ru   rv   rw   rx   ry   rz   r{   kwargsresolved_processor_fileresolved_feature_extractor_filefeature_extractor_dictprocessor_dicts               rs   get_feature_extractor_configr   z   s    D *%%))..3 '2%'%))..3'# +3JPQ	
  *,-DE.0%34G%H"&27M7U!45T!U!!    c                   X    \ rS rSrSrS r\\" \5      S 5       5       r	\
SS j5       rSrg)	AutoFeatureExtractor   a  
This is a generic feature extractor class that will be instantiated as one of the feature extractor classes of the
library when created with the [`AutoFeatureExtractor.from_pretrained`] class method.

This class cannot be instantiated directly using `__init__()` (throws an error).
c                     [        S5      e)NzAutoFeatureExtractor is designed to be instantiated using the `AutoFeatureExtractor.from_pretrained(pretrained_model_name_or_path)` method.)OSError)selfs    rs   __init__AutoFeatureExtractor.__init__   s    f
 	
r   c                    UR                  SS5      nUR                  SS5      nSUS'   [        R                  " U40 UD6u  pVUR                  SS5      nSnSUR                  S0 5      ;   a  US   S   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[#        XAXU5      nU	(       aO  U(       aH  U(       dA  [%        X40 UD6nUR                  SS5      nUR'                  5         UR                  " U40 UD6$ Ub  UR                  " U40 UD6$ [        U5      [        ;   a%  [        [        U5         nUR                  " U40 UD6$ [)        SU S[*         S[,         S[,         SSR/                  S [0         5       5       3
5      e)a
  
Instantiate one of the feature extractor classes of the library from a pretrained model vocabulary.

The feature extractor 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 feature_extractor hosted inside a model repo on
          huggingface.co.
        - a path to a *directory* containing a feature extractor file saved using the
          [`~feature_extraction_utils.FeatureExtractionMixin.save_pretrained`] method, e.g.,
          `./my_model_directory/`.
        - a path to a saved feature extractor 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 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 AutoFeatureExtractor

>>> # Download feature extractor from huggingface.co and cache.
>>> feature_extractor = AutoFeatureExtractor.from_pretrained("facebook/wav2vec2-base-960h")

>>> # If feature extractor files are in a directory (e.g. feature extractor was saved using *save_pretrained('./test/saved_model/')*)
>>> # feature_extractor = AutoFeatureExtractor.from_pretrained("./test/saved_model/")
```configNtrust_remote_codeT
_from_autofeature_extractor_typer   auto_mapztransformers.z--r   code_revisionz"Unrecognized feature extractor in z4. Should have a `feature_extractor_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     rs   	<genexpr>7AutoFeatureExtractor.from_pretrained.<locals>.<genexpr>s  s     @lLkqLks   )popr   get_feature_extractor_dictget
isinstancer   r   from_pretrainedrh   rm   r   rt   typerj   
__module__
startswithsplitr   r   register_for_auto_class
ValueErrorr
   r	   joinrd   )clsru   r   r   r   config_dict_feature_extractor_classfeature_extractor_auto_maphas_remote_codehas_local_codeexplicit_local_codeupstream_repos                rs   r   $AutoFeatureExtractor.from_pretrained   s   L Hd+"JJ':DA#|/JJKhslrs"-//2JD"Q%)"![__Z%DD)4Z)@AW)X& #*/I/Qf&677#331EVZ` '.f6NPT&U#vz**/E/X-3__=S-T*".&GH_&`#4D@0<iVPi@i, 1#N'@f'N
*ZZ021 11 : @ @ Fq I $ 9!.cp! 09L&C*'MS'# 

?D1A#;;=*::;Xc\bcc$0*::;Xc\bcc&\66&?V&M#*::;Xc\bcc01N0O P33I2J${m \((3}Btyy@lLk@l7l6mo
 	
r   c                 ,    [         R                  XUS9  g)a   
Register a new feature extractor for this class.

Args:
    config_class ([`PreTrainedConfig`]):
        The configuration corresponding to the model to register.
    feature_extractor_class ([`FeatureExtractorMixin`]): The feature extractor to register.
)exist_okN)rj   register)config_classr   r   s      rs   r   AutoFeatureExtractor.registerv  s     	"**<[c*dr   r   N)F)rb   r   __qualname____firstlineno____doc__r   classmethodr   rd   r   staticmethodr   __static_attributes__r   r   rs   r   r      sH    
 &'FG|
 H |
| 	e 	er   r   rj   )NFNNNF)'r   rf   oscollectionsr   configuration_utilsr   dynamic_module_utilsr   r   feature_extraction_utilsr   utilsr	   r
   r   r   r   r   auto_factoryr   configuration_autor   r   r   r   
get_loggerrb   r   rd   rj   strrt   PathLikebooldictr   r   __all__r   r   rs   <module>r      s"   "  	 # 4 \ > s s *  
		H	%"-79# v --ACbc # 4 +/ %)#"k"#&#4k"R[[ 4'k" k" #s(^d"	k"
 #:k" Djk" k"\Xe Xev '(>
?r   