Andrew0488 commited on
Commit
47175ce
·
verified ·
1 Parent(s): 96d5b66

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +19 -8
README.md CHANGED
@@ -1,8 +1,19 @@
1
- ---
2
- datasets:
3
- - gopalkalpande/bbc-news-summary
4
- language:
5
- - en
6
- library_name: transformers
7
- pipeline_tag: summarization
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)