scibert icon indicating copy to clipboard operation
scibert copied to clipboard

How to apply sciBERT on binary classification in PyTorch

Open JiayuanDing100 opened this issue 4 years ago • 5 comments

Hi Thanks for your awesome work of domain BERT model. I just tried the pre-trained BERT in PyTorch for binary classification using this link. https://medium.com/swlh/a-simple-guide-on-using-bert-for-text-classification-bbf041ac8d04

Is there any simple tutorial for SciBert on binary classification in PyTorch? Thanks

JiayuanDing100 avatar Mar 30 '20 04:03 JiayuanDing100

@JiayuanDing100 were you able to get any inputs?

amandalmia14 avatar Sep 23 '20 08:09 amandalmia14

You would follow the same recipe except replacing bert-base-cased with one of the scibert models, allenai/scibert_scivocab_uncased for example.

Side note, you might find better trainers in the HF examples https://github.com/huggingface/transformers/tree/master/examples/text-classification. The blog post is a little outdated.

ibeltagy avatar Sep 24 '20 04:09 ibeltagy

Thanks a lot @ibeltagy

amandalmia14 avatar Sep 24 '20 16:09 amandalmia14

Can you please explain how can i replace bert with scibert for BERT_FOR_SEQUENCE_CLASSIFICATION ?

jaihonikhil avatar Dec 10 '20 09:12 jaihonikhil

@jaihonikhil You could utilize the AutoModel and call SciBert using AutoModel.from_pretrained('allenai/scibert_scivocab_uncased'). Then have a linear layer for sequence classification just like any other bert model.

adeepH avatar Dec 31 '20 16:12 adeepH