Ë
    S^(hëv  ã                   óò  — d 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m	Z	m
Z
mZ ddlZddlmZ ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z# er e«       rddl$Z$ e"jJ                  e&«      Z'ed   Z( G d	„ d
e«      Z) G d„ de«      Z* ee*jV                  «      e*_+        e*jV                  j                   �8e*jV                  j                   jY                  ddd¬«      e*jV                  _         yy)zH
Feature extraction saving/loading class for common feature extractors.
é    N)ÚUserDict)ÚTYPE_CHECKINGÚAnyÚOptionalÚUnioné   )Úcustom_object_save)ÚFEATURE_EXTRACTOR_NAMEÚPushToHubMixinÚ
TensorTypeÚadd_model_info_to_auto_mapÚ"add_model_info_to_custom_pipelinesÚcached_fileÚ	copy_funcÚdownload_urlÚis_flax_availableÚis_jax_tensorÚis_numpy_arrayÚis_offline_modeÚis_remote_urlÚis_tf_availableÚis_torch_availableÚis_torch_deviceÚis_torch_dtypeÚloggingÚrequires_backendsÚSequenceFeatureExtractorc                   óÎ   ‡ — e Zd ZdZddeeeef      dedee	f   fˆ fd„Z
dedee   fd„Zdefd	„Zd
„ Zd„ Zd„ Zd„ Zd„ Zddeeee	f      fd„Zddeeee	f      fd„Zdd„Zˆ xZS )ÚBatchFeatureaU  
    Holds the output of the [`~SequenceFeatureExtractor.pad`] and feature extractor specific `__call__` methods.

    This class is derived from a python dictionary and can be used as a dictionary.

    Args:
        data (`dict`, *optional*):
            Dictionary of lists/arrays/tensors returned by the __call__/pad methods ('input_values', 'attention_mask',
            etc.).
        tensor_type (`Union[None, str, TensorType]`, *optional*):
            You can give a tensor_type here to convert the lists of integers in PyTorch/TensorFlow/Numpy Tensors at
            initialization.
    NÚdataÚtensor_typec                 óH   •— t         ‰| �  |«       | j                  |¬«       y )N)r!   )ÚsuperÚ__init__Úconvert_to_tensors)Úselfr    r!   Ú	__class__s      €úc/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/feature_extraction_utils.pyr$   zBatchFeature.__init__L   s!   ø€ Ü‰Ñ˜ÔØ×Ñ¨KÐÕ8ó    ÚitemÚreturnc                 óV   — t        |t        «      r| j                  |   S t        d«      ‚)z�
        If the key is a string, returns the value of the dict associated to `key` ('input_values', 'attention_mask',
        etc.).
        zRIndexing with integers is not available when using Python based feature extractors)Ú
isinstanceÚstrr    ÚKeyError©r&   r*   s     r(   Ú__getitem__zBatchFeature.__getitem__P   s(   € ô
 �dœCÔ Ø—9‘9˜T‘?Ð"äÐoÓpÐpr)   c                 óH   — 	 | j                   |   S # t        $ r t        ‚w xY w©N)r    r/   ÚAttributeErrorr0   s     r(   Ú__getattr__zBatchFeature.__getattr__Z   s*   € ð	!Ø—9‘9˜T‘?Ð"øÜò 	!Ü Ð ð	!ús   ‚ ‘!c                 ó   — d| j                   iS ©Nr    ©r    ©r&   s    r(   Ú__getstate__zBatchFeature.__getstate__`   s   € Ø˜Ÿ	™	Ð"Ð"r)   c                 ó"   — d|v r|d   | _         y y r7   r8   )r&   Ústates     r(   Ú__setstate__zBatchFeature.__setstate__c   s   € Ø�U‰?Ø˜f™ˆD�Ið r)   c                 ó6   — | j                   j                  «       S r3   )r    Úkeysr9   s    r(   r?   zBatchFeature.keysh   s   € Ø�y‰y�~‰~ÓÐr)   c                 ó6   — | j                   j                  «       S r3   )r    Úvaluesr9   s    r(   rA   zBatchFeature.valuesl   s   € Ø�y‰y×ÑÓ!Ð!r)   c                 ó6   — | j                   j                  «       S r3   )r    Úitemsr9   s    r(   rC   zBatchFeature.itemsp   s   € Ø�y‰y�‰Ó Ð r)   c                 óü  ‡‡— |€yt        |t        «      st        |«      }|t        j                  k(  r5t        «       st	        d«      ‚dd l}|j                  Š|j                  }|‰fS |t        j                  k(  r.t        «       st	        d«      ‚dd l
Šˆfd„Š‰j                  }|‰fS |t        j                  k(  r1t        «       st	        d«      ‚dd lm} |j                  Št         }|‰fS dˆfd„	Št"        }|‰fS )	N©NNzSUnable to convert output to TensorFlow tensors format, TensorFlow is not installed.r   zMUnable to convert output to PyTorch tensors format, PyTorch is not installed.c                 óì  •— t        | t        t        f«      r t        | «      dkD  r’t        | d   t        j
                  «      rt	        j                  | «      } n_t        | d   t        t        f«      rFt        | d   «      dkD  r5t        | d   d   t        j
                  «      rt	        j                  | «      } t        | t        j
                  «      r ‰j                  | «      S  ‰j                  | «      S )Nr   )	r-   ÚlistÚtupleÚlenÚnpÚndarrayÚarrayÚ
from_numpyÚtensor)ÚvalueÚtorchs    €r(   Ú	as_tensorz5BatchFeature._get_is_as_tensor_fns.<locals>.as_tensorŠ   s±   ø€ Ü˜e¤d¬E ]Ô3¼¸E»
ÀQºÜ! %¨¡(¬B¯J©JÔ7Ü "§¡¨£™ä" 5¨¡8¬d´E¨]Ô;Ü  a¡›M¨AÒ-Ü& u¨Q¡x°¡{´B·J±JÔ?ä "§¡¨£˜Ü˜e¤R§Z¡ZÔ0Ø+˜5×+Ñ+¨EÓ2Ð2à'˜5Ÿ<™<¨Ó.Ð.r)   zEUnable to convert output to JAX tensors format, JAX is not installed.c                 ó‚  •— t        | t        t        f«      rˆt        | d   t        t        t        j                  f«      r`| D �cg c]  }t        |«      ‘Œ }}t        t        |«      «      dkD  r1|€/ ‰| D �cg c]  }t        j                  |«      ‘Œ c}t        ¬«      } t        j                  | |¬«      S c c}w c c}w )Nr   r   )Údtype)	r-   rG   rH   rJ   rK   rI   ÚsetÚasarrayÚobject)rO   rS   ÚvalÚ
value_lensrQ   s       €r(   rQ   z5BatchFeature._get_is_as_tensor_fns.<locals>.as_tensor£   s•   ø€ Ü˜e¤d¬E ]Ô3¼
À5ÈÁ8ÌdÔTYÔ[]×[eÑ[eÐMfÔ8gØ6;Ö!<¨s¤# c¥(Ð!<�JÐ!<Üœ3˜z›?Ó+¨aÒ/°E°Má )ÀeÖ*L¸s¬2¯:©:°c­?Ò*LÔTZÔ [˜Ü—z‘z %¨uÔ5Ð5ùò	 "=ùò +Ms   ÁB7Á7B<r3   )r-   r   Ú
TENSORFLOWr   ÚImportErrorÚ
tensorflowÚconstantÚ	is_tensorÚPYTORCHr   rP   ÚJAXr   Ú	jax.numpyÚnumpyrL   r   r   )r&   r!   Útfr]   ÚjnprQ   rP   s        @@r(   Ú_get_is_as_tensor_fnsz"BatchFeature._get_is_as_tensor_fnss   s  ù€ ØÐØô ˜+¤zÔ2Ü$ [Ó1ˆKð œ*×/Ñ/Ò/Ü"Ô$Ü!Øióð ó $àŸ™ˆIØŸ™ˆIðP ˜)Ð#Ð#ðO œJ×.Ñ.Ò.Ü%Ô'Ü!Ð"qÓrÐrÛô/ð Ÿ™ˆIð& ˜)Ð#Ð#ð% œJŸN™NÒ*Ü$Ô&Ü!Ð"iÓjÐjÝ#àŸ	™	ˆIÜ%ˆIð ˜)Ð#Ð#õ6ô 'ˆIØ˜)Ð#Ð#r)   c                 óÒ   — |€| S | j                  |«      \  }}| j                  «       D ]  \  }}	  ||«      s ||«      }|| |<   Œ | S #  |dk(  rt        d«      ‚t        d«      ‚xY w)a5  
        Convert the inner content to tensors.

        Args:
            tensor_type (`str` or [`~utils.TensorType`], *optional*):
                The type of tensors to use. If `str`, should be one of the values of the enum [`~utils.TensorType`]. If
                `None`, no modification is done.
        Úoverflowing_valueszKUnable to create tensor returning overflowing values of different lengths. zUnable to create tensor, you should probably activate padding with 'padding=True' to have batched tensors with the same length.)rd   rC   Ú
ValueError)r&   r!   r]   rQ   ÚkeyrO   rN   s          r(   r%   zBatchFeature.convert_to_tensors®   s–   € ð ÐØˆKà#×9Ñ9¸+ÓFÑˆ	�9ð Ÿ*™*›,ò 	‰JˆC�ðÙ  Ô'Ù& uÓ-�Fà &�D˜‘Iøð	ð ˆøðØÐ.Ò.Ü$Ð%rÓsÐsÜ ðXóð ús   °A	Á	A&c                 ób  — t        | dg«       ddl}i }|j                  d«      }|j                  dd«      }|€et        |«      dkD  rW|d   }t	        |«      rnFt        |t        «      st        |«      st        |t        «      r|}nt        dt        |«      › d�«      ‚| j                  «       D ]w  \  }}	t        |	|j                  «      r( |j                  |	«      r |	j                  |i |¤Ž||<   ŒDt        |	|j                  «      r|�|	j                  ||¬	«      ||<   Œs|	||<   Œy || _        | S )
a�  
        Send all values to device by calling `v.to(*args, **kwargs)` (PyTorch only). This should support casting in
        different `dtypes` and sending the `BatchFeature` to a different `device`.

        Args:
            args (`Tuple`):
                Will be passed to the `to(...)` function of the tensors.
            kwargs (`Dict`, *optional*):
                Will be passed to the `to(...)` function of the tensors.
                To enable asynchronous data transfer, set the `non_blocking` flag in `kwargs` (defaults to `False`).

        Returns:
            [`BatchFeature`]: The same instance after modification.
        rP   r   NÚdeviceÚnon_blockingFz*Attempting to cast a BatchFeature to type z. This is not supported.)rj   rk   )r   rP   ÚgetrI   r   r-   r.   r   Úintrg   rC   ÚTensorÚis_floating_pointÚtor    )
r&   ÚargsÚkwargsrP   Únew_datarj   rk   ÚargÚkÚvs
             r(   rp   zBatchFeature.toÍ   s&  € ô 	˜$  	Ô*ÛàˆØ—‘˜HÓ%ˆØ—z‘z .°%Ó8ˆàˆ>œc $›i¨!šmà�q‘'ˆCÜ˜cÔ"àÜ˜C¤Ô%¬¸Ô)=ÄÈCÔQTÔAUØ‘ô !Ð#MÌcÐRUËhÈZÐWoÐ!pÓqÐqà—J‘J“Lò 	 ‰DˆAˆqä˜!˜UŸ\™\Ô*Ð/F¨u×/FÑ/FÀqÔ/Ià"˜aŸd™d DÐ3¨FÑ3�˜’Ü˜A˜uŸ|™|Ô,°Ð1CØŸd™d¨&¸|˜dÓL�˜’à�˜’ð	 ð ˆŒ	Øˆr)   rE   r3   )r+   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Údictr.   r   r   r   r$   r1   r5   r:   r=   r?   rA   rC   rd   r%   rp   Ú__classcell__)r'   s   @r(   r   r   =   s°   ø„ ññ9˜X d¨3°¨8¡nÑ5ð 9È5ÐQUÐWZÐ\fÐQfÑKgõ 9ðq ð q¨¨c©
ó qð! ó !ò#ò&ò
 ò"ò!ñ9$°¸%ÀÀZÀÑ:PÑ1Qó 9$ñv¨h°u¸SÀ*¸_Ñ7MÑ.Nó ÷>,r)   r   c                   óô  — e Zd ZdZdZd„ Zdefd„Ze	 	 	 	 	 dde	ee
j                  f   dee	ee
j                  f      ded	ed
ee	eef      defd„«       Zdde	ee
j                  f   defd„Zede	ee
j                  f   deeeef   eeef   f   fd„«       Zedeeef   defd„«       Zdeeef   fd„Zede	ee
j                  f   defd„«       Zdefd„Zde	ee
j                  f   fd„Zd„ Zedd„«       Zy)ÚFeatureExtractionMixinzŠ
    This is a feature extraction mixin used to provide saving/loading functionality for sequential and image feature
    extractors.
    Nc           
      óà   — |j                  dd«      | _        |j                  «       D ]  \  }}	 t        | ||«       Œ y# t        $ r%}t
        j                  d|› d|› d| › �«       |‚d}~ww xY w)z'Set elements of `kwargs` as attributes.Úprocessor_classNz
Can't set z with value z for )ÚpopÚ_processor_classrC   Úsetattrr4   ÚloggerÚerror)r&   rr   rh   rO   Úerrs        r(   r$   zFeatureExtractionMixin.__init__  sx   € ð !'§
¡
Ð+<¸dÓ CˆÔà Ÿ,™,›.ò 	‰JˆC�ðÜ˜˜c 5Õ)ñ	øô "ò Ü—‘˜z¨#¨¨l¸5¸'ÀÀtÀfÐMÔNØ�	ûðús   ¯?¿	A-Á A(Á(A-r€   c                 ó   — || _         y)z%Sets processor class as an attribute.N)r‚   )r&   r€   s     r(   Ú_set_processor_classz+FeatureExtractionMixin._set_processor_class  s
   € à /ˆÕr)   Úpretrained_model_name_or_pathÚ	cache_dirÚforce_downloadÚlocal_files_onlyÚtokenÚrevisionc                 ó  — ||d<   ||d<   ||d<   ||d<   |j                  dd«      }|�)t        j                  dt        «       |�t	        d«      ‚|}|�||d	<    | j
                  |fi |¤Ž\  }	} | j                  |	fi |¤ŽS )
a¨  
        Instantiate a type of [`~feature_extraction_utils.FeatureExtractionMixin`] from a feature extractor, *e.g.* a
        derived class of [`SequenceFeatureExtractor`].

        Args:
            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 or url 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.
            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`, or not specified, 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.


                <Tip>

                To test a pull request you made on the Hub, you can pass `revision="refs/pr/<pr_number>"`.

                </Tip>

            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.
            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.

        Returns:
            A feature extractor of type [`~feature_extraction_utils.FeatureExtractionMixin`].

        Examples:

        ```python
        # We can't instantiate directly the base class *FeatureExtractionMixin* nor *SequenceFeatureExtractor* so let's show the examples on a
        # derived class: *Wav2Vec2FeatureExtractor*
        feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained(
            "facebook/wav2vec2-base-960h"
        )  # Download feature_extraction_config from huggingface.co and cache.
        feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained(
            "./test/saved_model/"
        )  # E.g. feature_extractor (or model) was saved using *save_pretrained('./test/saved_model/')*
        feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained("./test/saved_model/preprocessor_config.json")
        feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained(
            "facebook/wav2vec2-base-960h", return_attention_mask=False, foo=False
        )
        assert feature_extractor.return_attention_mask is False
        feature_extractor, unused_kwargs = Wav2Vec2FeatureExtractor.from_pretrained(
            "facebook/wav2vec2-base-960h", return_attention_mask=False, foo=False, return_unused_kwargs=True
        )
        assert feature_extractor.return_attention_mask is False
        assert unused_kwargs == {"foo": False}
        ```rŠ   r‹   rŒ   rŽ   Úuse_auth_tokenNúrThe `use_auth_token` argument is deprecated and will be removed in v5 of Transformers. Please use `token` instead.úV`token` and `use_auth_token` are both specified. Please set only the argument `token`.r�   )r�   ÚwarningsÚwarnÚFutureWarningrg   Úget_feature_extractor_dictÚ	from_dict)
Úclsr‰   rŠ   r‹   rŒ   r�   rŽ   rr   r�   Úfeature_extractor_dicts
             r(   Úfrom_pretrainedz&FeatureExtractionMixin.from_pretrained  s¿   € ðp (ˆˆ{ÑØ#1ˆÐÑ Ø%5ˆÐ!Ñ"Ø%ˆˆzÑàŸ™Ð$4°dÓ;ˆØÐ%Ü�M‰Mð EÜôð Ð Ü Ølóð ð #ˆEàÐØ#ˆF�7‰Oà)G¨×)GÑ)GÐHeÑ)pÐioÑ)pÑ&Ð àˆs�}‰}Ð3Ñ>°vÑ>Ð>r)   Úsave_directoryÚpush_to_hubc           	      ó6  — |j                  dd«      }|�<t        j                  dt        «       |j	                  dd«      �t        d«      ‚||d<   t        j                  j                  |«      rt        d|› d�«      ‚t        j                  |d¬	«       |rr|j                  d
d«      }|j                  d|j                  t        j                  j                  «      d   «      } | j                  |fi |¤Ž}| j                  |«      }| j                  �t!        | || ¬«       t        j                  j#                  |t$        «      }| j'                  |«       t(        j+                  d|› �«       |r%| j-                  ||j	                  d«      ¬«       |gS )az  
        Save a feature_extractor object to the directory `save_directory`, so that it can be re-loaded using the
        [`~feature_extraction_utils.FeatureExtractionMixin.from_pretrained`] class method.

        Args:
            save_directory (`str` or `os.PathLike`):
                Directory where the feature extractor JSON file will be saved (will be created if it does not exist).
            push_to_hub (`bool`, *optional*, defaults to `False`):
                Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the
                repository you want to push to with `repo_id` (will default to the name of `save_directory` in your
                namespace).
            kwargs (`Dict[str, Any]`, *optional*):
                Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method.
        r�   Nr‘   r�   r’   zProvided path (z#) should be a directory, not a fileT)Úexist_okÚcommit_messageÚrepo_idéÿÿÿÿ)ÚconfigzFeature extractor saved in )rŸ   r�   )r�   r“   r”   r•   rl   rg   ÚosÚpathÚisfileÚAssertionErrorÚmakedirsÚsplitÚsepÚ_create_repoÚ_get_files_timestampsÚ_auto_classr	   Újoinr
   Úto_json_filer„   ÚinfoÚ_upload_modified_files)	r&   r›   rœ   rr   r�   rŸ   r    Úfiles_timestampsÚoutput_feature_extractor_files	            r(   Úsave_pretrainedz&FeatureExtractionMixin.save_pretrained„  s†  € ð  Ÿ™Ð$4°dÓ;ˆàÐ%Ü�M‰Mð EÜôð �z‰z˜' 4Ó(Ð4Ü Ølóð ð -ˆF�7‰Oä�7‰7�>‰>˜.Ô)Ü  ?°>Ð2BÐBeÐ!fÓgÐgä
�‰�N¨TÕ2áØ#ŸZ™ZÐ(8¸$Ó?ˆNØ—j‘j ¨N×,@Ñ,@ÄÇÁÇÁÓ,MÈbÑ,QÓRˆGØ'�d×'Ñ'¨Ñ:°6Ñ:ˆGØ#×9Ñ9¸.ÓIÐð ×ÑÐ'Ü˜t ^¸DÕAô )+¯©¯©°^ÔE[Ó(\Ð%à×ÑÐ7Ô8Ü�‰Ð1Ð2OÐ1PÐQÔRáØ×'Ñ'ØØØ Ø-Ø—j‘j Ó)ð (ô ð .Ð.Ð.r)   r+   c                 óÚ  — |j                  dd«      }|j                  dd«      }|j                  dd«      }|j                  dd«      }|j                  dd«      }|j                  dd«      }|j                  d	d«      }	|j                  d
d«      }
|j                  dd«      }|	�)t        j                  dt        «       |�t	        d«      ‚|	}|j                  dd«      }|j                  dd«      }d|dœ}|�||d<   t        «       r|
st        j                  d«       d}
t        |«      }t        j                  j                  |«      }t        j                  j                  |«      r$t        j                  j                  |t        «      }t        j                  j                  |«      r|}d}n6t        |«      r|}t!        |«      }nt        }	 t#        |||||||
||||¬«      }	 t)        |d¬«      5 }|j+                  «       }ddd«       t-        j.                  «      }|rt        j                  d|› �«       nt        j                  d› d|› �«       |s,d |v rt3        |d    |«      |d <   d!|v rt5        |d!   |«      |d!<   ||fS # t$        $ r ‚ t&        $ r t%        d|› d|› dt        › d�«      ‚w xY w# 1 sw Y   ŒµxY w# t,        j0                  $ r t%        d|› d�«      ‚w xY w)"a6  
        From a `pretrained_model_name_or_path`, resolve to a dictionary of parameters, to be used for instantiating a
        feature extractor of type [`~feature_extraction_utils.FeatureExtractionMixin`] using `from_dict`.

        Parameters:
            pretrained_model_name_or_path (`str` or `os.PathLike`):
                The identifier of the pre-trained checkpoint from which we want the dictionary of parameters.

        Returns:
            `Tuple[Dict, Dict]`: The dictionary(ies) that will be used to instantiate the feature extractor object.
        rŠ   Nr‹   FÚresume_downloadÚproxiesÚ	subfolderr�   r�   rŒ   rŽ   r‘   r’   Ú_from_pipelineÚ
_from_autoúfeature extractor)Ú	file_typeÚfrom_auto_classÚusing_pipelinez+Offline mode: forcing local_files_only=TrueT)	rŠ   r‹   r¶   rµ   rŒ   r·   r�   Ú
user_agentrŽ   z"Can't load feature extractor for 'zœ'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'z2' is the correct path to a directory containing a z fileúutf-8©Úencodingz"It looks like the config file at 'z' is not a valid JSON file.zloading configuration file z from cache at Úauto_mapÚcustom_pipelines)r�   r“   r”   r•   rg   r   r„   r¯   r.   r£   r¤   Úisdirr­   r
   r¥   r   r   r   ÚOSErrorÚ	ExceptionÚopenÚreadÚjsonÚloadsÚJSONDecodeErrorr   r   )r˜   r‰   rr   rŠ   r‹   rµ   r¶   r·   r�   r�   rŒ   rŽ   Úfrom_pipeliner¼   r¾   Úis_localÚfeature_extractor_fileÚresolved_feature_extractor_fileÚreaderÚtextr™   s                        r(   r–   z1FeatureExtractionMixin.get_feature_extractor_dictÁ  sA  € ð —J‘J˜{¨DÓ1ˆ	ØŸ™Ð$4°eÓ<ˆØ Ÿ*™*Ð%6¸Ó=ˆØ—*‘*˜Y¨Ó-ˆØ—J‘J˜{¨DÓ1ˆ	Ø—
‘
˜7 DÓ)ˆØŸ™Ð$4°dÓ;ˆØ!Ÿ:™:Ð&8¸%Ó@ÐØ—:‘:˜j¨$Ó/ˆàÐ%Ü�M‰Mð EÜôð Ð Ü Ølóð ð #ˆEàŸ
™
Ð#3°TÓ:ˆØ Ÿ*™* \°5Ó9ˆà#6È?Ñ[ˆ
ØÐ$Ø+8ˆJÐ'Ñ(äÔÑ%5Ü�K‰KÐEÔFØ#Ðä(+Ð,IÓ(JÐ%Ü—7‘7—=‘=Ð!>Ó?ˆÜ�7‰7�=‰=Ð6Ô7Ü%'§W¡W§\¡\Ð2OÔQgÓ%hÐ"Ü�7‰7�>‰>Ð7Ô8Ø.KÐ+Ø‰HÜÐ8Ô9Ø%BÐ"Ü.:Ð;XÓ.YÑ+ä%;Ð"ðä2=Ø1Ø*Ø'Ø#1Ø#Ø$3Ø%5Ø'ØØ)Ø%ô3Ð/ð4		äÐ5ÀÔHð %ÈFØ—{‘{“}�÷%ä%)§Z¡Z°Ó%5Ð"ñ Ü�K‰KÐ5Ð6UÐ5VÐWÕXä�K‰KØ-Ð.DÐ-EÀ_ÐUtÐTuÐvôñ ØÐ3Ñ3Ü5OØ*¨:Ñ6Ð8Uó6Ð& zÑ2ð "Ð%;Ñ;Ü=_Ø*Ð+=Ñ>Ð@]ó>Ð&Ð'9Ñ:ð & vÐ-Ð-øôS ò ð Üò äØ8Ð9VÐ8Wð X9à9VÐ8Wð X/Ü/EÐ.FÀeðMóð ðú÷%ð %ûô ×#Ñ#ò 	ÜØ4Ð5TÐ4UÐUpÐqóð ð	ús0   ÇJ Ç)K Ç6J;ÈK Ê,J8Ê;KË K Ë#K*r™   c                 ó  — |j                  dd«      }g }|j                  «       D ]   \  }}||v sŒ|||<   |j                  |«       Œ" |D ]  }|j                  |d«       Œ  | di |¤Ž}t        j	                  d|› �«       |r||fS |S )a	  
        Instantiates a type of [`~feature_extraction_utils.FeatureExtractionMixin`] from a Python dictionary of
        parameters.

        Args:
            feature_extractor_dict (`Dict[str, Any]`):
                Dictionary that will be used to instantiate the feature extractor object. Such a dictionary can be
                retrieved from a pretrained checkpoint by leveraging the
                [`~feature_extraction_utils.FeatureExtractionMixin.to_dict`] method.
            kwargs (`Dict[str, Any]`):
                Additional parameters from which to initialize the feature extractor object.

        Returns:
            [`~feature_extraction_utils.FeatureExtractionMixin`]: The feature extractor object instantiated from those
            parameters.
        Úreturn_unused_kwargsFNzFeature extractor © )r�   rC   Úappendr„   r¯   )r˜   r™   rr   rÓ   Ú	to_removerh   rO   Úfeature_extractors           r(   r—   z FeatureExtractionMixin.from_dict6  s²   € ð$  &Ÿz™zÐ*@À%ÓHÐð ˆ	Ø Ÿ,™,›.ò 	&‰JˆC�ØÐ,Ò,Ø.3Ð& sÑ+Ø× Ñ  Õ%ð	&ð ò 	"ˆCØ�J‰J�s˜DÕ!ð	"ñ  Ñ9Ð"8Ñ9Ðä�‰Ð(Ð):Ð(;Ð<Ô=ÙØ$ fÐ,Ð,à$Ð$r)   c                 ó’   — t        j                  | j                  «      }| j                  j                  |d<   d|v r|d= d|v r|d= |S )z´
        Serializes this instance to a Python dictionary. Returns:
            `Dict[str, Any]`: Dictionary of all the attributes that make up this configuration instance.
        Úfeature_extractor_typeÚmel_filtersÚwindow)ÚcopyÚdeepcopyÚ__dict__r'   rw   )r&   Úoutputs     r(   Úto_dictzFeatureExtractionMixin.to_dict[  sP   € ô
 —‘˜tŸ}™}Ó-ˆØ+/¯>©>×+BÑ+BˆÐ'Ñ(Ø˜FÑ"Ø�}Ð%Ø�vÑØ�xÐ Øˆr)   Ú	json_filec                 ó    — t        |d¬«      5 }|j                  «       }ddd«       t        j                  «      } | di |¤ŽS # 1 sw Y   Œ&xY w)aÞ  
        Instantiates a feature extractor of type [`~feature_extraction_utils.FeatureExtractionMixin`] from the path to
        a JSON file of parameters.

        Args:
            json_file (`str` or `os.PathLike`):
                Path to the JSON file containing the parameters.

        Returns:
            A feature extractor of type [`~feature_extraction_utils.FeatureExtractionMixin`]: The feature_extractor
            object instantiated from that JSON file.
        r¿   rÀ   NrÔ   )rÇ   rÈ   rÉ   rÊ   )r˜   rá   rÐ   rÑ   r™   s        r(   Úfrom_json_filez%FeatureExtractionMixin.from_json_fileh  sN   € ô �) gÔ.ð 	!°&Ø—;‘;“=ˆD÷	!ä!%§¡¨DÓ!1ÐÙÑ,Ð+Ñ,Ð,÷	!ð 	!ús   ŽAÁAc                 ó  — | j                  «       }|j                  «       D ]3  \  }}t        |t        j                  «      sŒ!|j                  «       ||<   Œ5 |j                  dd«      }|�||d<   t        j                  |dd¬«      dz   S )zÃ
        Serializes this instance to a JSON string.

        Returns:
            `str`: String containing all the attributes that make up this feature_extractor instance in JSON format.
        r‚   Nr€   é   T)ÚindentÚ	sort_keysú
)	rà   rC   r-   rJ   rK   Útolistr�   rÉ   Údumps)r&   Ú
dictionaryrh   rO   r‚   s        r(   Úto_json_stringz%FeatureExtractionMixin.to_json_string{  s…   € ð —\‘\“^ˆ
à$×*Ñ*Ó,ò 	1‰JˆC�Ü˜%¤§¡Õ,Ø"'§,¡,£.�
˜3’ð	1ð &Ÿ>™>Ð*<¸dÓCÐØÐ'Ø,<ˆJÐ(Ñ)ä�z‰z˜*¨Q¸$Ô?À$ÑFÐFr)   Újson_file_pathc                 óˆ   — t        |dd¬«      5 }|j                  | j                  «       «       ddd«       y# 1 sw Y   yxY w)zã
        Save this instance to a JSON file.

        Args:
            json_file_path (`str` or `os.PathLike`):
                Path to the JSON file in which this feature_extractor instance's parameters will be saved.
        Úwr¿   rÀ   N)rÇ   Úwriterì   )r&   rí   Úwriters      r(   r®   z#FeatureExtractionMixin.to_json_file�  s<   € ô �. #°Ô8ð 	0¸FØ�L‰L˜×,Ñ,Ó.Ô/÷	0÷ 	0ñ 	0ús	   � 8¸Ac                 óT   — | j                   j                  › d| j                  «       › �S )Nú )r'   rw   rì   r9   s    r(   Ú__repr__zFeatureExtractionMixin.__repr__›  s(   € Ø—.‘.×)Ñ)Ð*¨!¨D×,?Ñ,?Ó,AÐ+BÐCÐCr)   c                 ó�   — t        |t        «      s|j                  }ddlmc m} t        ||«      st        |› d�«      ‚|| _        y)a  
        Register this class with a given auto class. This should only be used for custom feature extractors as the ones
        in the library are already mapped with `AutoFeatureExtractor`.

        <Tip warning={true}>

        This API is experimental and may have some slight breaking changes in the next releases.

        </Tip>

        Args:
            auto_class (`str` or `type`, *optional*, defaults to `"AutoFeatureExtractor"`):
                The auto class to register this new feature extractor with.
        r   Nz is not a valid auto class.)	r-   r.   rw   Útransformers.models.autoÚmodelsÚautoÚhasattrrg   r¬   )r˜   Ú
auto_classÚauto_modules      r(   Úregister_for_auto_classz.FeatureExtractionMixin.register_for_auto_classž  sC   € ô  ˜*¤cÔ*Ø#×,Ñ,ˆJç6Ð6ä�{ JÔ/Ü 
˜|Ð+FÐGÓHÐHà$ˆ�r)   )NFFNÚmain)F)ÚAutoFeatureExtractor)rw   rx   ry   rz   r¬   r$   r.   rˆ   Úclassmethodr   r£   ÚPathLiker   Úboolrš   r³   rH   r{   r   r–   ÚPreTrainedFeatureExtractorr—   rà   rã   rì   r®   rô   rü   rÔ   r)   r(   r~   r~   ü   sÝ  „ ñð
 €Kò
ð0°Có 0ð ð 8<Ø$Ø!&Ø,0Øñm?à',¨S°"·+±+Ð-=Ñ'>ðm?ð ˜E # r§{¡{Ð"2Ñ3Ñ4ðm?ð ð	m?ð
 ðm?ð ˜˜c 4˜iÑ(Ñ)ðm?ð òm?ó ðm?ñ^;/¨e°C¸¿¹Ð4DÑ.Eð ;/ÐTXó ;/ðz ðr.Ø,1°#°r·{±{Ð2BÑ,Cðr.à	ˆt�C˜�H‰~˜t C¨ H™~Ð-Ñ	.òr.ó ðr.ðh ð"%¨t°C¸°H©~ð "%ÐLfò "%ó ð"%ðH˜˜c 3˜h™ó ð ð- u¨S°"·+±+Ð-=Ñ'>ð -ÐC]ò -ó ð-ð$G ó Gð*	0¨5°°b·k±kÐ1AÑ+Bó 	0òDð ò%ó ñ%r)   r~   rº   rþ   zfeature extractor file)rV   Úobject_classÚobject_files)-rz   rÜ   rÉ   r£   r“   Úcollectionsr   Útypingr   r   r   r   ra   rJ   Údynamic_module_utilsr	   Úutilsr
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rP   Ú
get_loggerrw   r„   r  r   r~   rœ   ÚformatrÔ   r)   r(   ú<module>r     sô   ðñó Û Û 	Û Ý  ß 6Ó 6ã å 4÷÷ ÷ ÷ ÷ ñ ñ. ÙÔÛð 
ˆ×	Ñ	˜HÓ	%€à"Ð#=Ñ>Ð ô|�8ô |ô~z%˜^ô z%ñz &/Ð/E×/QÑ/QÓ%RÐ Ô "Ø×%Ñ%×-Ñ-Ð9Ø1G×1SÑ1S×1[Ñ1[×1bÑ1bØ"Ð1GÐVnð 2có 2Ð×&Ñ&Õ.ð :r)   