Skip to main content

fine-tune transformer-based language models for named entity recognition

Project description

A python package to fine-tune transformer-based language models for named entity recognition (NER).

PyPI PyPI - Python Version CI https://coveralls.io/repos/github/flxst/nerblackbox/badge.svg?branch=master https://img.shields.io/badge/code%20style-black-000000.svg PyPI - License

Resources

Installation

pip install nerblackbox

About

https://raw.githubusercontent.com/flxst/nerblackbox/master/docs/docs/images/nerblackbox.png

Fine-tune a language model for named entity recognition in a few simple steps:

  1. Define a fine-tuning experiment by choosing a pretrained model and a dataset

experiment = Experiment("my_experiment", model="bert-base-cased", dataset="conll2003")
  1. Run the experiment and get the performance of the fine-tuned model

experiment.run()
experiment.get_result(metric="f1", level="entity", phase="test")
# 0.9045
  1. Use the fine-tuned model for inference

model = Model.from_experiment("my_experiment")
model.predict("The United Nations has never recognised Jakarta's move.")
# [[
#  {'char_start': '4', 'char_end': '18', 'token': 'United Nations', 'tag': 'ORG'},
#  {'char_start': '40', 'char_end': '47', 'token': 'Jakarta', 'tag': 'LOC'}
# ]]

There is much more to it than that! See the documentation to get started.

Features

Data

  • Support for Different Data Formats

  • Support for Different Annotation Schemes

  • Integration of HuggingFace Datasets

  • Text Encoding

Training

  • Adaptive Fine-tuning

  • Hyperparameter Search

  • Multiple Runs with Different Random Seeds

  • Detailed Analysis of Training Results

Evaluation

  • Evaluation of a Model on a Dataset

Inference

  • Versatile Model Inference

Other

  • Compatibility with HuggingFace

  • GPU Support

  • Language Agnosticism

See the documentation for more details.

Citation

@misc{nerblackbox,
  author = {Stollenwerk, Felix},
  title  = {nerblackbox: a python package to fine-tune transformer-based language models for named entity recognition},
  year   = {2021},
  url    = {https://github.com/flxst/nerblackbox},
}

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.14.tar.gz (116.9 kB view hashes)

Uploaded Source

Built Distribution

nerblackbox-0.0.14-py3-none-any.whl (162.2 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