Ayham commited on
Commit
bd7a32f
1 Parent(s): 293e981

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +16 -1
README.md CHANGED
@@ -27,7 +27,22 @@ RougeL= 23.499
27
 
28
  More information needed
29
 
30
- ## Training and evaluation data
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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