wisalkhanmv commited on
Commit
cd4bc10
1 Parent(s): 7fc662e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +141 -1
README.md CHANGED
@@ -13,4 +13,144 @@ tags:
13
  - lm6
14
  - ai
15
  - rating
16
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  - lm6
14
  - ai
15
  - rating
16
+ ---
17
+
18
+ # Lowerated/lm6-movie-aspect-extraction-bert
19
+
20
+ ## Model Details
21
+ **Model Name:** Lowerated/lm6-movie-aspect-extraction-bert
22
+ **Model Type:** Aspects Extraction from Text
23
+ **Language:** English
24
+ **Framework:** PyTorch
25
+ **License:** Apache 2.0
26
+
27
+ ## Model Description
28
+ 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.
29
+
30
+ ## Dataset
31
+ **Dataset Name:** Lowerated/imdb-reviews-rated
32
+ **Dataset URL:** [IMDb Reviews Rated](https://huggingface.co/datasets/LOWERATED/imdb-reviews-rated)
33
+ **Dataset Description:** The dataset contains IMDb movie reviews with sentiment scores for seven aspects of filmmaking.
34
+
35
+ ## Usage for Rating a Movie
36
+
37
+ Install lowerated:
38
+ ```
39
+ pip install lowerated
40
+ ```
41
+
42
+ Now, you can use it like this:
43
+ ```python
44
+ from lowerated.rate.entity import Entity
45
+
46
+ # Example usage
47
+ if __name__ == "__main__":
48
+ some_movie_reviews = [
49
+ "bad movie!", "worse than other movies.", "bad.",
50
+ "best movie", "very good movie", "the cinematography was insane",
51
+ "story was so beautiful", "the emotional element was missing but cinematography was great",
52
+ "didn't feel a thing watching this",
53
+ "oooof, eliot and jessie were so good. the casting was the best",
54
+ "yo who designed the set, that was really good",
55
+ "such stories are rare to find"
56
+ ]
57
+
58
+ # Create entity object (loads the whole pipeline)
59
+ # list of aspects. ('Cinematography', 'Direction', 'Story', 'Characters', 'Production Design', 'Unique Concept', 'Emotions')
60
+ entity = Entity(name="Movie")
61
+
62
+ rating = entity.rate(reviews=some_movie_reviews)
63
+
64
+ print("LM6: ", rating["LM6"])
65
+ ```
66
+
67
+ ## Usage of Model
68
+ ```python
69
+ import torch
70
+ from transformers import DebertaV2ForSequenceClassification, DebertaV2Tokenizer
71
+
72
+ # Load the fine-tuned model and tokenizer
73
+ model = DebertaV2ForSequenceClassification.from_pretrained('Lowerated/deberta-v3-lm6')
74
+ tokenizer = DebertaV2Tokenizer.from_pretrained('Lowerated/deberta-v3-lm6')
75
+
76
+ # Ensure the model is in evaluation mode
77
+ model.eval()
78
+
79
+ # Define the label mapping
80
+ label_columns = ['Cinematography', 'Direction', 'Story', 'Characters', 'Production Design', 'Unique Concept', 'Emotions']
81
+
82
+ # Function for predicting sentiment scores
83
+ def predict_sentiment(review):
84
+ # Tokenize the input review
85
+ inputs = tokenizer(review, return_tensors='pt', truncation=True, padding=True)
86
+
87
+ # Disable gradient calculations for inference
88
+ with torch.no_grad():
89
+ # Get model outputs
90
+ outputs = model(**inputs)
91
+
92
+ # Get the prediction logits
93
+ predictions = outputs.logits.squeeze().detach().numpy()
94
+ return predictions
95
+
96
+ # Function to print predictions with labels
97
+ def print_predictions(review, predictions):
98
+ print(f"Review: {review}")
99
+ for label, score in zip(label_columns, predictions):
100
+ print(f"{label}: {score:.2f}")
101
+
102
+
103
+ review = "The cinematography was stunning, but the story was weak."
104
+ predictions = predict_sentiment(review)
105
+ print_predictions(review, predictions)
106
+
107
+ ```
108
+
109
+ ## Performance
110
+ ```json
111
+ {
112
+ 'eval_loss': 0.04379426687955856,
113
+ 'eval_model_preparation_time': 0.0016,
114
+ 'eval_accuracy': 0.9845067801235796,
115
+ 'eval_f1': 0.7419,
116
+ 'eval_precision': 0.6831499999999999,
117
+ 'eval_recall': 0.86185,
118
+ 'eval_runtime': 2014.0076,
119
+ 'eval_samples_per_second': 29.451,
120
+ 'eval_steps_per_second': 3.682
121
+ }
122
+ ```
123
+
124
+ ## Example:
125
+ ```
126
+ original review: the story was amazing but the cinematography wasn't it
127
+
128
+ Cinematography ["the cinematography wasn't"]
129
+ Direction []
130
+ Story ['the story was amazing']
131
+ Characters []
132
+ Production Design []
133
+ Unique Concept []
134
+ Emotions []
135
+ ```
136
+
137
+ ## Intended Use
138
+ 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.
139
+
140
+ ## Limitations
141
+ 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.
142
+
143
+ ## Future Work
144
+ 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.
145
+
146
+ ## Citation
147
+ If you use this model in your research, please cite it as follows:
148
+
149
+ ```bibtex
150
+ @model{lm6-movie-aspect-extraction-bert,
151
+ author = {LOWERATED},
152
+ title = {lm6-movie-aspect-extraction-bert},
153
+ year = {2024},
154
+ url = {https://huggingface.coLowerated/lm6-movie-aspect-extraction-bert},
155
+ }
156
+ ```