BERT_NER_CLI Step by Step Guide

Bert NER command line tester with step by step setup guide.


  • Python 3.5+
  • Tensorflow 1.11+

Folder structure

Item Desc
NERdata training / evaluating dataset
bert bert code download from here training code predict code simple command line program for testing purpose

Fine-Tune model

alt text

Training with GCP GPU/TPU

I found this pretty detailed instructions of how to deploy code, mount folders and execute .py files with Google Colab and utilizing their FREE TPU/GPU capabilities.

BERT-Base, Uncased or BERT-Large, Uncased need to be unzipped and upload to your Google Drive folder and be mounted.

alt text

I used Colab GPU (K80) fine-tuning the model, took me around 30 mins.


An evaluation script can be found here. A quick evaluation with Uncased 12-layer result in 93.26 f1 score. 24-layer result will be tried and provided here later.


A simple command line program was provided here for testing purpose. Simply run


The program will firstly load the model and waiting for inputs.

Some test results:

alt text
alt text
alt text