How to do sentiment analysis on my own dataset?

Hi,

I have seen this example, which does sentiment analysis on product reviews.

Therefore, is there a way to do this with my own dataset? I want to classify the sentiment of text as “happy”, “sad” or “neutral” using my own dataset.

Thanks.

You have to define your own torch.utils.data.Dataset and torch.utils.data.DataLoader to load your own labeled text. Then choose an LM like BERT from the huggingface library to finetune.