dongxiaoqun commited on
Commit
4970603
1 Parent(s): 92c30e0

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +50 -0
README.md ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: zh
3
+ tags:
4
+ - summarization
5
+ inference: False
6
+ ---
7
+
8
+ IDEA-CCNL/Randeng_Pegasus_238M_Summary_Chinese model (Chinese) has 238M million parameter, pretrained on 180G Chinese data with GSG task which is stochastically sample important sentences with sampled gap sentence ratios by 25%. The pretraining task just as same as the paper PEGASUS: Pre-training with Extracted Gap-sentences for Abstractive Summarization mentioned.
9
+
10
+ Different from the English version of pegasus, considering that the Chinese sentence piece is unstable, we use jieba and Bertokenizer as the tokenizer in chinese pegasus model.
11
+
12
+ After pre-training, We use 8 summary datasets which we collect on the internet to do the supervised training. The 8 datasets include education_data, new2016zh_data, nlpcc, shence_data, sohu_data, thucnews_data and weibo_data, four million training samples in all.
13
+
14
+
15
+ Task: Summarization
16
+ ## Usage
17
+ ```python
18
+
19
+ from transformers import PegasusForConditionalGeneration
20
+ # Need to download tokenizers_pegasus.py and other Python script from Fengshenbang-LM github repo in advance,
21
+ # or you can download tokenizers_pegasus.py and data_utils.py in https://huggingface.co/IDEA-CCNL/Randeng_Pegasus_523M/tree/main
22
+ # Strongly recommend you git clone the Fengshenbang-LM repo:
23
+ # 1. git clone https://github.com/IDEA-CCNL/Fengshenbang-LM
24
+ # 2. cd Fengshenbang-LM/fengshen/examples/pegasus/
25
+ # and then you will see the tokenizers_pegasus.py and data_utils.py which are needed by pegasus model
26
+ from tokenizers_pegasus import PegasusTokenizer
27
+
28
+ model = PegasusForConditionalGeneration.from_pretrained("IDEA-CCNL/Randeng-Pegasus-238M-Summary-Chinese")
29
+ tokenizer = PegasusTokenizer.from_pretrained("IDEA-CCNL/Randeng-Pegasus-238M-Summary-Chinese")
30
+
31
+ text = "在北京冬奥会自由式滑雪女子坡面障碍技巧决赛中,中国选手谷爱凌夺得银牌。祝贺谷爱凌!今天上午,自由式滑雪女子坡面障碍技巧决赛举行。决赛分三轮进行,取选手最佳成绩排名决出奖牌。第一跳,中国选手谷爱凌获得69.90分。在12位选手中排名第三。完成动作后,谷爱凌又扮了个鬼脸,甚是可爱。第二轮中,谷爱凌在道具区第三个障碍处失误,落地时摔倒。获得16.98分。网友:摔倒了也没关系,继续加油!在第二跳失误摔倒的情况下,谷爱凌顶住压力,第三跳稳稳发挥,流畅落地!获得86.23分!此轮比赛,共12位选手参赛,谷爱凌第10位出场。网友:看比赛时我比谷爱凌紧张,加油!"
32
+ inputs = tokenizer(text, max_length=1024, return_tensors="pt")
33
+
34
+ # Generate Summary
35
+ summary_ids = model.generate(inputs["input_ids"])
36
+ tokenizer.batch_decode(summary_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
37
+
38
+ # model Output: 滑雪女子坡面障碍技巧决赛:中国选手谷爱凌摘银
39
+ ```
40
+
41
+ ## Citation
42
+ If you find the resource is useful, please cite the following website in your paper.
43
+ ```
44
+ @misc{Fengshenbang-LM,
45
+ title={Fengshenbang-LM},
46
+ author={IDEA-CCNL},
47
+ year={2022},
48
+ howpublished={\url{https://github.com/IDEA-CCNL/Fengshenbang-LM}},
49
+ }
50
+ ```