Erlangshen Roberta 110 M Sentiment

IDEA-CCNL

Introduction

Erlangshen-Roberta-110M-Sentiment is a fine-tuned version of the Chinese RoBERTa-wwm-ext-base model tailored for sentiment analysis tasks. It has been optimized using several sentiment analysis datasets in Chinese.

Architecture

The model is constructed on the Chinese RoBERTa-wwm-ext-base framework. It is fine-tuned on eight distinct Chinese sentiment analysis datasets, comprising a total of 227,347 samples, to enhance its sentiment prediction capabilities.

Training

The Erlangshen-Roberta-110M-Sentiment model underwent fine-tuning on various sentiment analysis datasets. Performance metrics in different datasets show high accuracy, such as 97.77% on ASAP-SENT and 96.61% on ChnSentiCorp.

Guide: Running Locally

To run the model locally, follow these steps:

  1. Install Dependencies: Ensure you have Python installed, and then install the necessary packages using pip:

    pip install transformers torch
    
  2. Load the Model and Tokenizer:

    from transformers import BertForSequenceClassification, BertTokenizer
    import torch
    
    tokenizer = BertTokenizer.from_pretrained('IDEA-CCNL/Erlangshen-Roberta-110M-Sentiment')
    model = BertForSequenceClassification.from_pretrained('IDEA-CCNL/Erlangshen-Roberta-110M-Sentiment')
    
  3. Use the Model for Sentiment Analysis:

    text = '今天心情不好'
    output = model(torch.tensor([tokenizer.encode(text)]))
    print(torch.nn.functional.softmax(output.logits, dim=-1))
    
  4. Cloud GPU Suggestion: For better performance, consider using cloud GPU services such as AWS EC2, Google Cloud Platform, or Azure.

License

The Erlangshen-Roberta-110M-Sentiment model is licensed under the Apache-2.0 License, allowing for free use, modification, and distribution.

More Related APIs in Text Classification