BERT-BiLSTM-CRF-NER  by macanv

TensorFlow code for Chinese NER using BERT fine-tuning with BiLSTM-CRF

created 6 years ago
4,835 stars

Top 10.5% on sourcepulse

GitHubView on GitHub
Project Summary

This repository provides a TensorFlow implementation for Named Entity Recognition (NER) using a BERT-BiLSTM-CRF architecture. It's designed for researchers and developers working with Chinese NLP tasks, offering fine-tuning capabilities with Google's BERT models and a deployable service for NER and text classification.

How It Works

The core of the project combines BERT's contextual embeddings with a Bidirectional Long Short-Term Memory (BiLSTM) network and a Conditional Random Field (CRF) layer. BERT provides powerful pre-trained representations, which are then fed into the BiLSTM to capture sequential dependencies. The CRF layer models the dependencies between predicted labels, leading to more accurate NER tagging. This hybrid approach leverages the strengths of both pre-trained language models and sequence labeling architectures.

Quick Start & Requirements

  • Install: pip install bert-base==0.0.9 -i https://pypi.org/simple or clone and python3 setup.py install.
  • Prerequisites: Python 3, TensorFlow. Requires pre-trained BERT models (e.g., chinese_L-12_H-768_A-12.zip). Training data from specified GitHub repos or custom formats.
  • Setup: Cloning and installing dependencies is straightforward. Training requires downloading BERT models and preparing data.
  • Docs: Chinese documentation available at https://blog.csdn.net/macanv/article/details/85684284.

Highlighted Details

  • Supports both BiLSTM-CRF and CRF-only decoding.
  • Includes a Flask-based service for NER and text classification.
  • Model size reduction from 1.3GB to 400MB by removing Adam parameters.
  • Provides client code examples for NER and text classification.

Maintenance & Community

The project is maintained by macanv. Community interaction is encouraged via GitHub issues.

Licensing & Compatibility

  • License: MIT.
  • Compatibility: Generally compatible with commercial use due to the MIT license. The project references other open-source projects, and users should be mindful of their respective licenses.

Limitations & Caveats

The project primarily targets Chinese NER, though adaptation for other languages is mentioned as requiring minor code changes. The README contains some outdated links and references to older versions. The service cannot run NER and text classification simultaneously; separate instances are required.

Health Check
Last commit

4 years ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
30 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.