"docs/vscode:/vscode.git/clone" did not exist on "1c122a46dc3c4448901f8d2f3018d9d58b846ba5"
Unverified Commit d9efb36c authored by Nicolas Patry's avatar Nicolas Patry Committed by GitHub
Browse files

Adding doctest for `text-classification` pipeline. (#20262)

* Adding doctest for `text-classification` pipeline.

* Remove nested_simplify.
parent c282e93a
...@@ -50,6 +50,21 @@ class TextClassificationPipeline(Pipeline): ...@@ -50,6 +50,21 @@ class TextClassificationPipeline(Pipeline):
Text classification pipeline using any `ModelForSequenceClassification`. See the [sequence classification Text classification pipeline using any `ModelForSequenceClassification`. See the [sequence classification
examples](../task_summary#sequence-classification) for more information. examples](../task_summary#sequence-classification) for more information.
Example:
```python
>>> from transformers import pipeline
>>> classifier = pipeline(model="distilbert-base-uncased-finetuned-sst-2-english")
>>> classifier("This movie is disgustingly good !")
[{'label': 'POSITIVE', 'score': 1.0}]
>>> classifier("Director tried too much.")
[{'label': 'NEGATIVE', 'score': 0.996}]
```
[Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial)
This text classification pipeline can currently be loaded from [`pipeline`] using the following task identifier: This text classification pipeline can currently be loaded from [`pipeline`] using the following task identifier:
`"sentiment-analysis"` (for classifying sequences according to positive or negative sentiments). `"sentiment-analysis"` (for classifying sequences according to positive or negative sentiments).
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment