Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
e842e181
Unverified
Commit
e842e181
authored
Dec 06, 2022
by
Samuel Xu
Committed by
GitHub
Dec 06, 2022
Browse files
Documentation fixes (#20607)
parent
28f3d431
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
docs/source/en/main_classes/pipelines.mdx
docs/source/en/main_classes/pipelines.mdx
+4
-4
No files found.
docs/source/en/main_classes/pipelines.mdx
View file @
e842e181
...
@@ -41,19 +41,19 @@ the hub already defines it:
...
@@ -41,19 +41,19 @@ the hub already defines it:
```python
```python
>>> pipe = pipeline(model="roberta-large-mnli")
>>> pipe = pipeline(model="roberta-large-mnli")
>>> pipe("This restaurant is awesome")
>>> pipe("This restaurant is awesome")
[{'label': '
POSITIVE
', 'score': 0.
9998743534088135
}]
[{'label': '
NEUTRAL
', 'score': 0.
7313136458396912
}]
```
```
To call a pipeline on many items, you can
either
call with a *list*.
To call a pipeline on many items, you can call
it
with a *list*.
```python
```python
>>> pipe = pipeline("text-classification")
>>> pipe = pipeline("text-classification")
>>> pipe(["This restaurant is awesome", "This restaurant is aw
e
ful"])
>>> pipe(["This restaurant is awesome", "This restaurant is awful"])
[{'label': 'POSITIVE', 'score': 0.9998743534088135},
[{'label': 'POSITIVE', 'score': 0.9998743534088135},
{'label': 'NEGATIVE', 'score': 0.9996669292449951}]
{'label': 'NEGATIVE', 'score': 0.9996669292449951}]
```
```
To iterate o
f
full datasets it is recommended to use a `dataset` directly. This means you don't need to allocate
To iterate o
ver
full datasets it is recommended to use a `dataset` directly. This means you don't need to allocate
the whole dataset at once, nor do you need to do batching yourself. This should work just as fast as custom loops on
the whole dataset at once, nor do you need to do batching yourself. This should work just as fast as custom loops on
GPU. If it doesn't don't hesitate to create an issue.
GPU. If it doesn't don't hesitate to create an issue.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment