You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 5.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. # Summarization
  2. ## Extractive Summarization
  3. ### Models
  4. FastNLP中实现的模型包括:
  5. 1. Get To The Point: Summarization with Pointer-Generator Networks (See et al. 2017)
  6. 2. Searching for Effective Neural Extractive Summarization What Works and What's Next (Zhong et al. 2019)
  7. 3. Fine-tune BERT for Extractive Summarization (Liu et al. 2019)
  8. ### Dataset
  9. 这里提供的摘要任务数据集包括:
  10. - CNN/DailyMail ([Get To The Point: Summarization with Pointer-Generator Networks](http://arxiv.org/abs/1704.04368))
  11. - Newsroom
  12. - The New York Times Annotated Corpus
  13. - NYT
  14. - NYT50
  15. - DUC
  16. - 2002 Task4
  17. - 2003/2004 Task1
  18. - arXiv
  19. - PubMed
  20. 其中公开数据集(CNN/DailyMail, Newsroom, arXiv, PubMed)预处理之后的下载地址:
  21. - [百度云盘](https://pan.baidu.com/s/11qWnDjK9lb33mFZ9vuYlzA) (提取码:h1px)
  22. - [Google Drive](https://drive.google.com/file/d/1uzeSdcLk5ilHaUTeJRNrf-_j59CQGe6r/view?usp=drivesdk)
  23. 未公开数据集(NYT, NYT50, DUC)数据处理部分脚本放置于data文件夹
  24. ### Evaluation
  25. #### FastRougeMetric
  26. FastRougeMetric使用python实现的ROUGE非官方库来实现在训练过程中快速计算rouge近似值。
  27. 源代码可见 [https://github.com/pltrdy/rouge](https://github.com/pltrdy/rouge)
  28. 在fastNLP中,该方法已经被包装成Metric.py中的FastRougeMetric类以供trainer直接使用。
  29. 需要事先使用pip安装该rouge库。
  30. pip install rouge
  31. **注意:由于实现细节的差异,该结果和官方ROUGE结果存在1-2个点的差异,仅可作为训练过程优化趋势的粗略估计。**
  32. #### PyRougeMetric
  33. PyRougeMetric 使用论文 [*ROUGE: A Package for Automatic Evaluation of Summaries*](https://www.aclweb.org/anthology/W04-1013) 提供的官方ROUGE 1.5.5评测库。
  34. 由于原本的ROUGE使用perl解释器,[pyrouge](https://github.com/bheinzerling/pyrouge)对其进行了python包装,而PyRougeMetric将其进一步包装为trainer可以直接使用的Metric类。
  35. 为了使用ROUGE 1.5.5,需要使用sudo权限安装一系列依赖库。
  36. 1. ROUGE 本身在Ubuntu下的安装可以参考[博客](https://blog.csdn.net/Hay54/article/details/78744912)
  37. 2. 配置wordnet可参考:
  38. ```shell
  39. $ cd ~/rouge/RELEASE-1.5.5/data/WordNet-2.0-Exceptions/
  40. $ ./buildExeptionDB.pl . exc WordNet-2.0.exc.db
  41. $ cd ../
  42. $ ln -s WordNet-2.0-Exceptions/WordNet-2.0.exc.db WordNet-2.0.exc.db
  43. ```
  44. 3. 安装pyrouge
  45. ```shell
  46. $ git clone https://github.com/bheinzerling/pyrouge
  47. $ cd pyrouge
  48. $ python setup.py install
  49. ```
  50. 4. 测试ROUGE安装是否正确
  51. ```shell
  52. $ pyrouge_set_rouge_path /absolute/path/to/ROUGE-1.5.5/directory
  53. $ python -m pyrouge.test
  54. ```
  55. ### Dataset_loader
  56. - SummarizationLoader: 用于读取处理好的jsonl格式数据集,返回以下field
  57. - text: 文章正文
  58. - summary: 摘要
  59. - domain: 可选,文章发布网站
  60. - tag: 可选,文章内容标签
  61. - labels: 抽取式句子标签
  62. - BertSumLoader:用于读取作为 BertSum(Liu 2019) 输入的数据集,返回以下 field:
  63. - article:每篇文章被截断为 512 后的词表 ID
  64. - segmet_id:每句话属于 0/1 的 segment
  65. - cls_id:输入中 ‘[CLS]’ 的位置
  66. - label:抽取式句子标签
  67. ### Train Cmdline
  68. #### Baseline
  69. LSTM + Sequence Labeling
  70. python train.py --cuda --gpu <gpuid> --sentence_encoder deeplstm --sentence_decoder SeqLab --save_root <savedir> --log_root <logdir> --lr_descent --grad_clip --max_grad_norm 10
  71. Transformer + Sequence Labeling
  72. python train.py --cuda --gpu <gpuid> --sentence_encoder transformer --sentence_decoder SeqLab --save_root <savedir> --log_root <logdir> --lr_descent --grad_clip --max_grad_norm 10
  73. #### BertSum
  74. ### Performance and Hyperparameters
  75. | Model | ROUGE-1 | ROUGE-2 | ROUGE-L | Paper |
  76. | :-----------------------------: | :-----: | :-----: | :-----: | :-----------------------------------------: |
  77. | LEAD 3 | 40.11 | 17.64 | 36.32 | our data pre-process |
  78. | ORACLE | 55.24 | 31.14 | 50.96 | our data pre-process |
  79. | LSTM + Sequence Labeling | 40.72 | 18.27 | 36.98 | |
  80. | Transformer + Sequence Labeling | 40.86 | 18.38 | 37.18 | |
  81. | LSTM + Pointer Network | - | - | - | |
  82. | Transformer + Pointer Network | - | - | - | |
  83. | BERTSUM | 42.71 | 19.76 | 39.03 | Fine-tune BERT for Extractive Summarization |
  84. | LSTM+PN+BERT+RL | - | - | - | |
  85. ## Abstractive Summarization
  86. Still in Progress...