/ Модель

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

Контекст
1 024 токена
Лицензия
MIT
Архитектура
gpt2 · dense
Библиотека
transformers
Опубликована
28 июн 2023

gpt2-imdb-finetune

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

Модель GPT-2 классифицирует англоязычные отзывы о фильмах как положительные или отрицательные.

157скачиваний за 30 дней0лайковвеса обновлены1 июл 2023

Бенчмарки

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

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

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

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

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

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

hipnologo/gpt2-imdb-finetune — модель на основе GPT-2, дообученная для бинарного анализа тональности англоязычных отзывов о фильмах из набора IMDb. Она относит текст отзыва к положительному или отрицательному классу и подходит для автоматической классификации отзывов и оценки общего отношения автора к фильму. Архитектура — плотная GPT-2 для классификации последовательностей; модель работает с текстом и имеет контекст до 1024 токенов. В README приведены результаты оценки на тестовой выборке IMDb: точность 0,94064 и F1 0,94104.

Модель предназначена для англоязычных отзывов о фильмах; README предостерегает от использования для других языков и текстов с неоднозначной тональностью. Репозиторий распространяется по лицензии MIT.

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

  • Определение тональности отзыва о фильме
  • Разделение отзывов IMDb на положительные и отрицательные
  • Подсчёт доли положительных отзывов о фильме
  • Автоматическая сортировка отзывов по тональности

Ограничения

Модель рассчитана на английские отзывы о фильмах и может ошибаться на текстах с неоднозначной тональностью. Не предназначена для других языков.

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

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

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

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

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

Открыть на Hugging Face

Fine-tuned GPT-2 Model for IMDb Movie Review Sentiment Analysis

Model Description

This is a GPT-2 model fine-tuned on the IMDb movie review dataset for sentiment analysis. It classifies a movie review text into two classes: "positive" or "negative".

Intended Uses & Limitations

This model is intended to be used for binary sentiment analysis of English movie reviews. It can determine whether a review is positive or negative. It should not be used for languages other than English, or for text with ambiguous sentiment.

How to Use

Here's a simple way to use this model:

from transformers import GPT2Tokenizer, GPT2ForSequenceClassification

tokenizer = GPT2Tokenizer.from_pretrained("hipnologo/gpt2-imdb-finetune")
model = GPT2ForSequenceClassification.from_pretrained("hipnologo/gpt2-imdb-finetune")

text = "Your review text here!"

# encoding the input text
input_ids = tokenizer.encode(text, return_tensors="pt")

# Move the input_ids tensor to the same device as the model
input_ids = input_ids.to(model.device)

# getting the logits 
logits = model(input_ids).logits

# getting the predicted class
predicted_class = logits.argmax(-1).item()

print(f"The sentiment predicted by the model is: {'Positive' if predicted_class == 1 else 'Negative'}")

Training Procedure

The model was trained using the 'Trainer' class from the transformers library, with a learning rate of 2e-5, batch size of 1, and 3 training epochs.

Evaluation

The fine-tuned model was evaluated on the test dataset. Here are the results:

  • Evaluation Loss: 0.23127
  • Evaluation Accuracy: 0.94064
  • Evaluation F1 Score: 0.94104
  • Evaluation Precision: 0.93466
  • Evaluation Recall: 0.94752

The evaluation metrics suggest that the model has a high accuracy and good precision-recall balance for the task of sentiment classification.

How to Reproduce

The evaluation results can be reproduced by loading the model and the tokenizer from Hugging Face Model Hub and then running the model on the evaluation dataset using the Trainer class from the Transformers library, with the compute_metrics function defined as above.

The evaluation loss is the cross-entropy loss of the model on the evaluation dataset, a measure of how well the model's predictions match the actual labels. The closer this is to zero, the better.

The evaluation accuracy is the proportion of predictions the model got right. This number is between 0 and 1, with 1 meaning the model got all predictions right.

The F1 score is a measure of a test's accuracy that considers both precision (the number of true positive results divided by the number of all positive results) and recall (the number of true positive results divided by the number of all samples that should have been identified as positive). An F1 score reaches its best value at 1 (perfect precision and recall) and worst at 0.

The evaluation precision is how many of the positively classified were actually positive. The closer this is to 1, the better.

The evaluation recall is how many of the actual positives our model captured through labeling it as positive. The closer this is to 1, the better.

Fine-tuning Details

The model was fine-tuned using the IMDb movie review dataset.

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

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

GPU в ailist

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

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

Подбираем GPU…

Класс архитектуры
GPT2ForSequenceClassification
Ревизия весов
0e4a8a1

0 моделей