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
b98ff885
"docs/vscode:/vscode.git/clone" did not exist on "c71dadbaff635dbf743bc2acbc812471d0c7c406"
Commit
b98ff885
authored
Dec 20, 2019
by
Morgan Funtowicz
Browse files
Added pipelines quick tour in README
parent
3a2c4e6f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
README.md
README.md
+29
-0
No files found.
README.md
View file @
b98ff885
...
@@ -490,6 +490,35 @@ transformers-cli ls
...
@@ -490,6 +490,35 @@ transformers-cli ls
# List all your S3 objects.
# List all your S3 objects.
```
```
## Quick tour of pipelines
New in version
`v2.3`
:
`Pipeline`
are high-level objects which automatically handle tokenization, running your data through a transformers model
and outputting the result in a structured object.
You can create
`Pipeline`
objects for the following down-stream tasks:
-
`feature-extraction`
: Generates a tensor representation for the input sequence
-
`ner`
: Generates named entity mapping for each word in the input sequence.
-
`sentiment-analysis`
: Gives the polarity (positive / negative) of the whole input sequence.
-
`question-answering`
: Provided some context and a question refering to the context, it will extract the answer to the question
in the context.
```
python
from
transformers
import
pipeline
# Allocate a pipeline for sentiment-analysis
nlp
=
pipeline
(
'sentiment-analysis'
)
nlp
(
'We are very happy to include pipeline into the transformers repository.'
)
>>>
{
'label'
:
'POSITIVE'
,
'score'
:
0.99893874
}
# Allocate a pipeline for question-answering
nlp
=
pipeline
(
'question-answering'
)
nlp
({
'question'
:
'What is the name of the repository ?'
,
'context'
:
'Pipeline have been included in the huggingface/transformers repository'
})
>>>
{
'score'
:
0.28756016668193496
,
'start'
:
35
,
'end'
:
59
,
'answer'
:
'huggingface/transformers'
}
```
## Migrating from pytorch-transformers to transformers
## Migrating from pytorch-transformers to transformers
Here is a quick summary of what you should take care of when migrating from
`pytorch-transformers`
to
`transformers`
.
Here is a quick summary of what you should take care of when migrating from
`pytorch-transformers`
to
`transformers`
.
...
...
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