/ Модель

Характеристики

Контекст
512 токенов
Лицензия
Apache 2.0
Архитектура
distilbert · dense
Базовая модель
distilbert-base-uncased
Опубликована
23 июл 2024

robust-sentiment-analysis

Классификация текстаТекст → label5 профессий

Англоязычная модель на DistilBERT для оценки тональности текста по пяти категориям от очень негативной до очень позитивной.

1 449скачиваний за 30 дней24лайкавеса обновлены28 июл 2025

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

TabularisAI разработала англоязычную модель анализа тональности на основе DistilBERT, дообученную для классификации текста. Она относит текст к одному из пяти классов: «очень негативный», «негативный», «нейтральный», «позитивный» и «очень позитивный». Модель подходит для анализа публикаций в социальных сетях, отзывов о товарах и обратной связи клиентов, а также для мониторинга брендов и изучения рынка.

Обучение проводилось только на синтетических данных. Модель использует архитектуру DistilBERT для классификации последовательностей, принимает текст с контекстом до 512 токенов и распространяется по лицензии Apache-2.0. Авторы сообщают об улучшении точности и снижении частоты ошибок в обновлении от декабря 2024 года, но в карточке нет численных результатов оценки; возможны смещения, и качество следует проверять на данных конкретной задачи.

Сценарии применения

  • Классификация тональности отзывов о товарах
  • Анализ обратной связи клиентов
  • Мониторинг тональности публикаций в соцсетях
  • Отслеживание отношения аудитории к бренду
  • Анализ мнений о продуктах и рынке

Ограничения

Модель обучена только на синтетических данных, поэтому её качество на реальных текстах и в конкретной предметной области нужно проверять отдельно. Возможны смещения; карточка не приводит численных результатов оценки.

Для каких профессий подходит5

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

🚀 (distil)BERT-based Sentiment Classification Model: Unleashing the Power of Synthetic Data

NEWS!

  • 2024/12: We uploaded an even better and more robust sentiment model! The error rate is reduced by 10%, and overall accuracy is improved!

Model Details

  • Model Name: tabularisai/robust-sentiment-analysis
  • Base Model: distilbert/distilbert-base-uncased
  • Task: Text Classification (Sentiment Analysis)
  • Language: English
  • Number of Classes: 5 (Very Negative, Negative, Neutral, Positive, Very Positive)
  • Usage:
    • Social media analysis
    • Customer feedback analysis
    • Product reviews classification
    • Brand monitoring
    • Market research
    • Customer service optimization
    • Competitive intelligence

Model Description

This model is a fine-tuned version of distilbert/distilbert-base-uncased for sentiment analysis. Trained only on syntethic data.

Training Data

The model was fine-tuned on synthetic data, which allows for targeted training on a diverse range of sentiment expressions without the limitations often found in real-world datasets.

Training Procedure

  • The model was fine-tuned for 5 epochs.
  • Achieved a train_acc_off_by_one (accuracy allowing for predictions off by one class) of approximately 0.95 on the validation dataset.

Intended Use

This model is designed for sentiment analysis tasks, particularly useful for:

  • Social media monitoring
  • Customer feedback analysis
  • Product review sentiment classification
  • Brand sentiment tracking

How to Use

Here's a quick example of how to use the model:

from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

# Load model and tokenizer
model_name = "tabularisai/robust-sentiment-analysis"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)

# Function to predict sentiment
def predict_sentiment(text):
    inputs = tokenizer(text.lower(), return_tensors="pt", truncation=True, padding=True, max_length=512)
    with torch.no_grad():
        outputs = model(**inputs)
    
    probabilities = torch.nn.functional.softmax(outputs.logits, dim=-1)
    predicted_class = torch.argmax(probabilities, dim=-1).item()
    
    sentiment_map = {0: "Very Negative", 1: "Negative", 2: "Neutral", 3: "Positive", 4: "Very Positive"}
    return sentiment_map[predicted_class]

# Example usage
texts = [
    "I absolutely loved this movie! The acting was superb and the plot was engaging.",
    "The service at this restaurant was terrible. I'll never go back.",
    "The product works as expected. Nothing special, but it gets the job done.",
    "I'm somewhat disappointed with my purchase. It's not as good as I hoped.",
    "This book changed my life! I couldn't put it down and learned so much."
]

for text in texts:
    sentiment = predict_sentiment(text)
    print(f"Text: {text}")
    print(f"Sentiment: {sentiment}\n")

Model Performance

The model demonstrates strong performance across various sentiment categories. Here are some example predictions:

1. "I absolutely loved this movie! The acting was superb and the plot was engaging."
   Predicted Sentiment: Very Positive

2. "The service at this restaurant was terrible. I'll never go back."
   Predicted Sentiment: Very Negative

3. "The product works as expected. Nothing special, but it gets the job done."
   Predicted Sentiment: Neutral

4. "I'm somewhat disappointed with my purchase. It's not as good as I hoped."
   Predicted Sentiment: Negative

5. "This book changed my life! I couldn't put it down and learned so much."
   Predicted Sentiment: Very Positive

JS example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Tabularis Sentiment Analysis</title>
</head>
<body>
    <div id="output"></div>

    <script type="module">
        import { AutoTokenizer, AutoModel, env } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers@2.6.0';

        env.allowLocalModels = false;
        env.useCDN = true;

        const MODEL_NAME = 'tabularisai/robust-sentiment-analysis';

        function softmax(arr) {
            const max = Math.max(...arr);
            const exp = arr.map(x => Math.exp(x - max));
            const sum = exp.reduce((acc, val) => acc + val);
            return exp.map(x => x / sum);
        }

        async function analyzeSentiment() {
            try {
                const tokenizer = await AutoTokenizer.from_pretrained(MODEL_NAME);
                const model = await AutoModel.from_pretrained(MODEL_NAME);

                const texts = [
                    "I absolutely loved this movie! The acting was superb and the plot was engaging.",
                    "The service at this restaurant was terrible. I'll never go back.",
                    "The product works as expected. Nothing special, but it gets the job done.",
                    "I'm somewhat disappointed with my purchase. It's not as good as I hoped.",
                    "This book changed my life! I couldn't put it down and learned so much."
                ];

                const output = document.getElementById('output');

                for (const text of texts) {
                    const inputs = await tokenizer(text, { return_tensors: 'pt' });
                    const result = await model(inputs);
                    
                    console.log('Model output:', result);

                    if (result.output && result.output.data) {
                        const logitsArray = Array.from(result.output.data);
                        console.log('Logits array:', logitsArray);

                        const probabilities = softmax(logitsArray);
                        const predicted_class = probabilities.indexOf(Math.max(...probabilities));

                        const sentimentMap = {
                            0: "Very Negative",
                            1: "Negative",
                            2: "Neutral",
                            3: "Positive",
                            4: "Very Positive"
                        };

                        const sentiment = sentimentMap[predicted_class];
                        const score = probabilities[predicted_class];

                        output.innerHTML += `Text: "${text}"<br>`;
                        output.innerHTML += `Sentiment: ${sentiment}, Score: ${score.toFixed(4)}<br><br>`;
                    } else {
                        console.error('Unexpected model output structure:', result);
                        output.innerHTML += `Unable to process: "${text}"<br><br>`;
                    }
                }
            } catch (error) {
                console.error('Error:', error);
                document.getElementById('output').innerHTML = 'An error occurred. Please check the console for details.';
            }
        }

        analyzeSentiment();
    </script>
</body>
</html>

Training Procedure

The model was fine-tuned on synthetic data using the distilbert/distilbert-base-uncased architecture. The training process involved:

  • Dataset: Synthetic data designed to cover a wide range of sentiment expressions
  • Training framework: PyTorch Lightning
  • Number of epochs: 5
  • Performance metric: Achieved train_acc_off_by_one of approximately 0.95 on the validation dataset

Ethical Considerations

While efforts have been made to create a balanced and fair model through the use of synthetic data, users should be aware that the model may still exhibit biases. It's crucial to thoroughly test the model in your specific use case and monitor its performance over time.

Citation

Will be included

Contact

For questions or private and reliable API with out model please contact info@tabularis.ai

tabularis.ai

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · text-classification

Можно запустить

Подбираем GPU…

Класс архитектуры
DistilBertForSequenceClassification
Ревизия весов
c542a28

0 моделей