
    <h                     l    S SK JrJr  SSKJr  SSKJrJrJr  \" \" SSS9S	5       " S
 S\5      5       r	g)    )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            	          ^  \ rS rSrSrSrSrSrSrSS jr	S\
\\4   4S jrS rSS	 jrS
\\\\   4   S\S\\\\   4   4U 4S jjrSrU =r$ )FeatureExtractionPipeline   a  
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                 \    Uc  0 nUb  SU;   a  [        S5      eXS'   Un0 nUb  X6S'   U0 U4$ )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          a/var/www/html/shao/venv/lib/python3.13/site-packages/transformers/pipelines/feature_extraction.py_sanitize_parameters.FeatureExtractionPipeline._sanitize_parameters-   s^    " O!. r  -7L)+%3A/0 "&888    returnc                 D    U R                   " U4SU R                  0UD6nU$ )Nr   )	tokenizer	framework)r   inputsr   model_inputss       r   
preprocess$FeatureExtractionPipeline.preprocess@   s$    ~~f_T^^__r   c                 *    U R                   " S0 UD6nU$ )N )model)r   r"   model_outputss      r   _forward"FeatureExtractionPipeline._forwardD   s    

2\2r   c                     U(       a  US   $ U R                   S:X  a  US   R                  5       $ U R                   S:X  a!  US   R                  5       R                  5       $ g )Nr   pttf)r    tolistnumpy)r   r(   r   s      r   postprocess%FeatureExtractionPipeline.postprocessH   s^     ##>>T! #**,,^^t# #))+2244 $r   argsr   c                 $   > [         TU ]  " U0 UD6$ )z
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   r2   r   	__class__s      r   r5   "FeatureExtractionPipeline.__call__Q   s     w000r   r&   )NNN)F)__name__
__module____qualname____firstlineno____doc___load_processor_load_image_processor_load_feature_extractor_load_tokenizerr   dictstrr   r#   r)   r0   r   listr   r5   __static_attributes____classcell__)r6   s   @r   r   r      s    0 O!#O9&tC<N7O 5
1eCcN3 
1s 
1uSRVWZR[^G\ 
1 
1r   r   N)
typingr   r   utilsr   baser   r	   r
   r   r&   r   r   <module>rI      sD     & C C 4NkL1 L1L1r   