{"id":18864569,"url":"https://github.com/yuhaozhang/tacred-relation","last_synced_at":"2025-09-11T12:37:44.341Z","repository":{"id":47727886,"uuid":"102428518","full_name":"yuhaozhang/tacred-relation","owner":"yuhaozhang","description":"PyTorch implementation of the position-aware attention model for relation extraction","archived":false,"fork":false,"pushed_at":"2024-04-24T11:03:43.000Z","size":43,"stargazers_count":359,"open_issues_count":10,"forks_count":97,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-06-02T00:29:44.495Z","etag":null,"topics":["information-extraction","natural-language-processing","nlp","relation-extraction"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yuhaozhang.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":"2017-09-05T03:16:21.000Z","updated_at":"2025-03-26T17:42:35.000Z","dependencies_parsed_at":"2024-12-23T20:10:29.687Z","dependency_job_id":"4fb4622d-f459-4465-bb9f-f5de376a1ee6","html_url":"https://github.com/yuhaozhang/tacred-relation","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"18221efc28be400ad3ec3939f1bbd32ab74b64f5"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yuhaozhang/tacred-relation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuhaozhang%2Ftacred-relation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuhaozhang%2Ftacred-relation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuhaozhang%2Ftacred-relation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuhaozhang%2Ftacred-relation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yuhaozhang","download_url":"https://codeload.github.com/yuhaozhang/tacred-relation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuhaozhang%2Ftacred-relation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274635619,"owners_count":25321993,"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","status":"online","status_checked_at":"2025-09-11T02:00:13.660Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["information-extraction","natural-language-processing","nlp","relation-extraction"],"created_at":"2024-11-08T04:43:24.368Z","updated_at":"2025-09-11T12:37:44.282Z","avatar_url":"https://github.com/yuhaozhang.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Position-aware Attention RNN Model for Relation Extraction\n=========================\n\nThis repo contains the *PyTorch* code for paper [Position-aware Attention and Supervised Data Improve Slot Filling](https://nlp.stanford.edu/pubs/zhang2017tacred.pdf).\n\n**The TACRED dataset**: Details on the TAC Relation Extraction Dataset can be found on [this dataset website](https://nlp.stanford.edu/projects/tacred/).\n\n## Requirements\n\n- Python 3 (tested on 3.6.2)\n- PyTorch (tested on 1.0.0)\n- unzip, wget (for downloading only)\n\n## Preparation\n\nFirst, download and unzip GloVe vectors from the Stanford website, with:\n```\nchmod +x download.sh; ./download.sh\n```\n\nThen prepare vocabulary and initial word vectors with:\n```\npython prepare_vocab.py dataset/tacred dataset/vocab --glove_dir dataset/glove\n```\n\nThis will write vocabulary and word vectors as a numpy matrix into the dir `dataset/vocab`.\n\n## Training\n\nTrain a position-aware attention RNN model with:\n```\npython train.py --data_dir dataset/tacred --vocab_dir dataset/vocab --id 00 --info \"Position-aware attention model\"\n```\n\nUse `--topn N` to finetune the top N word vectors only. The script will do the preprocessing automatically (word dropout, entity masking, etc.).\n\nTrain an LSTM model with:\n```\npython train.py --data_dir dataset/tacred --vocab_dir dataset/vocab --no-attn --id 01 --info \"LSTM model\"\n```\n\nModel checkpoints and logs will be saved to `./saved_models/00`.\n\n## Evaluation\n\nRun evaluation on the test set with:\n```\npython eval.py saved_models/00 --dataset test\n```\n\nThis will use the `best_model.pt` by default. Use `--model checkpoint_epoch_10.pt` to specify a model checkpoint file. Add `--out saved_models/out/test1.pkl` to write model probability output to files (for ensemble, etc.).\n\n## Ensemble\n\nPlease see the example script `ensemble.sh`.\n\n## License\n\nAll work contained in this package is licensed under the Apache License, Version 2.0. See the included LICENSE file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuhaozhang%2Ftacred-relation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyuhaozhang%2Ftacred-relation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuhaozhang%2Ftacred-relation/lists"}