Ë
    îÍ:jì  ã                   ór   — d dl mZ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)é    )ÚAnyÚUnioné   )Ú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            	       óŒ   ‡ — e Zd ZdZdZdZdZdZdd„Zde	e
ef   fd„Zd„ Zdd„Zd	ee
ee
   f   d
edeeee   f   fˆ 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).
    FTc                 ó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          ú~/home/mcse/projects/srt_converter/srt-converter-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._forwardD   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.postprocessH   s^   € áØ  Ñ#Ð#Ø�>‰>˜TÒ!Ø  Ñ#×*Ñ*Ó,Ð,Ø�^‰^˜tÒ#Ø  Ñ#×)Ñ)Ó+×2Ñ2Ó4Ð4ð $r   Úargsr   c                 ó"   •— t        ‰| �  |i |¤ŽS )a  
        Extract the features of the input(s) text.

        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   r-   r   Ú	__class__s      €r   r0   z"FeatureExtractionPipeline.__call__Q   s   ø€ ô ‰wÑ Ð0¨Ñ0Ð0r   )NNN)F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú_load_processorÚ_load_image_processorÚ_load_feature_extractorÚ_load_tokenizerr   ÚdictÚstrr   r!   r&   r,   r   Úlistr   r0   Ú__classcell__)r1   s   @r   r   r      s�   ø„ ñð0 €OØ!ÐØ#ÐØ€Oó9ð&°t¸CÀÐ<NÑ7Oó òó5ð
1˜e C¨¨c© NÑ3ð 
1¸sð 
1ÀuÈSÐRVÐWZÑR[È^ÑG\÷ 
1ñ 
1r   r   N)
Útypingr   r   Úutilsr   Úbaser   r	   r
   r   r#   r   r   ú<module>rA      sD   ðß å &ß CÑ Cñ Ù¨4ÈÔNðkóôL1 ó L1óñL1r   