unnir commited on
Commit
6c3ffa5
1 Parent(s): 5ae83ec

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +99 -12
README.md CHANGED
@@ -1,33 +1,120 @@
1
-
2
  ---
3
  language: en
4
  tags:
5
  - text-classification
6
  - sentiment-analysis
 
7
  ---
8
 
9
- # Model Card for Your Model
10
 
11
  ## Model Details
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
- This model is a fine-tuned version of {ModuleConfig.model_name} for sentiment analysis.
 
 
 
14
 
15
  ## Intended Use
16
 
17
- This model is intended for sentiment classification tasks.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
- ## Training Data
20
 
21
- The model was trained on a custom dataset for sentiment analysis.
22
 
23
- ## Performance
 
 
 
 
24
 
25
- [Include any performance metrics here]
26
 
27
- ## Limitations
28
 
29
- [Describe any known limitations of the model]
 
 
 
30
 
31
- ## Additional Information
32
 
33
- For more information, please visit [your project link or contact information].
 
 
1
  ---
2
  language: en
3
  tags:
4
  - text-classification
5
  - sentiment-analysis
6
+ license: apache-2.0
7
  ---
8
 
9
+ # BERT-based Sentiment Classification Model
10
 
11
  ## Model Details
12
+ - **Model Name:** tabularisai/bert-base-uncased-sentiment-five-classes
13
+ - **Base Model:** bert-base-uncased
14
+ - **Task:** Text Classification (Sentiment Analysis)
15
+ - **Language:** English
16
+
17
+ ## Model Description
18
+
19
+ This model is a fine-tuned version of `bert-base-uncased` for sentiment analysis. It classifies text into five sentiment categories: Very Negative, Negative, Neutral, Positive, and Very Positive.
20
+
21
+ ### Training Data
22
+
23
+ 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. This approach enables the model to learn nuanced sentiment patterns across various contexts.
24
 
25
+ ### Training Procedure
26
+
27
+ - The model was fine-tuned for 5 epochs.
28
+ - Achieved a train_acc_off_by_one (accuracy allowing for predictions off by one class) of approximately *0.95* on the validation dataset.
29
 
30
  ## Intended Use
31
 
32
+ This model is designed for sentiment analysis tasks, particularly useful for:
33
+ - Social media monitoring
34
+ - Customer feedback analysis
35
+ - Product review sentiment classification
36
+ - Brand sentiment tracking
37
+
38
+ ## How to Use
39
+
40
+ Here's a quick example of how to use the model:
41
+
42
+ ```python
43
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
44
+ import torch
45
+
46
+ # Load model and tokenizer
47
+ model_name = "tabularisai/bert-base-uncased-sentiment-five-classes"
48
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
49
+ model = AutoModelForSequenceClassification.from_pretrained(model_name)
50
+
51
+ # Function to predict sentiment
52
+ def predict_sentiment(text):
53
+ inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=512)
54
+ with torch.no_grad():
55
+ outputs = model(**inputs)
56
+
57
+ probabilities = torch.nn.functional.softmax(outputs.logits, dim=-1)
58
+ predicted_class = torch.argmax(probabilities, dim=-1).item()
59
+
60
+ sentiment_map = {0: "Very Negative", 1: "Negative", 2: "Neutral", 3: "Positive", 4: "Very Positive"}
61
+ return sentiment_map[predicted_class]
62
+
63
+ # Example usage
64
+ texts = [
65
+ "I absolutely loved this movie! The acting was superb and the plot was engaging.",
66
+ "The service at this restaurant was terrible. I'll never go back.",
67
+ "The product works as expected. Nothing special, but it gets the job done.",
68
+ "I'm somewhat disappointed with my purchase. It's not as good as I hoped.",
69
+ "This book changed my life! I couldn't put it down and learned so much."
70
+ ]
71
+
72
+ for text in texts:
73
+ sentiment = predict_sentiment(text)
74
+ print(f"Text: {text}")
75
+ print(f"Sentiment: {sentiment}\n")
76
+ ```
77
+
78
+ ## Model Performance
79
+
80
+ The model demonstrates strong performance across various sentiment categories. Here are some example predictions:
81
+ ```
82
+ 1. "I absolutely loved this movie! The acting was superb and the plot was engaging."
83
+ Predicted Sentiment: Very Positive
84
+
85
+ 2. "The service at this restaurant was terrible. I'll never go back."
86
+ Predicted Sentiment: Very Negative
87
+
88
+ 3. "The product works as expected. Nothing special, but it gets the job done."
89
+ Predicted Sentiment: Neutral
90
+
91
+ 4. "I'm somewhat disappointed with my purchase. It's not as good as I hoped."
92
+ Predicted Sentiment: Negative
93
+
94
+ 5. "This book changed my life! I couldn't put it down and learned so much."
95
+ Predicted Sentiment: Very Positive
96
+ ```
97
+
98
 
99
+ ## Training Procedure
100
 
101
+ The model was fine-tuned on synthetic data using the `bert-base-uncased` architecture. The training process involved:
102
 
103
+ - Dataset: Synthetic data designed to cover a wide range of sentiment expressions
104
+ - Training framework: PyTorch Lightning
105
+ - Number of epochs: 5
106
+ - Performance metric: Achieved train_acc_off_by_one of approximately 0.95 on the validation dataset
107
+ - Hardware: [Specify the hardware used for training]
108
 
109
+ ## Ethical Considerations
110
 
111
+ 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.
112
 
113
+ ## Citation
114
+ ```
115
+ Will be included
116
+ ```
117
 
118
+ ## Contact
119
 
120
+ For questions, feedback, or issues related to this model, please [provide contact information or link to issue tracker].