Skip to main content

SRL Transformer model

Project description

Upload Python Package Code style: black

Semantic Role Lableing with BERT

Semantic Role Labeling based on AllenNLP implementation of Shi et al, 2019. Can be trained using both PropBank and VerbAatlas inventories and implements also the predicate disambiguation task, in addition to arguments identification and disambiguation.

How to use

Install the library

pip install transformer-srl

Download the pretrained model srl_bert_base_conll2012.tar.gz from here.

File Model Version F1 Argument F1 Predicate
srl_bert_base_conll2012.tar.gz bert-base-cased 2.4.6 86.0 95.5


echo '{"sentence": "Did Uriah honestly think he could beat the game in under three hours?"}' | \
allennlp predict path/to/srl_bert_base_conll2012.tar.gz - --include-package transformer_srl

Inside Python Code

from transformer_srl import dataset_readers, models, predictors

predictor = predictors.SrlTransformersPredictor.from_path("path/to/srl_bert_base_conll2012.tar.gz, "transformer_srl")
  sentence="Did Uriah honestly think he could beat the game in under three hours?"


  • Language Model: BERT
  • Dataset: CoNLL 2012

Results with VerbAtlas

With bert-base-cased:

# Dev set
- F1 arguments 87.6
- F1 predicates 95.5
# Test set
- F1 arguments x
- F1 predicates x

With bert-base-multilingual-cased:

# Dev set
- F1 arguments 86.2
- F1 predicates 94.2
# Test set
- F1 arguments 86.1
- F1 predicates 94.9


  • Works with both PropBank and VerbAtlas (infer inventory from dataset reader)
  • Compatibility with all models from Huggingface's Transformers. - Now works only with models that accept 1 as token type id
  • Predicate identification (without using spacy)

Project details

Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

transformer_srl-2.5.2.tar.gz (39.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page