bert icon indicating copy to clipboard operation
bert copied to clipboard

My own dataset fine-tuning

Open simonefrancia opened this issue 8 years ago • 3 comments

Hi, in these days I was able to extract embeddings for every token of my own dataset for tone/mood analysis (I have 5 labels). I have seen that you insert an example of fine-tuning for MRPC dataset, but it has a different number of labels from mine. How can I apply a fine-tuning for my own dataset, starting from BERT embedding?

Thanks

simonefrancia avatar Nov 20 '18 15:11 simonefrancia

The classification layer is always added at fine-tuning time, so it can be any size you want. For example, in run_pretraining.py MRPC is 2-label and MNLI is 3-label. If you're doing a sentence-level classification task the recommended way is end-to-end fine tuning as is done with run_pretraining.py. In fact you can add your own DataProcessor and not have any TensorFlow code.

For token-level tasks, see the README for a recommendation of how to project the labels through BERT tokenization.

jacobdevlin-google avatar Nov 24 '18 01:11 jacobdevlin-google

@jacobdevlin-google it would be nice to detail this approach in a specific tutorial.

loretoparisi avatar Nov 27 '18 10:11 loretoparisi

@jacobdevlin-google I don't see any DataProcessor examples in run_pretraining.py. I think you meant in run_classifier.py, am I wrong?

simonefrancia avatar Nov 27 '18 11:11 simonefrancia