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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file nerblackbox-0.0.8.tar.gz.

File metadata

  • Download URL: nerblackbox-0.0.8.tar.gz
  • Upload date:
  • Size: 46.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.7

File hashes

Hashes for nerblackbox-0.0.8.tar.gz
Algorithm Hash digest
SHA256 df6c2d49fd466983289c517d6bfa8e9d00c4bd24f533262e8aa6e1bd075ed8b2
MD5 4a5f6060f0a6e15ea08b9fc56c68fd1a
BLAKE2b-256 412d124b1a109d08f4f1eb7b3f4b0cd38b66252541370410467e2b1eb4ab2add

See more details on using hashes here.

File details

Details for the file nerblackbox-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: nerblackbox-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 67.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.7

File hashes

Hashes for nerblackbox-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 df413efb73d09d2e4a5a38defec77f179f6e3add1d8c95139339e51be3e61ca9
MD5 d0689c0fd43737929da87cdae0d863d1
BLAKE2b-256 84c5835c2fecccaa04dac2e7a9cc6649a0bad20206a766378f5fe7f7a74fb676

See more details on using hashes here.

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