tuner007 commited on
Commit
e36f32d
1 Parent(s): fc3239a

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +41 -0
README.md ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ license: apache-2.0
4
+ tags:
5
+ - pegasus
6
+ - seq2seq
7
+ - summarization
8
+ ---
9
+
10
+ ## Model description
11
+ [PEGASUS](https://github.com/google-research/pegasus) fine-tuned for summarization
12
+
13
+ ## Model in Action 🚀
14
+ ```
15
+ import torch
16
+ from transformers import PegasusForConditionalGeneration, PegasusTokenizer
17
+ model_name = 'tuner007/pegasus_summarizer'
18
+ torch_device = 'cuda' if torch.cuda.is_available() else 'cpu'
19
+ tokenizer = PegasusTokenizer.from_pretrained(model_name)
20
+ model = PegasusForConditionalGeneration.from_pretrained(model_name).to(torch_device)
21
+
22
+ def get_response(input_text):
23
+ batch = tokenizer([input_text],truncation=True,padding='longest',max_length=1024, return_tensors="pt").to(torch_device)
24
+ gen_out = model.generate(**batch,max_length=128,num_beams=4, num_return_sequences=1, temperature=1.5)
25
+ output_text = tokenizer.batch_decode(gen_out, skip_special_tokens=True)
26
+ return output_text
27
+ ```
28
+ #### Example:
29
+ context = """"
30
+ Actor John Abraham and a clutch of venture capital (VC) funds have invested Rs 4 crore in NOTO, the low-calorie and high-protein icecream brand said on Tuesday.The VC funds, who have invested alongside the actor in the pre-Series A round, include Titan Capital, Rockstud Capital, and WEH Ventures, an official statement said adding that some angel investors also participated.Founded by the couple Varun and Ashni Sheth in 2018, the brand will invest the money raised in geographical expansion, product development and hiring talent, the statement said."After our investment in sport, Priya (wife) and I are identifying health and fitness businesses that have growth potential as well as which align with our lifestyle, and NOTO is one such business."We see NOTO as the leading healthy ice cream in the industry with strong promoters and on-point branding," Abraham said.
31
+ """
32
+
33
+ ```
34
+ get_response(context)
35
+ ```
36
+ #### Output:
37
+ Actor John Abraham and a clutch of venture capital (VC) funds have invested 4 crore in NOTO, the low-calorie and high-protein ice cream brand. The VC funds, who have invested alongside the actor in the pre-Series A round, include Titan Capital, Rockstud Capital, and WEH Ventures. NOTO was founded by Varun Sheth and Ashni Sheth in 2018.
38
+
39
+
40
+ > Created by [Arpit Rajauria](https://twitter.com/arpit_rajauria)
41
+ [![Twitter icon](https://cdn0.iconfinder.com/data/icons/shift-logotypes/32/Twitter-32.png)](https://twitter.com/arpit_rajauria)