File size: 4,947 Bytes
9fa4213 cd4bc10 b269c93 cd4bc10 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
---
license: apache-2.0
datasets:
- Lowerated/lm6-movies-reviews-aspects
language:
- en
metrics:
- accuracy
pipeline_tag: text-classification
tags:
- movies
- reviews
- lm6
- ai
- rating
---
# Lowerated/lm6-movie-aspect-extraction-bert
## Model Details
**Model Name:** Lowerated/lm6-movie-aspect-extraction-bert
**Model Type:** Aspects Extraction from Text
**Language:** English
**Framework:** PyTorch
**License:** Apache 2.0
## Model Description
Lowerated/lm6-movie-aspect-extraction-bert is a bert-base-uncased model fine-tuned for aspects extraction from IMDb movie reviews. The model is designed to detect aspects of filmmaking: Cinematography, Direction, Story, Characters, Production Design, Unique Concept, and Emotions.
## Dataset
**Dataset Name:** Lowerated/imdb-reviews-rated
**Dataset URL:** [IMDb Reviews Rated](https://huggingface.co/datasets/LOWERATED/imdb-reviews-rated)
**Dataset Description:** The dataset contains IMDb movie reviews with sentiment scores for seven aspects of filmmaking.
## Usage for Rating a Movie
Install lowerated:
```
pip install lowerated
```
Now, you can use it like this:
```python
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"])
```
## Usage of Model
```python
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)
```
## Performance
```json
{
'eval_loss': 0.04379426687955856,
'eval_model_preparation_time': 0.0016,
'eval_accuracy': 0.9845067801235796,
'eval_f1': 0.7419,
'eval_precision': 0.6831499999999999,
'eval_recall': 0.86185,
'eval_runtime': 2014.0076,
'eval_samples_per_second': 29.451,
'eval_steps_per_second': 3.682
}
```
## Example:
```
original review: the story was amazing but the cinematography wasn't it
Cinematography: ["the cinematography wasn't"]
Direction: []
Story: ['the story was amazing']
Characters: []
Production Design: []
Unique Concept: []
Emotions: []
```
## Intended Use
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.
## Limitations
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 Work
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.
## Citation
If you use this model in your research, please cite it as follows:
```bibtex
@model{lm6-movie-aspect-extraction-bert,
author = {LOWERATED},
title = {lm6-movie-aspect-extraction-bert},
year = {2024},
url = {https://huggingface.coLowerated/lm6-movie-aspect-extraction-bert},
}
```
|