{"id":20560077,"url":"https://github.com/cannylab/summary_loop","last_synced_at":"2025-04-14T14:03:31.004Z","repository":{"id":48697627,"uuid":"258278617","full_name":"CannyLab/summary_loop","owner":"CannyLab","description":"Codebase for the Summary Loop paper at ACL2020","archived":false,"fork":false,"pushed_at":"2022-10-02T20:44:58.000Z","size":34,"stargazers_count":45,"open_issues_count":2,"forks_count":13,"subscribers_count":6,"default_branch":"master","last_synced_at":"2023-03-02T03:30:58.923Z","etag":null,"topics":["abstractive-summarization","acl2020","fluency-model","news","reinforcement-learning","summarization","unsupervised-learning"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CannyLab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-23T17:21:47.000Z","updated_at":"2023-02-02T10:27:36.000Z","dependencies_parsed_at":"2023-01-19T02:30:37.973Z","dependency_job_id":null,"html_url":"https://github.com/CannyLab/summary_loop","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CannyLab%2Fsummary_loop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CannyLab%2Fsummary_loop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CannyLab%2Fsummary_loop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CannyLab%2Fsummary_loop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CannyLab","download_url":"https://codeload.github.com/CannyLab/summary_loop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224873086,"owners_count":17384078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["abstractive-summarization","acl2020","fluency-model","news","reinforcement-learning","summarization","unsupervised-learning"],"created_at":"2024-11-16T03:53:10.724Z","updated_at":"2024-11-16T03:53:11.428Z","avatar_url":"https://github.com/CannyLab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Summary Loop\n\nThis repository contains the code for ACL2020 paper: [The Summary  Loop: Learning to Write Abstractive Summaries Without Examples](http://people.ischool.berkeley.edu/~hearst/papers/Laban_ACL2020_Abstractive_Summarization.pdf).\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"460\" height=\"300\" src=\"https://tingofurro.github.io/images/summary_loop.png\"\u003e\n\u003c/p\u003e\n\n## Training Procedure\n\nWe provide pre-trained models for each component needed in the [Summary Loop Release](https://github.com/CannyLab/summary_loop/releases/tag/v0.1):\n\n- `keyword_extractor.joblib`: An sklearn pipeline that will extract can be used to compute tf-idf scores of words according to the BERT vocabulary, which is used by the Masking Procedure,\n- `bert_coverage.bin`: A bert-base-uncased finetuned model on the task of Coverage for the news domain,\n- `fluency_news_bs32.bin`: A GPT2 (base) model finetuned on a large corpus of news articles, used as the Fluency model,\n- `gpt2_copier23.bin`: A GPT2 (base) model that can be used as an initial point for the Summarizer model.\n\n[In the release](https://github.com/CannyLab/summary_loop/releases/tag/v0.1), we also provide:\n- `pretrain_coverage.py` script to train a coverage model from scratch, \n- `train_generator.py` to train a fluency model from scratch (we recommend Fluency model on domain of summaries, such as news, legal, etc.)\n\nOnce all the pretraining models are ready, training a summarizer can be done using the `train_summary_loop.py`:\n```\npython train_summary_loop.py --experiment wikinews_test --dataset_file data/wikinews.db\n```\n\n## CNN/DM Test Set Model Generation\n\nWe provide the 11,490 summaries produces by the Summary Loop models on the test portion of the CNN/Daily Mail dataset.\nThe release is [available here](https://github.com/CannyLab/summary_loop/releases/tag/0.3). This is intended to facilitate comparison to future work, and analysis work, such as analysis of abstractiveness and factuality.\n\n## Generator Model\n\n*[New January 2022]* The model card for Summary Loop 46 has been added to the HuggingFace model hub, working with the latest version of the HuggingFace library. See the model card here for usage: https://huggingface.co/philippelaban/summary_loop46\n\nThe model can be loaded in the following way:\n```\nfrom transformers import GPT2LMHeadModel, GPT2TokenizerFast\n\nmodel = GPT2LMHeadModel.from_pretrained(\"philippelaban/summary_loop46\")\ntokenizer = GPT2TokenizerFast.from_pretrained(\"philippelaban/summary_loop46\")\n```\nUsage examples in the [model card](https://huggingface.co/philippelaban/summary_loop46).\n\n## Scorer Models\n\nThe Coverage and Fluency model and Guardrails scores can be used separately for analysis, evaluation, etc.\nThey are respectively in `model_coverage.py` and `model_guardrails.py`, each model is implemented as a class with a `score(document, summary)` function.\nThe Fluency model is a Language model, which is also the generator (in `model_generator.py`).\nExamples of how to run each model are included in the class files, at the bottom of the files.\n\n## Bringing in your own data\n\nWant to test out the Summary Loop on a different language/type of text?\nA [Jupyter Notebook](https://github.com/CannyLab/summary_loop/blob/master/Dataset%20SQLite3%20Example.ipynb) can help you bring your own data into the SQLite format we use in the pre-training scripts. Otherwise you can modify the scripts' data loading (`DataLoader`) and collate function (`collate_fn`).\n\n## Cite the work\n\nIf you make use of the code, models, or algorithm, please cite our paper:\n```\n@inproceedings{laban2020summary,\n  title={The Summary Loop: Learning to Write Abstractive Summaries Without Examples},\n  author={Laban, Philippe and Hsi, Andrew and Canny, John and Hearst, Marti A},\n  booktitle={Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics},\n  volume={1},\n  year={2020}\n}\n```\n\n## Contributing\n\nIf you'd like to contribute, or have questions or suggestions, you can contact us at phillab@berkeley.edu.\nAll contributions welcome! For example, if you have a type of text data on which you want to apply the Summary Loop.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcannylab%2Fsummary_loop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcannylab%2Fsummary_loop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcannylab%2Fsummary_loop/lists"}