{"id":18831623,"url":"https://github.com/riccorl/transformer-srl","last_synced_at":"2025-04-14T04:16:44.131Z","repository":{"id":57476942,"uuid":"280617930","full_name":"Riccorl/transformer-srl","owner":"Riccorl","description":"Reimplementation of a BERT based model (Shi et al, 2019), currently the state-of-the-art for English SRL. This model implements also predicate disambiguation.","archived":false,"fork":false,"pushed_at":"2022-03-19T10:47:53.000Z","size":1267,"stargazers_count":70,"open_issues_count":5,"forks_count":9,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-14T04:16:38.999Z","etag":null,"topics":["allennlp","bert","conll2012","dataset","labeling","natural-language-processing","nlp","propbank","pytorch","role","semantic","semantic-role-labeling","shi","span","srl","srl-annotations","srltagger","transformer","transformers","verbatlas"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Riccorl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-07-18T08:48:21.000Z","updated_at":"2025-03-16T03:28:23.000Z","dependencies_parsed_at":"2022-09-14T16:41:17.079Z","dependency_job_id":null,"html_url":"https://github.com/Riccorl/transformer-srl","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Riccorl%2Ftransformer-srl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Riccorl%2Ftransformer-srl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Riccorl%2Ftransformer-srl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Riccorl%2Ftransformer-srl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Riccorl","download_url":"https://codeload.github.com/Riccorl/transformer-srl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248819412,"owners_count":21166477,"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":["allennlp","bert","conll2012","dataset","labeling","natural-language-processing","nlp","propbank","pytorch","role","semantic","semantic-role-labeling","shi","span","srl","srl-annotations","srltagger","transformer","transformers","verbatlas"],"created_at":"2024-11-08T01:55:26.041Z","updated_at":"2025-04-14T04:16:44.110Z","avatar_url":"https://github.com/Riccorl.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Upload Python Package](https://github.com/Riccorl/srl-bert-verbatlas/workflows/Upload%20Python%20Package/badge.svg)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n# Semantic Role Lableing with BERT\n\nSemantic Role Labeling based on [AllenNLP implementation](https://demo.allennlp.org/semantic-role-labeling) of [Shi et al, 2019](https://arxiv.org/abs/1904.05255). Can be trained using both PropBank and [VerbAtlas](http://verbatlas.org/) inventories and implements also the predicate disambiguation task, in addition to arguments identification and disambiguation.\n\n## How to use\n\nInstall the library\n\n```bash\npip install transformer-srl\n```\n\n## Pre-trained model\n\nYou can also use a pre-trained model. To use it, first install the correct version of `transformer-srl`:\n\n```bash\npip install transformer-srl==2.4.6\n```\n\nthen download the pretrained model `srl_bert_base_conll2012.tar.gz` from [here](https://www.dropbox.com/s/4tes6ypf2do0feb/srl_bert_base_conll2012.tar.gz).\n\n| File | Model | Version | F1 Argument | F1 Predicate |\n| :---: | :---: | :---: | :---: | :---: |\n| srl_bert_base_conll2012.tar.gz | `bert-base-cased` | 2.4.6 | 86.0 | 95.5 | \n\n#### CLI\n\n```bash\necho '{\"sentence\": \"Did Uriah honestly think he could beat the game in under three hours?\"}' | \\\nallennlp predict path/to/srl_bert_base_conll2012.tar.gz - --include-package transformer_srl\n```\n\n#### Inside Python Code\n\n```python\nfrom transformer_srl import dataset_readers, models, predictors\n\npredictor = predictors.SrlTransformersPredictor.from_path(\"path/to/srl_bert_base_conll2012.tar.gz, \"transformer_srl\")\npredictor.predict(\n  sentence=\"Did Uriah honestly think he could beat the game in under three hours?\"\n)\n```\n\n## Infos\n\n- Language Model: BERT\n- Dataset: CoNLL 2012\n\n### Results with VerbAtlas\n\nWith `bert-base-cased`:\n```\n# Dev set\n- F1 arguments 87.6\n- F1 predicates 95.5\n# Test set\n- F1 arguments x\n- F1 predicates x\n```\n\nWith `bert-base-multilingual-cased`:\n```\n# Dev set\n- F1 arguments 86.2\n- F1 predicates 94.2\n# Test set\n- F1 arguments 86.1\n- F1 predicates 94.9\n```\n\n### To-Dos\n\n- [x] Works with both PropBank and VerbAtlas (infer inventory from dataset reader)\n- [ ] Compatibility with all models from Huggingface's Transformers.\n        - Now works only with models that accept 1 as token type id \n- [ ] Predicate identification (without using spacy)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friccorl%2Ftransformer-srl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Friccorl%2Ftransformer-srl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friccorl%2Ftransformer-srl/lists"}