-
Notifications
You must be signed in to change notification settings - Fork 25.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doc pipelines #6175
Merged
Merged
Doc pipelines #6175
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
894e829
Init work on pipelines doc
sgugger fc9c08a
Work in progress
sgugger cfd9b5d
Work in progress
sgugger 4c32314
Doc pipelines
sgugger 5c30600
Rm unwanted default
sgugger 1ec7448
Apply suggestions from code review
sgugger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
Utilities for pipelines | ||
----------------------- | ||
|
||
This page lists all the utility functions the library provides for pipelines. | ||
|
||
Most of those are only useful if you are studying the code of the models in the library. | ||
|
||
|
||
Argument handling | ||
~~~~~~~~~~~~~~~~~ | ||
|
||
.. autoclass:: transformers.pipelines.ArgumentHandler | ||
|
||
.. autoclass:: transformers.pipelines.ZeroShotClassificationArgumentHandler | ||
|
||
.. autoclass:: transformers.pipelines.QuestionAnsweringArgumentHandler | ||
|
||
|
||
Data format | ||
~~~~~~~~~~~ | ||
|
||
.. autoclass:: transformers.pipelines.PipelineDataFormat | ||
:members: | ||
|
||
.. autoclass:: transformers.pipelines.CsvPipelineDataFormat | ||
:members: | ||
|
||
.. autoclass:: transformers.pipelines.JsonPipelineDataFormat | ||
:members: | ||
|
||
.. autoclass:: transformers.pipelines.PipedPipelineDataFormat | ||
:members: | ||
|
||
|
||
Utilities | ||
~~~~~~~~~ | ||
|
||
.. autofunction:: transformers.pipelines.get_framework | ||
|
||
.. autoclass:: transformers.pipelines.PipelineException |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,23 @@ 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. | ||
Recognition, Masked Language Modeling, Sentiment Analysis, Feature Extraction and Question Answering. See the | ||
:doc:`task summary <../task_summary>` for examples of use. | ||
|
||
There are two categories of pipeline abstractions to be aware about: | ||
|
||
- The :func:`~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 :func:`~transformers.pipeline` which is the most powerful object encapsulating all other pipelines. | ||
- The other task-specific pipelines: | ||
|
||
- :class:`~transformers.ConversationalPipeline` | ||
- :class:`~transformers.FeatureExtractionPipeline` | ||
- :class:`~transformers.FillMaskPipeline` | ||
- :class:`~transformers.QuestionAnsweringPipeline` | ||
- :class:`~transformers.SummarizationPipeline` | ||
- :class:`~transformers.TextClassificationPipeline` | ||
- :class:`~transformers.TextGenerationPipeline` | ||
- :class:`~transformers.TokenClassificationPipeline` | ||
- :class:`~transformers.TranslationPipeline` | ||
|
||
The pipeline abstraction | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
@@ -21,61 +31,75 @@ other pipeline but requires an additional argument which is the `task`. | |
|
||
|
||
The task specific pipelines | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Parent class: Pipeline | ||
========================================= | ||
|
||
.. autoclass:: transformers.Pipeline | ||
:members: predict, transform, save_pretrained | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
TokenClassificationPipeline | ||
ConversationalPipeline | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a reorderin by alphabetical order and put the main Pipeline class at the end since it's more abstract. |
||
========================================== | ||
|
||
.. autoclass:: transformers.TokenClassificationPipeline | ||
.. autoclass:: transformers.Conversation | ||
|
||
NerPipeline | ||
.. autoclass:: transformers.ConversationalPipeline | ||
:special-members: __call__ | ||
:members: | ||
|
||
FeatureExtractionPipeline | ||
========================================== | ||
|
||
This class is an alias of the :class:`~transformers.TokenClassificationPipeline` defined above. Please refer to that pipeline for | ||
documentation and usage examples. | ||
.. autoclass:: transformers.FeatureExtractionPipeline | ||
:special-members: __call__ | ||
:members: | ||
|
||
FillMaskPipeline | ||
========================================== | ||
|
||
.. autoclass:: transformers.FillMaskPipeline | ||
:special-members: __call__ | ||
:members: | ||
|
||
FeatureExtractionPipeline | ||
========================================== | ||
|
||
.. autoclass:: transformers.FeatureExtractionPipeline | ||
|
||
TextClassificationPipeline | ||
NerPipeline | ||
========================================== | ||
|
||
.. autoclass:: transformers.TextClassificationPipeline | ||
This class is an alias of the :class:`~transformers.TokenClassificationPipeline` defined below. Please refer to that | ||
pipeline for documentation and usage examples. | ||
|
||
QuestionAnsweringPipeline | ||
========================================== | ||
|
||
.. autoclass:: transformers.QuestionAnsweringPipeline | ||
|
||
:special-members: __call__ | ||
:members: | ||
|
||
SummarizationPipeline | ||
========================================== | ||
|
||
.. autoclass:: transformers.SummarizationPipeline | ||
:special-members: __call__ | ||
:members: | ||
|
||
TextClassificationPipeline | ||
========================================== | ||
|
||
.. autoclass:: transformers.TextClassificationPipeline | ||
:special-members: __call__ | ||
:members: | ||
|
||
TextGenerationPipeline | ||
========================================== | ||
|
||
.. autoclass:: transformers.TextGenerationPipeline | ||
:special-members: __call__ | ||
:members: | ||
|
||
|
||
ConversationalPipeline | ||
TokenClassificationPipeline | ||
========================================== | ||
|
||
.. autoclass:: transformers.Conversation | ||
.. autoclass:: transformers.TokenClassificationPipeline | ||
:special-members: __call__ | ||
:members: | ||
|
||
|
||
.. autoclass:: transformers.ConversationalPipeline | ||
Parent class: :obj:`Pipeline` | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. autoclass:: transformers.Pipeline | ||
:members: |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be my next PR doc, but I needed the anchor to make a link in several docstrings of Pipeline subclasses.