txlm roberta hindi sentiment

LondonStory

Introduction

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

  1. Set Up Environment: Ensure you have Python and PyTorch installed. It's recommended to create a virtual environment for isolation.

  2. Install Dependencies:

    pip install transformers torch
    
  3. 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")
    
  4. Run Inference: Tokenize your input text and pass it to the model for sentiment prediction.

  5. 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.

More Related APIs in Text Classification