Andrew0488
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -1,8 +1,19 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
This model bases on T5-base model, finetuned using bbc-news-summary dataset
|
2 |
+
Example of using:
|
3 |
+
|
4 |
+
def t5_summary(text: str):
|
5 |
+
inputs = tokenizer.encode(
|
6 |
+
"summarize: " + text,
|
7 |
+
return_tensors='pt',
|
8 |
+
max_length=2000,
|
9 |
+
truncation=True,
|
10 |
+
padding='max_length'
|
11 |
+
).to(torch.device("cuda"))
|
12 |
+
|
13 |
+
# Generate the summary
|
14 |
+
summary_ids = model.generate(
|
15 |
+
inputs,
|
16 |
+
max_length=250,
|
17 |
+
num_beams=5
|
18 |
+
)
|
19 |
+
return tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|