Ë
    T^(h.  ã                   ón   — d dl mZ ddlmZ ddlmZmZmZ  e edd¬«      d	«       G d
„ de«      «       Zy)é    )ÚDicté   )Úadd_end_docstringsé   )ÚGenericTensorÚPipelineÚbuild_pipeline_init_argsTF)Úhas_tokenizerÚsupports_binary_outputa  
        tokenize_kwargs (`dict`, *optional*):
                Additional dictionary of keyword arguments passed along to the tokenizer.
        return_tensors (`bool`, *optional*):
            If `True`, returns a tensor according to the specified framework, otherwise returns a list.c                   óN   ‡ — e Zd ZdZdd„Zdeeef   fd„Zd„ Z	d	d„Z
ˆ fd„Zˆ xZS )
ÚFeatureExtractionPipelineaÝ  
    Feature extraction pipeline uses no model head. This pipeline extracts the hidden states from the base
    transformer, which can be used as features in downstream tasks.

    Example:

    ```python
    >>> from transformers import pipeline

    >>> extractor = pipeline(model="google-bert/bert-base-uncased", task="feature-extraction")
    >>> result = extractor("This is a simple test.", return_tensors=True)
    >>> result.shape  # This is a tensor of shape [1, sequence_length, hidden_dimension] representing the input string.
    torch.Size([1, 8, 768])
    ```

    Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial)

    This feature extraction pipeline can currently be loaded from [`pipeline`] using the task identifier:
    `"feature-extraction"`.

    All models may be used for this pipeline. See a list of all models, including community-contributed models on
    [huggingface.co/models](https://huggingface.co/models).
    c                 óV   — |€i }|�d|v rt        d«      ‚||d<   |}i }|�||d<   |i |fS )NÚ
truncationz\truncation parameter defined twice (given as keyword argument as well as in tokenize_kwargs)Úreturn_tensors)Ú
ValueError)Úselfr   Útokenize_kwargsr   ÚkwargsÚpreprocess_paramsÚpostprocess_paramss          úg/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/pipelines/feature_extraction.pyÚ_sanitize_parametersz.FeatureExtractionPipeline._sanitize_parameters(   sc   € ØÐ"Ø ˆOàÐ!Ø˜Ñ.Ü Øróð ð -7ˆO˜LÑ)à+ÐàÐØÐ%Ø3AÐÐ/Ñ0à  "Ð&8Ð8Ð8ó    Úreturnc                 óD   —  | j                   |fd| j                  i|¤Ž}|S )Nr   )Ú	tokenizerÚ	framework)r   Úinputsr   Úmodel_inputss       r   Ú
preprocessz$FeatureExtractionPipeline.preprocess;   s&   € Ø%�t—~‘~ fÑ_¸T¿^¹^Ð_ÈÑ_ˆØÐr   c                 ó*   —  | j                   di |¤Ž}|S )N© )Úmodel)r   r   Úmodel_outputss      r   Ú_forwardz"FeatureExtractionPipeline._forward?   s   € Ø"˜Ÿ
™
Ñ2 \Ñ2ˆØÐr   c                 ó¶   — |r|d   S | j                   dk(  r|d   j                  «       S | j                   dk(  r!|d   j                  «       j                  «       S y )Nr   ÚptÚtf)r   ÚtolistÚnumpy)r   r$   r   s      r   Úpostprocessz%FeatureExtractionPipeline.postprocessC   s^   € áØ  Ñ#Ð#Ø�>‰>˜TÒ!Ø  Ñ#×*Ñ*Ó,Ð,Ø�^‰^˜tÒ#Ø  Ñ#×)Ñ)Ó+×2Ñ2Ó4Ð4ð $r   c                 ó"   •— t        ‰| �  |i |¤ŽS )a  
        Extract the features of the input(s).

        Args:
            args (`str` or `List[str]`): One or several texts (or one list of texts) to get the features of.

        Return:
            A nested list of `float`: The features computed by the model.
        )ÚsuperÚ__call__)r   Úargsr   Ú	__class__s      €r   r.   z"FeatureExtractionPipeline.__call__L   s   ø€ ô ‰wÑ Ð0¨Ñ0Ð0r   )NNN)F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Ústrr   r    r%   r+   r.   Ú__classcell__)r0   s   @r   r   r      s7   ø„ ñó09ð&°t¸CÀÐ<NÑ7Oó òó5÷
1ð 
1r   r   N)	Útypingr   Úutilsr   Úbaser   r   r	   r   r"   r   r   ú<module>r:      sD   ðÝ å &ß CÑ Cñ Ù¨4ÈÔNðkóôG1 ó G1óñG1r   