Update README.md
Browse files
README.md
CHANGED
@@ -27,7 +27,22 @@ RougeL= 23.499
|
|
27 |
|
28 |
More information needed
|
29 |
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
More information needed
|
33 |
|
|
|
27 |
|
28 |
More information needed
|
29 |
|
30 |
+
To use its API:
|
31 |
+
from transformers import BertTokenizerFast, GPT2Tokenizer, EncoderDecoderModel
|
32 |
+
|
33 |
+
model = EncoderDecoderModel.from_pretrained("Ayham/roberta_gpt2_summarization_cnn_dailymail")
|
34 |
+
# reuse tokenizer from bert2bert encoder-decoder model
|
35 |
+
input_tokenizer = BertTokenizerFast.from_pretrained('bert-base-cased')
|
36 |
+
|
37 |
+
|
38 |
+
article = """Your Input Text"""
|
39 |
+
|
40 |
+
input_ids = input_tokenizer(article, return_tensors="pt").input_ids
|
41 |
+
output_ids = model.generate(input_ids)
|
42 |
+
|
43 |
+
# we need a gpt2 tokenizer for the output word embeddings
|
44 |
+
output_tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
|
45 |
+
print(output_tokenizer.decode(output_ids[0], skip_special_tokens=True))
|
46 |
|
47 |
More information needed
|
48 |
|