Atharvgarg
commited on
Commit
•
ea3bcd4
1
Parent(s):
cdea37e
Update README.md
Browse files
README.md
CHANGED
@@ -36,25 +36,6 @@ It achieves the following results on the evaluation set:
|
|
36 |
- Rougel: 21.1788
|
37 |
- Rougelsum: 35.314
|
38 |
|
39 |
-
'''
|
40 |
-
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
41 |
-
tokenizer = BertTokenizerFast.from_pretrained('Atharvgarg/bert-small2bert-small-finetuned-cnn_daily_mail-summarization-finetuned-multi-news')
|
42 |
-
model = EncoderDecoderModel.from_pretrained('Atharvgarg/bert-small2bert-small-finetuned-cnn_daily_mail-summarization-finetuned-multi-news').to(device)
|
43 |
-
|
44 |
-
def generate_summary(text):
|
45 |
-
# This Bert model is limited to max_length at 512
|
46 |
-
inputs = tokenizer([text], padding="max_length", truncation=True, max_length=512, return_tensors="pt")
|
47 |
-
input_ids = inputs.input_ids.to(device)
|
48 |
-
attention_mask = inputs.attention_mask.to(device)
|
49 |
-
|
50 |
-
output = model.generate(input_ids, attention_mask=attention_mask)
|
51 |
-
|
52 |
-
return tokenizer.decode(output[0], skip_special_tokens=True)
|
53 |
-
|
54 |
-
file = open("/content/drive/MyDrive/Nlp/BBC News Summary Dataset/BBC News Summary/News Articles/business/001.txt", "r")
|
55 |
-
text = file.read()
|
56 |
-
generate_summary(text)
|
57 |
-
'''
|
58 |
## Model description
|
59 |
|
60 |
More information needed
|
|
|
36 |
- Rougel: 21.1788
|
37 |
- Rougelsum: 35.314
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
## Model description
|
40 |
|
41 |
More information needed
|