GithubHelp home page GithubHelp logo

nhsjgczryf / transformer-srl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from riccorl/transformer-srl

0.0 0.0 0.0 629 KB

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.

Python 43.79% Shell 2.47% Jsonnet 5.68% Perl 48.07%

transformer-srl's Introduction

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

CLI

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")
predictor.predict(
  sentence="Did Uriah honestly think he could beat the game in under three hours?"
)

Infos

  • 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

To-Dos

  • 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)

transformer-srl's People

Contributors

riccorl avatar nhsjgczryf avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.