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
5cd9e2cb
Unverified
Commit
5cd9e2cb
authored
Oct 21, 2020
by
Patrick von Platen
Committed by
GitHub
Oct 21, 2020
Browse files
Update README.md
parent
220b5f97
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
model_cards/microsoft/xprophetnet-large-wiki100-cased-xglue-ntg/README.md
...osoft/xprophetnet-large-wiki100-cased-xglue-ntg/README.md
+7
-2
No files found.
model_cards/microsoft/xprophetnet-large-wiki100-cased-xglue-ntg/README.md
View file @
5cd9e2cb
...
...
@@ -8,7 +8,7 @@ For xGLUE corss-lingual NLG tasks, xProphetNet is finetuned with English data, b
### Usage
A quick usage is like:
```
from
transformers
import
ProphetNetTokenizer
,
ProphetNetForConditionalGeneration
,
ProphetNetConfig
from
transformers
import
XLM
ProphetNetTokenizer
,
XLM
ProphetNetForConditionalGeneration
,
ProphetNetConfig
model
=
ProphetNetForConditionalGeneration
.
from_pretrained
(
'microsoft/xprophetnet-large-wiki100-cased-xglue-ntg'
)
tokenizer
=
ProphetNetTokenizer
.
from_pretrained
(
'microsoft/xprophetnet-large-wiki100-cased-xglue-ntg'
)
...
...
@@ -19,7 +19,12 @@ ZH_SENTENCE = "根据该组织的官方门户网站,微软公司打算在2020
inputs
=
tokenizer
([
EN_SENTENCE
,
RU_SENTENCE
,
ZH_SENTENCE
],
padding
=
True
,
max_length
=
256
,
return_tensors
=
'pt'
)
summary_ids
=
model
.
generate
(
inputs
[
'input_ids'
],
num_beams
=
4
,
max_length
=
100
,
early_stopping
=
True
)
print
([
tokenizer
.
decode
(
g
)
for
g
in
summary_ids
])
tokenizer
.
batch_decode
(
summary_ids
,
skip_special_tokens
=
True
)
#
should
give
:
#
'Microsoft to end Windows 7 free support after January 14, 2020'
#
'Microsoft намерена прекратить бесплатную поддержку Windows 7 после 14 января 2020 года'
#
'微软终止对Windows 7操作系统的免费支持'
```
### Citation
```
bibtex
...
...
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