txlm roberta hindi sentiment
LondonStoryIntroduction
The T-XLM-RoBERTa-Hindi-Sentiment model is a sentiment classifier for the Hindi language, fine-tuned from the Twitter-XLM-RoBERTa-base model by Cardiff-NLP. It is specifically designed to work with text in the Devanagari script.
Architecture
This model is based on the XLM-RoBERTa architecture, which is a transformer model pre-trained on a large multilingual corpus. The Hindi sentiment model adapts this architecture for the specific task of sentiment analysis in the Hindi language.
Training
The model is trained on a publicly available Hindi language dataset, which includes 6807 training examples, 1634 testing examples, and 635 validation examples. The dataset is accessible through its GitHub repository here. The model achieved a weighted average macro F1-score of 0.89. Additional details, including a confusion matrix, are available in the associated Google Colab notebook.
Guide: Running Locally
-
Set Up Environment: Ensure you have Python and PyTorch installed. It's recommended to create a virtual environment for isolation.
-
Install Dependencies:
pip install transformers torch
-
Download the Model: Use the Hugging Face Transformers library to load the model.
from transformers import AutoModelForSequenceClassification, AutoTokenizer tokenizer = AutoTokenizer.from_pretrained("LondonStory/txlm-roberta-hindi-sentiment") model = AutoModelForSequenceClassification.from_pretrained("LondonStory/txlm-roberta-hindi-sentiment")
-
Run Inference: Tokenize your input text and pass it to the model for sentiment prediction.
-
Consider Cloud GPUs: For improved performance, especially with larger datasets or batch sizes, consider using cloud-based GPU services such as AWS, Google Cloud, or Azure.
License
The model is released under the MIT License, allowing for wide usage and modification with minimal restrictions.