《A Discourse-Aware Attention Model for Abstractive Summarization of Long Documents》笔记
近几年的自动摘要,是基于几百字的文章(CNN,平均文章长度656词;Daily Mail,平均文章长度693词),作者使用arXiv 和 PubMed(平均长度3000词以上),在Pointer-Generator Networks(See et al., 2017) 的基础上提出了一个适合类似科研论文这种长文档摘要的模型。
论文:https://arxiv.org/abs/1804.05685
代码:https://github.com/armancohan/long-summarization
注意到原文中两句话:
we limit the document length to 2000
We train the abstractive baselines for about 250K iterations as suggested by their authors.
代码是可以运行的,在CPU和GPU都可以。
问题是我在CPU运行了三天,还是没有结束。看了原文,作者运行了250k迭代,我3天跑了7000多迭代。远远不够了。
简单的运行,也能有结果,但是效果就那样了。
每个step需要13秒。
把训练的模型,预测几个例子,试试看结果:
(1)迭代次数
这么些迭代:model.ckpt-10560.index
(2)验证
eval:
INFO:tensorflow:Loading checkpoint logroot/pubmed-experiment/train/model.ckpt-10563
INFO:tensorflow:Restoring parameters from logroot/pubmed-experiment/train/model.ckpt-10563
INFO:tensorflow:seconds for batch: 18.60
INFO:tensorflow:loss: 4.874997
INFO:tensorflow:running_avg_loss: 4.874997
INFO:tensorflow:Found new best model with 4.875 running_avg_loss. Saving to logroot/pubmed-experiment/eval/bestmodel
INFO:tensorflow:Loading checkpoint logroot/pubmed-experiment/train/model.ckpt-10563
INFO:tensorflow:Restoring parameters from logroot/pubmed-experiment/train/model.ckpt-10563
INFO:tensorflow:seconds for batch: 12.94
INFO:tensorflow:loss: 4.336432
INFO:tensorflow:running_avg_loss: 4.869611
INFO:tensorflow:Found new best model with 4.870 running_avg_loss. Saving to logroot/pubmed-experiment/eval/bestmodel
INFO:tensorflow:Loading checkpoint logroot/pubmed-experiment/train/model.ckpt-10563
INFO:tensorflow:Restoring parameters from logroot/pubmed-experiment/train/model.ckpt-10563
结论:平均损失4.87
(3)预测
decode:
例子1:
148 / 210 steps decoded
INFO:tensorflow:ARTICLE ID: PMC3872579
INFO:tensorflow:REFERENCE SUMMARY: background : the present study was carried out to assess the effects of community nutrition intervention based on advocacy approach on malnutrition status among school - aged children in shiraz , !!__iran.materials__!! and methods : this case - control nutritional intervention has been done between 2008 and 2009 on __2897__ primary and secondary school boys and girls ( 7 - 13 years old ) based on advocacy approach in shiraz , iran . the project provided nutritious snacks in public schools over a 2-year period along with advocacy oriented actions in order to implement and promote nutritional intervention . for evaluation of effectiveness of the intervention growth monitoring indices of pre- and post - intervention were statistically !!__compared.results:the__!! frequency of subjects with body mass index lower than 5% decreased significantly after intervention among girls ( p = 0.02 ) . however , there were no significant changes among boys or total population . the mean of all anthropometric indices changed significantly after intervention both among girls and boys as well as in total population . the pre- and post - test education assessment in both groups showed that the student 's average knowledge score has been significantly increased from 12.5 !!____!! 3.2 to 16.8 !!____!! 4.3 ( p < !!__0.0001).conclusion__!! : this study demonstrates the potential success and scalability of school feeding programs in iran . community nutrition intervention based on the advocacy process model is effective on reducing the prevalence of underweight specifically among female school aged children .
INFO:tensorflow:GENERATED SUMMARY: [UNK] students are the most common problem of the way way in the way way . in this article , we report the first strategy of the context of the context of the context of the context of the context of the context of the context of the context of the context of the context of the context of this study was to assess the first data to address the effect of the context of the context of the context of [UNK] and [UNK] [UNK] . in this article , we review the first data to address the context of the context of the context of the context of the context of [UNK] and [UNK] [UNK] . in this article , we review the first data to address the context of the context of the context of the context of the context of [UNK] and [UNK] [UNK] .
例子2:
118 / 210 steps decoded
INFO:tensorflow:ARTICLE ID: PMC3872579
INFO:tensorflow:REFERENCE SUMMARY: background : the present study was carried out to assess the effects of community nutrition intervention based on advocacy approach on malnutrition status among school - aged children in shiraz , !!__iran.materials__!! and methods : this case - control nutritional intervention has been done between 2008 and 2009 on __2897__ primary and secondary school boys and girls ( 7 - 13 years old ) based on advocacy approach in shiraz , iran . the project provided nutritious snacks in public schools over a 2-year period along with advocacy oriented actions in order to implement and promote nutritional intervention . for evaluation of effectiveness of the intervention growth monitoring indices of pre- and post - intervention were statistically !!__compared.results:the__!! frequency of subjects with body mass index lower than 5% decreased significantly after intervention among girls ( p = 0.02 ) . however , there were no significant changes among boys or total population . the mean of all anthropometric indices changed significantly after intervention both among girls and boys as well as in total population . the pre- and post - test education assessment in both groups showed that the student 's average knowledge score has been significantly increased from 12.5 !!____!! 3.2 to 16.8 !!____!! 4.3 ( p < !!__0.0001).conclusion__!! : this study demonstrates the potential success and scalability of school feeding programs in iran . community nutrition intervention based on the advocacy process model is effective on reducing the prevalence of underweight specifically among female school aged children .
INFO:tensorflow:GENERATED SUMMARY: [UNK] students are the most common problem of the way way in the way way . in this article , we report the first strategy of the first strategy in the context of the context of the context of the context of the context of the context of the context of the context of the context of the context of this study was to assess the first data to address the effect of the context of the context of the context of [UNK] and [UNK] [UNK] . in this article , we review the first data to address the context of the context of the context of the context of the context of [UNK] and [UNK] [UNK] .
例子3:
86 / 210 steps decoded
INFO:tensorflow:ARTICLE ID: PMC3770628
INFO:tensorflow:REFERENCE SUMMARY: !!__backgroundanemia__!! in patients with cancer who are undergoing active therapy is commonly encountered and may worsen quality of life in these patients . the effect of blood transfusion is often temporary and may be associated with serious adverse events . erythropoiesis - stimulating agents are not effective in __30%50%__ of patients and may have a negative effect on overall !!__survival.aimsto__!! assess the efficacy and feasibility of intravenous iron therapy in patients with cancer who have non - iron - deficiency anemia and who are undergoing treatment with chemotherapy without the use of erythropoiesis - stimulating !!__agents.methodsadult__!! patients with solid cancers and non - iron - deficiency anemia were included . ferric sucrose at a dose of 200 mg was given in short intravenous infusions weekly for a total of 12 weeks . hemoglobin level was measured at baseline , every 3 weeks , and 2 weeks after the last iron infusion ( week 14 ) . adverse events related to intravenous iron were prospectively !!__reported.resultsof__!! 25 patients included , 19 ( __76.0%__ ) completed at least three iron infusions and 14 ( __56.0%__ ) finished the planned 12 weeks of therapy . the mean hemoglobin level of the 25 patients at baseline was 9.6 g / dl ( median , 9.9 g / dl ; range , 6.9 g / dl 10.9 g / dl ) . the mean change in hemoglobin level for the 15 patients who completed at least 9 treatments was 1.7 g / dl ( median , 1.1 g / dl ; range , 1.9 g / dl to 3.2 g / dl ) ; it reached 2.1 g / dl ( median , 1.3 g / dl ; range , 0.2 g / dl to 4.6 g / dl ; p = 0.0007 ) for the 14 patients who completed all 12 weekly treatments . five ( 20.0% ) patients were transfused and considered as treatment failures . no treatment - related adverse events were !!__reported.conclusionintravenous__!! iron treatment alone is safe and may reduce blood transfusion requirements and improve hemoglobin level in patients with cancer who are undergoing anticancer therapy . further randomized studies are needed to confirm these findings .
INFO:tensorflow:GENERATED SUMMARY: [UNK] patients with the first role of the context of the context of the context of the context of the context of patients with patients with cancer - sectional study . in this study , we review the first data to address , the context of the context of the context of [UNK] and [UNK] [UNK] . in this article , we review the first data to address the context of , the context of the context of the context of [UNK] and [UNK] [UNK] .
例子4:
58 / 210 steps decoded
INFO:tensorflow:ARTICLE ID: PMC5330001
INFO:tensorflow:REFERENCE SUMMARY: tardive dystonia ( td ) is a serious side effect of antipsychotic medications , more with typical antipsychotics , that is potentially irreversible in affected patients . studies show that newer atypical antipsychotics have a lower risk of td . as a result , many clinicians may have developed a false sense of security when prescribing these medications . we report a case of 20-year - old male with __hyperthymic__ temperament and borderline intellectual functioning , who developed severe td after low dose short duration exposure to atypical antipsychotic risperidone and then olanzapine . the goal of this paper is to alert the reader to be judicious and cautious before using casual low dose second generation antipsychotics in patient with no core psychotic features , __hyperthymic__ temperament , or borderline intellectual functioning suggestive of organic brain damage , who are more prone to develop adverse effects such as td and monitor the onset of td in patients taking atypical antipsychotics .
INFO:tensorflow:GENERATED SUMMARY: [UNK] antipsychotics is the most common congenital anomaly . in this article , we report the first strategy of a 15-year - old man who presented with the first strategy . in this article , we review the first data to the first strategy .