{"id":28676604,"url":"https://github.com/zjunlp/docunet","last_synced_at":"2025-06-24T15:32:26.675Z","repository":{"id":45211515,"uuid":"365130603","full_name":"zjunlp/DocuNet","owner":"zjunlp","description":"[IJCAI 2021] Document-level Relation Extraction as Semantic Segmentation","archived":false,"fork":false,"pushed_at":"2022-12-06T19:39:55.000Z","size":266,"stargazers_count":145,"open_issues_count":0,"forks_count":22,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-13T23:05:18.142Z","etag":null,"topics":["docred","document","document-level","document-level-relation-extraction","docunet","information-extraction","pytorch","pytorch-implementation","re","relation-extraction","segmentation","semantic-segmentation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zjunlp.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":"2021-05-07T06:03:52.000Z","updated_at":"2025-06-11T13:13:38.000Z","dependencies_parsed_at":"2023-01-23T15:00:44.698Z","dependency_job_id":null,"html_url":"https://github.com/zjunlp/DocuNet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zjunlp/DocuNet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zjunlp%2FDocuNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zjunlp%2FDocuNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zjunlp%2FDocuNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zjunlp%2FDocuNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zjunlp","download_url":"https://codeload.github.com/zjunlp/DocuNet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zjunlp%2FDocuNet/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261703205,"owners_count":23196921,"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":["docred","document","document-level","document-level-relation-extraction","docunet","information-extraction","pytorch","pytorch-implementation","re","relation-extraction","segmentation","semantic-segmentation"],"created_at":"2025-06-13T23:05:16.262Z","updated_at":"2025-06-24T15:32:26.650Z","avatar_url":"https://github.com/zjunlp.png","language":"Python","readme":"\n\n\n\u003c!-- \n\u003cp align=\"center\"\u003e\n  \t\u003cfont size=60\u003e\u003cstrong\u003eDocuNet\u003c/strong\u003e\u003c/font\u003e\n\u003c/p\u003e --\u003e\n\n# DocuNet\n\n\n\nThis repository is the official implementation of [**DocuNet**](https://github.com/zjunlp/DocRE/), which is model proposed in a paper: **[Document-level Relation Extraction as Semantic Segmentation](https://www.ijcai.org/proceedings/2021/551)**, accepted by **IJCAI2021** main conference. \n\n- ❗NOTE: Docunet is integrated in the knowledge extraction toolkit [DeepKE](https://github.com/zjunlp/DeepKE).\n\n\u003c!-- # Contributor\nXiang Chen, Xin Xie, Shuming Deng, Ningyu Zhang, and Huajun Chen. \n --\u003e\n\n# Brief Introduction\nThis paper innovatively proposes the DocuNet model, which first regards the document-level relation extraction as the semantic segmentation task in computer vision.\n\n\n\u003cdiv align=center\u003e\u003cimg src=\"model.png\" width=\"80%\" height=\"80%\" /\u003e\u003c/div\u003e\n\n\n# Requirements\n\nTo install requirements:\n\n```setup\npip install -r requirements.txt\n```\n\n\n# Training\n\nTo train the DocuNet model in the paper on the dataset [DocRED](https://github.com/thunlp/DocRE), run this command:\n\n```bash\n\u003e\u003e bash scripts/run_docred.sh # use BERT/RoBERTa by setting --transformer-type\n```\n\nTo train the DocuNet model in the paper on the dataset CDR and GDA, run this command:\n\n```bash\n\u003e\u003e bash scripts/run_cdr.sh  # for CDR\n\u003e\u003e bash scripts/run_gda.sh  # for GDA\n```\n\n\n\n# Evaluation\n\nTo evaluate the trained model in the paper, you setting the `--load_path` argument in training scripts. The program will log the result of evaluation automatically. And for DocRED  it will generate a test file `result.json` in the official evaluation format. You can compress and submit it to Colab for the official test score.\n\n\n# Results\n\nOur model achieves the following performance on : \n\n## Document-level Relation Extraction on [DocRED](https://github.com/thunlp/DocRED)\n\n\n| Model     | Ign F1 on Dev | F1 on Dev | Ign F1 on Test | F1 on Test |\n| :----------------: |:--------------: | :------------: | ------------------ | ------------------ |\n| DocuNet-BERT (base) |  59.86±0.13 |   61.83±0.19 |     59.93    |      61.86  |\n| DocuNet-RoBERTa (large) | 62.23±0.12 | 64.12±0.14 | 62.39 | 64.55 |\n\n## Document-level Relation Extraction on [CDR and GDA](https://github.com/fenchri/edge-oriented-graph)\n\n| Model  |    CDR    | GDA |\n| :----------------: | :----------------: | :----------------: |\n| DocuNet-SciBERT (base) | 76.3±0.40    | 85.3±0.50  |\n\n\n# Acknowledgement\n\nPart of our code is borrowed from [https://github.com/wzhouad/ATLOP](https://github.com/wzhouad/ATLOP), many thanks.\nYou can refer to [https://github.com/fenchri/edge-oriented-graph](https://github.com/fenchri/edge-oriented-graph) for the detailed preprocessing process of GDA and CDR datasets (acquire the file of train_filter.data, dev_filter.data and test_filter.data).\n\n# Papers for the Project \u0026 How to Cite\nIf you use or extend our work, please cite the paper as follows:\n\n```\n@inproceedings{ijcai2021-551,\n  title     = {Document-level Relation Extraction as Semantic Segmentation},\n  author    = {Zhang, Ningyu and Chen, Xiang and Xie, Xin and Deng, Shumin and Tan, Chuanqi and Chen, Mosha and Huang, Fei and Si, Luo and Chen, Huajun},\n  booktitle = {Proceedings of the Thirtieth International Joint Conference on\n               Artificial Intelligence, {IJCAI-21}},\n  publisher = {International Joint Conferences on Artificial Intelligence Organization},\n  editor    = {Zhi-Hua Zhou},\n  pages     = {3999--4006},\n  year      = {2021},\n  month     = {8},\n  note      = {Main Track}\n  doi       = {10.24963/ijcai.2021/551},\n  url       = {https://doi.org/10.24963/ijcai.2021/551},\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzjunlp%2Fdocunet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzjunlp%2Fdocunet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzjunlp%2Fdocunet/lists"}