Skip to main content

fine-tune transformer-based models for named entity recognition

Project description

A python package to fine-tune transformer-based models for Named Entity Recognition (NER).

PyPI PyPI - Python Version Travis CI https://img.shields.io/badge/code%20style-black-000000.svg PyPI - License

Resources

About

Transformer-based models like BERT have had a game-changing impact on Natural Language Processing.

In order to utilize the publicly accessible pretrained models for Named Entity Recognition, one needs to retrain (or “fine-tune”) them using labeled text.

nerblackbox makes this easy.

https://raw.githubusercontent.com/af-ai-center/nerblackbox/master/docs/_static/nerblackbox.png

You give it

  • a Dataset (labeled text)

  • a Pretrained Model (transformers)

and you get

  • the best Fine-tuned Model

  • its Performance on the dataset

Installation

pip install nerblackbox

Usage

Fine-tuning can be done in a few simple steps using an “experiment configuration file”

# cat <experiment_name>.ini
dataset_name = swedish_ner_corpus
pretrained_model_name = af-ai-center/bert-base-swedish-uncased

and either the Command Line Interface (CLI) or the Python API:

# CLI
nerbb run_experiment <experiment_name>          # fine-tune
nerbb get_experiment_results <experiment_name>  # get results/performance
nerbb predict <experiment_name> <text_input>    # apply best model

# Python API
nerbb = NerBlackBox()
nerbb.run_experiment(<experiment_name>)         # fine-tune
nerbb.get_experiment_results(<experiment_name>) # get results/performance
nerbb.predict(<experiment_name>, <text_input>)  # apply best model

Project details


Download files

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

Source Distribution

nerblackbox-0.0.8.tar.gz (46.4 kB view hashes)

Uploaded Source

Built Distribution

nerblackbox-0.0.8-py3-none-any.whl (67.6 kB view hashes)

Uploaded Python 3

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