FBBC is abbreviation of Feature-Based BERT Classifier, and it is easy to adapt to other tasks with few changes.
- Refactor
DataProcessor
to fit your task. - run following command as BERT does
if you want to fine-tune BERT model, add arg
python simple_classifier.py --do_train=true --do_eval=true\ --data_dir=YOUR_DATA_PATH --bert_config_file=CONFIG_PATH\ --vocab_file=VOCAB_PATH --output_dir=OUTPUT_MODEL
--finetune=true
- if you want to check a model is
frozen
orfinetune
, runpython check_fintuned.py --raw_ckpt=BERT_MODEL_PATH --trained_ckpt=YOUR_MODEL_PATH
-
simple_classifier.py
In this code we can choose how to use pre-trained BERT model. Notice there is a
finetune
flag default byfalse
which means this classifier uses BERT as feature-based model likeELMo
. We can also set it totrue
just like the paper does.Another thing is we simplify the processors here.
-
optimizeation.py
We set trainable variables in this code. We use
bert
as keyword to filter BERT variables out, so you should name your variables withoutbert
in it.