transformers icon indicating copy to clipboard operation
transformers copied to clipboard

How do you train custom corpus with bert?

Open shadylpstan opened this issue 7 years ago • 5 comments

I am using a domain specific dataset for text classification. But major of my data points are treated with [UNK] token in Bert.

Can I please get help on how to keep my custom corpus tokens?

shadylpstan avatar Apr 03 '19 05:04 shadylpstan

Maybe it's a problem of not setting do_lower_case=False and using a cased model like in #436. Which pretrained model are you using?

thomwolf avatar Apr 03 '19 09:04 thomwolf

@thomwolf sorry but this is completely not what I am asking for. Suppose I have medical data and the names of the medicines and diseases are not in the bert pre-trained corpus. So bert gives me [UNK] token for important medical terms. How can I train it on my custom data?

Using lower cased multilingual pre-trained model.

PS: Medical data was just an example.

shadylpstan avatar Apr 03 '19 10:04 shadylpstan

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 02 '19 12:06 stale[bot]

Hi, I'm also facing similar issue plz let me know if you have found any solution @shadylpstan

nikhilvishwanath avatar Jul 19 '19 08:07 nikhilvishwanath

Hi, I'm also facing similar issue plz let me know if you have found any solution @shadylpstan

I was successful in modifying a couple of bert files and train it using my corpus. Though it was really a mess doing so because by default bert has a classification model of a certain number of classes. The accuracy wasn't good enough. So no idea it is a worth giving it shot from your end.

shadylpstan avatar Jul 19 '19 20:07 shadylpstan