mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-07 14:50:07 +06:00

* [hf_api] Attach all unknown attributes for future-proof compatibility * [Pipeline] NerPipeline is really a TokenClassificationPipeline * modelcard.py: I don't think we need to force the download * Remove config, tokenizer from SUPPORTED_TASKS as we're moving to one model = one weight + one tokenizer * FillMaskPipeline: also output token in string form * TextClassificationPipeline: option to return all scores, not just the argmax * Update docs/source/main_classes/pipelines.rst
75 lines
2.3 KiB
ReStructuredText
75 lines
2.3 KiB
ReStructuredText
Pipelines
|
|
----------------------------------------------------
|
|
|
|
The pipelines are a great and easy way to use models for inference. These pipelines are objects that abstract most
|
|
of the complex code from the library, offering a simple API dedicated to several tasks, including Named Entity
|
|
Recognition, Masked Language Modeling, Sentiment Analysis, Feature Extraction and Question Answering.
|
|
|
|
There are two categories of pipeline abstractions to be aware about:
|
|
|
|
- The :class:`~transformers.pipeline` which is the most powerful object encapsulating all other pipelines
|
|
- The other task-specific pipelines, such as :class:`~transformers.TokenClassificationPipeline`
|
|
or :class:`~transformers.QuestionAnsweringPipeline`
|
|
|
|
The pipeline abstraction
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
The `pipeline` abstraction is a wrapper around all the other available pipelines. It is instantiated as any
|
|
other pipeline but requires an additional argument which is the `task`.
|
|
|
|
.. autoclass:: transformers.pipeline
|
|
:members:
|
|
|
|
|
|
The task specific pipelines
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Parent class: Pipeline
|
|
=========================================
|
|
|
|
.. autoclass:: transformers.Pipeline
|
|
:members: predict, transform, save_pretrained
|
|
|
|
TokenClassificationPipeline
|
|
==========================================
|
|
|
|
.. autoclass:: transformers.TokenClassificationPipeline
|
|
|
|
NerPipeline
|
|
==========================================
|
|
|
|
This class is an alias of the :class:`~transformers.TokenClassificationPipeline` defined above. Please refer to that pipeline for
|
|
documentation and usage examples.
|
|
|
|
FillMaskPipeline
|
|
==========================================
|
|
|
|
.. autoclass:: transformers.FillMaskPipeline
|
|
|
|
FeatureExtractionPipeline
|
|
==========================================
|
|
|
|
.. autoclass:: transformers.FeatureExtractionPipeline
|
|
|
|
TextClassificationPipeline
|
|
==========================================
|
|
|
|
.. autoclass:: transformers.TextClassificationPipeline
|
|
|
|
QuestionAnsweringPipeline
|
|
==========================================
|
|
|
|
.. autoclass:: transformers.QuestionAnsweringPipeline
|
|
|
|
|
|
SummarizationPipeline
|
|
==========================================
|
|
|
|
.. autoclass:: transformers.SummarizationPipeline
|
|
|
|
|
|
TextGenerationPipeline
|
|
==========================================
|
|
|
|
.. autoclass:: transformers.TextGenerationPipeline
|