{"id":19168356,"url":"https://github.com/bloomberg/argument-relation-transformer-acl2022","last_synced_at":"2025-11-08T05:03:19.536Z","repository":{"id":37487171,"uuid":"504650000","full_name":"bloomberg/argument-relation-transformer-acl2022","owner":"bloomberg","description":"This repository contains code for our ACL 2022 Findings paper `Efficient Argument Structure Extraction with Transfer Learning and Active Learning`. We implement an argument structure extraction method based on a pre-trained Transformer model.`","archived":false,"fork":false,"pushed_at":"2023-06-12T21:32:34.000Z","size":43,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-19T23:31:57.460Z","etag":null,"topics":[],"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/bloomberg.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-17T19:26:58.000Z","updated_at":"2025-03-07T01:29:45.000Z","dependencies_parsed_at":"2024-11-09T09:42:29.064Z","dependency_job_id":"70d3e084-e58a-4f74-bca5-0e7a1cde146b","html_url":"https://github.com/bloomberg/argument-relation-transformer-acl2022","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bloomberg%2Fargument-relation-transformer-acl2022","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bloomberg%2Fargument-relation-transformer-acl2022/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bloomberg%2Fargument-relation-transformer-acl2022/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bloomberg%2Fargument-relation-transformer-acl2022/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bloomberg","download_url":"https://codeload.github.com/bloomberg/argument-relation-transformer-acl2022/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252897313,"owners_count":21821419,"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":[],"created_at":"2024-11-09T09:42:22.911Z","updated_at":"2025-11-08T05:03:19.497Z","avatar_url":"https://github.com/bloomberg.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Argument Structure Prediction\n\nCode release for paper `Efficient Argument Structure Extraction with Transfer Learning and Active Learning`\n\n```bibtex\n@inproceedings{hua-wang-2022-efficient,\n    title = \"Efficient Argument Structure Extraction with Transfer Learning and Active Learning\",\n    author = \"Hua, Xinyu  and\n      Wang, Lu\",\n    booktitle = \"Findings of the Association for Computational Linguistics: ACL 2022\",\n    month = may,\n    year = \"2022\",\n    address = \"Dublin, Ireland\",\n    publisher = \"Association for Computational Linguistics\",\n    url = \"https://aclanthology.org/2022.findings-acl.36\",\n    pages = \"423--437\",\n}\n```\n\n## Requirements\n\nThe original project is tested under the following environments:\n\n```\npython==3.7.12\ntorch==1.6.0\npytorch_lightning==1.5.0\ntransformers==4.10.3\nnumpy==1.21.6\nscikit-learn==1.0.2\n```\n\n## Data\n\nWe release the AMPERE++ dataset in this [link](https://zenodo.org/record/6362430#.YjJJUprMIba). \nPlease download the jsonl files and store under `./data`.\n\n\nThe other four datasets can be downloaded using the links below (requires format conversion, code can be found in `./scripts/`):\n\n- Essays (Stab and Gurevych, 2017): [link](https://tudatalib.ulb.tu-darmstadt.de/handle/tudatalib/2422)\n- AbstRCT (Mayer et al., 2020): [link](https://gitlab.com/tomaye/abstrct/)\n- ECHR (Poudyal et al., 2020): [link](http://www.di.uevora.pt/~pq/echr/)\n- CDCP (Park and Cardie, 2018; Niculae et al., 2017): [link](https://facultystaff.richmond.edu/~jpark/data/cdcp_acl17.zip)\n\n## Quick Start\n\nFirst, install the package:\n\n```shell script\npip install -e .\n```\n\nTo train a standard supervised relation extraction model on AMPERE++:\n\n```shell script\nSEED=42\nDOMAIN=\"ampere\"\n\npython -m argument_relation_transformer.train \\\n  --datadir=./data \\\n  --seed=${SEED} \\\n  --dataset=${DOMAIN} \\\n  --ckptdir=./checkpoints \\\n  --exp-name=demo-${DOMAIN}_seed=${SEED} \\\n  --warmup-steps=5000 \\\n  --learning-rate=1e-5 \\\n  --scheduler=constant \\\n  --max-epochs=15\n```\n\nThe trained model will be saved at `./checkpoints/demo-ampere_seed=42/`, the tensorboard metrics can be found under `./tb_logs/demo-ampere_seed=42/` which can be loaded for evaluation.\n\n```shell script\nSEED=42 # only used in training, here to identify the training checkpoint path\nDOMAIN=\"ampere\"\nEXP_NAME=demo-${DOMAIN}_seed=${SEED}\n\npython -m argument_relation_transformer.infer \\\n  --datadir=./data \\\n  --dataset=${DOMAIN} \\\n  --eval-set=test \\\n  --exp-name=demo-${DOMAIN}_seed=${SEED} \\\n  --ckptdir=./checkpoints/ \\\n  --batch-size=32\n```\n\nThe prediction results will be saved to `./outputs/demo-ampere_seed=42.jsonl`, the evaluation metrics will be saved to `./outputs/demo-ampere_seed=42.jsonl.scores`\n\n## Active Learning (AL)\n\nWe simulate the pool-based AL, where the entire process consists of 10 iterations. During each iteration, 500 samples are collected based \non certain sampling strategy. We use the following script to demonstrate this procedure (`train_active_demo.sh`):\n\n```shell script\nINTERVAL=500\nSEED=42\nMETHOD=\"max_entropy\"\nDOMAIN=\"ampere\"\nEXP_NAME=\"${METHOD}-demo_seed=${SEED}\"\nCKPTDIR=\"./checkpoints_al/\"\nMAX_EPOCHS=10\n\nactive() {\n# load model from `model-path` (if needed)\n# select INTERVAL unlabeled samples\n# save to `/tmp/checkpoints_al/[data]/[exp_name]/[method]_[interval].jsonl`, which is\n# the ids of **all** labeled data\n# args: (1) current sample size;\n    python -m argument_relation_transformer.active \\\n        --dataset=${DOMAIN} \\\n        --datadir=\"./data/\" \\\n        --ckptdir=${CKPTDIR} \\\n        --exp-name=${EXP_NAME} \\\n        --method=${METHOD} \\\n        --seed=${SEED} \\\n        --interval=${INTERVAL} \\\n        --huggingface-path=\"./huggingface/\" \\\n        --current-sample-size=$1\n}\n\ntrain() {\n# load data from `{ckptdir}/{exp-name}/{method}_{current-sample-size}.jsonl`\n# train the model and save to `{ckptdir}/{exp-name}/model_{current-sample-size}/`\n    python -m argument_relation_transformer.train \\\n        --datadir=./data \\\n        --seed=${SEED} \\\n        --dataset=${DOMAIN} \\\n        --ckptdir=${CKPTDIR} \\\n        --exp-name=${EXP_NAME} \\\n        --warmup-steps=500 \\\n        --learning-rate=1e-5 \\\n        --huggingface-path=\"./huggingface/\" \\\n        --scheduler-type=constant \\\n        --max-epochs=${MAX_EPOCHS} \\\n        --from-al \\\n        --al-method=${METHOD} \\\n        --current-sample-size=$1\n}\n\nfor p in 0 500 1000 1500 2000 2500 3000 3500 4000 4500;\ndo \n    # each step, we have p samples already, and are selecting the next 500 samples\n    active ${p}\n    n_p=$(( $p + $INTERVAL))\n    train ${n_p}\ndone\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbloomberg%2Fargument-relation-transformer-acl2022","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbloomberg%2Fargument-relation-transformer-acl2022","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbloomberg%2Fargument-relation-transformer-acl2022/lists"}