Rephrasing the link. (#20253)

* Rephrasing the link.

* Removing `nested_simplify` within doctests.

* Fixup.
This commit is contained in:
Nicolas Patry 2022-11-16 17:09:45 +01:00 committed by GitHub
parent e9d9982e7c
commit a239bdd28f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 9 additions and 18 deletions

View File

@ -77,16 +77,11 @@ class AudioClassificationPipeline(Pipeline):
>>> from transformers import pipeline
>>> classifier = pipeline(model="superb/wav2vec2-base-superb-ks")
>>> result = classifier("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/1.flac")
>>> # Simplify results, different torch versions might alter the scores slightly.
>>> from transformers.testing_utils import nested_simplify
>>> nested_simplify(result)
>>> classifier("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/1.flac")
[{'score': 0.997, 'label': '_unknown_'}, {'score': 0.002, 'label': 'left'}, {'score': 0.0, 'label': 'yes'}, {'score': 0.0, 'label': 'down'}, {'score': 0.0, 'label': 'stop'}]
```
[Using pipelines in a webserver or with a dataset](../pipeline_tutorial)
[Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial)
This pipeline can currently be loaded from [`pipeline`] using the following task identifier:

View File

@ -118,7 +118,7 @@ class AutomaticSpeechRecognitionPipeline(ChunkPipeline):
{'text': ' He hoped there would be stew for dinner, turnips and carrots and bruised potatoes and fat mutton pieces to be ladled out in thick, peppered flour fat and sauce.'}
```
[Using pipelines in a webserver or with a dataset](../pipeline_tutorial)
[Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial)
Arguments:
model ([`PreTrainedModel`] or [`TFPreTrainedModel`]):

View File

@ -181,7 +181,7 @@ class ConversationalPipeline(Pipeline):
"It's a comedy."
```
[Using pipelines in a webserver or with a dataset](../pipeline_tutorial)
[Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial)
This conversational pipeline can currently be loaded from [`pipeline`] using the following task identifier:
`"conversational"`.

View File

@ -36,7 +36,7 @@ class DepthEstimationPipeline(Pipeline):
torch.Size([1, 384, 384])
```
[Using pipelines in a webserver or with a dataset](../pipeline_tutorial)
[Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial)
This depth estimation pipeline can currently be loaded from [`pipeline`] using the following task identifier:

View File

@ -120,7 +120,7 @@ class DocumentQuestionAnsweringPipeline(ChunkPipeline):
'1110212019'
```
[Using pipelines in a webserver or with a dataset](../pipeline_tutorial)
[Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial)
This document question answering pipeline can currently be loaded from [`pipeline`] using the following task
identifier: `"document-question-answering"`.

View File

@ -20,7 +20,7 @@ class FeatureExtractionPipeline(Pipeline):
torch.Size([1, 8, 768])
```
[Using pipelines in a webserver or with a dataset](../pipeline_tutorial)
[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"`.

View File

@ -42,15 +42,11 @@ class FillMaskPipeline(Pipeline):
>>> from transformers import pipeline
>>> fill_masker = pipeline(model="bert-base-uncased")
>>> potential_words = fill_masker("This is a simple [MASK].")
>>> from transformers.testing_utils import nested_simplify
>>> nested_simplify(potential_words) # The scores might vary slightly across pytorch/tensorflow versions.
>>> fill_masker("This is a simple [MASK].")
[{'score': 0.042, 'token': 3291, 'token_str': 'problem', 'sequence': 'this is a simple problem.'}, {'score': 0.031, 'token': 3160, 'token_str': 'question', 'sequence': 'this is a simple question.'}, {'score': 0.03, 'token': 8522, 'token_str': 'equation', 'sequence': 'this is a simple equation.'}, {'score': 0.027, 'token': 2028, 'token_str': 'one', 'sequence': 'this is a simple one.'}, {'score': 0.024, 'token': 3627, 'token_str': 'rule', 'sequence': 'this is a simple rule.'}]
```
[Using pipelines in a webserver or with a dataset](../pipeline_tutorial)
[Learn more about the basics of using a pipeline in the [pipeline tutorial]](../pipeline_tutorial)
This mask filling pipeline can currently be loaded from [`pipeline`] using the following task identifier:
`"fill-mask"`.