Downloads · 30 days
14
2% of all-time downloads
Lowerated/deberta-v3-lm6
deberta-v3-lm6 is a text classification model from Lowerated. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
Model Name: Lowerated/deberta-v3-lm6 Model Type: Text Classification (Aspect-Based Sentiment Analysis) Language: English Framework: PyTorch License: Apache 2.0
Downloads · 30 days
14
2% of all-time downloads
All-time downloads
713
Public
Parameters
142M
570 MB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors568 MB · 98%
From the Hugging Face model README
Model Name: Lowerated/deberta-v3-lm6
Model Type: Text Classification (Aspect-Based Sentiment Analysis)
Language: English
Framework: PyTorch
License: Apache 2.0
Lowerated/deberta-v3-lm6 is a DeBERTa-v3-based model fine-tuned for aspect-based sentiment analysis on IMDb movie reviews. The model is designed to classify sentiments across seven key aspects of filmmaking: Cinematography, Direction, Story, Characters, Production Design, Unique Concept, and Emotions.
Dataset Name: Lowerated/imdb-reviews-rated
Dataset URL: IMDb Reviews Rated
Dataset Description: The dataset contains IMDb movie reviews with sentiment scores for seven aspects of filmmaking. Each review is labeled with sentiment scores for Cinematography, Direction, Story, Characters, Production Design, Unique Concept, and Emotions.
Install lowerated:
pip install lowerated
Now, you can use it like this:
from lowerated.rate.entity import Entity
# Example usage
if __name__ == "__main__":
some_movie_reviews = [
"bad movie!", "worse than other movies.", "bad.",
"best movie", "very good movie", "the cinematography was insane",
"story was so beautiful", "the emotional element was missing but cinematography was great",
"didn't feel a thing watching this",
"oooof, eliot and jessie were so good. the casting was the best",
"yo who designed the set, that was really good",
"such stories are rare to find"
]
# Create entity object (loads the whole pipeline)
# list of aspects. ('Cinematography', 'Direction', 'Story', 'Characters', 'Production Design', 'Unique Concept', 'Emotions')
entity = Entity(name="Movie")
rating = entity.rate(reviews=some_movie_reviews)
print("LM6: ", rating["LM6"])
import torch
from transformers import DebertaV2ForSequenceClassification, DebertaV2Tokenizer
# Load the fine-tuned model and tokenizer
model = DebertaV2ForSequenceClassification.from_pretrained('Lowerated/deberta-v3-lm6')
tokenizer = DebertaV2Tokenizer.from_pretrained('Lowerated/deberta-v3-lm6')
# Ensure the model is in evaluation mode
model.eval()
# Define the label mapping
label_columns = ['Cinematography', 'Direction', 'Story', 'Characters', 'Production Design', 'Unique Concept', 'Emotions']
# Function for predicting sentiment scores
def predict_sentiment(review):
# Tokenize the input review
inputs = tokenizer(review, return_tensors='pt', truncation=True, padding=True)
# Disable gradient calculations for inference
with torch.no_grad():
# Get model outputs
outputs = model(**inputs)
# Get the prediction logits
predictions = outputs.logits.squeeze().detach().numpy()
return predictions
# Function to print predictions with labels
def print_predictions(review, predictions):
print(f"Review: {review}")
for label, score in zip(label_columns, predictions):
print(f"{label}: {score:.2f}")
review = "The cinematography was stunning, but the story was weak."
predictions = predict_sentiment(review)
print_predictions(review, predictions)
Evaluation Metric: Mean Squared Error (MSE)
MSE: 0.08594679832458496
Cinematography:
Direction:
Story:
Characters:
Production Design:
Unique Concept:
Emotions:
Test Results:
This model is intended for rating of movies across seven aspects of filmmaking. It can be used to provide a more nuanced understanding of viewer opinions and improve movie rating systems.
While the model performs well on the evaluation dataset, its performance may vary on different datasets. Continuous monitoring and retraining with diverse data are recommended to maintain and improve its accuracy.
Future improvements could focus on exploring alternative methods for handling neutral values, investigating advanced techniques for addressing missing ratings, enhancing sentiment analysis methods, and expanding the range of aspects analyzed.
If you use this model in your research, please cite it as follows:
@model{lowerated_deberta-v3-lm6,
author = {LOWERATED},
title = {deberta-v3-lm6},
year = {2024},
url = {https://huggingface.co/Lowerated/deberta-v3-lm6},
}