Update README.md
Browse files
README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
library_name: transformers
|
3 |
license: mit
|
4 |
datasets:
|
5 |
-
- ajaykarthick/imdb-movie-reviews
|
6 |
language:
|
7 |
- en
|
8 |
metrics:
|
@@ -13,197 +13,96 @@ base_model:
|
|
13 |
- distilbert/distilbert-base-uncased-finetuned-sst-2-english
|
14 |
---
|
15 |
|
16 |
-
# Model Card for
|
17 |
-
|
18 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
19 |
-
|
20 |
|
|
|
21 |
|
22 |
## Model Details
|
23 |
|
24 |
### Model Description
|
25 |
|
26 |
-
|
27 |
|
28 |
-
|
29 |
|
30 |
-
-
|
31 |
-
|
32 |
-
-
|
33 |
-
-
|
34 |
-
-
|
35 |
-
- **License:** MIT
|
36 |
-
- **Finetuned from model [optional]:** DistilBERT
|
37 |
|
38 |
-
### Model Sources
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
- **Repository:** [More Information Needed]
|
43 |
-
- **Paper [optional]:** [More Information Needed]
|
44 |
-
- **Demo [optional]:** [More Information Needed]
|
45 |
|
46 |
## Uses
|
47 |
|
48 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
49 |
-
|
50 |
### Direct Use
|
51 |
|
52 |
-
|
53 |
|
54 |
-
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
59 |
-
|
60 |
-
[More Information Needed]
|
61 |
|
62 |
### Out-of-Scope Use
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
67 |
|
68 |
## Bias, Risks, and Limitations
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
|
74 |
### Recommendations
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
|
|
|
79 |
|
80 |
## How to Get Started with the Model
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
[More Information Needed]
|
85 |
-
|
86 |
-
## Training Details
|
87 |
-
|
88 |
-
### Training Data
|
89 |
-
|
90 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
91 |
-
|
92 |
-
[More Information Needed]
|
93 |
-
|
94 |
-
### Training Procedure
|
95 |
-
|
96 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
97 |
-
|
98 |
-
#### Preprocessing [optional]
|
99 |
-
|
100 |
-
[More Information Needed]
|
101 |
-
|
102 |
-
|
103 |
-
#### Training Hyperparameters
|
104 |
-
|
105 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
106 |
-
|
107 |
-
#### Speeds, Sizes, Times [optional]
|
108 |
-
|
109 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
110 |
-
|
111 |
-
[More Information Needed]
|
112 |
-
|
113 |
-
## Evaluation
|
114 |
-
|
115 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
116 |
-
|
117 |
-
### Testing Data, Factors & Metrics
|
118 |
-
|
119 |
-
#### Testing Data
|
120 |
-
|
121 |
-
<!-- This should link to a Dataset Card if possible. -->
|
122 |
-
|
123 |
-
[More Information Needed]
|
124 |
-
|
125 |
-
#### Factors
|
126 |
-
|
127 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
128 |
-
|
129 |
-
[More Information Needed]
|
130 |
-
|
131 |
-
#### Metrics
|
132 |
-
|
133 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
134 |
-
|
135 |
-
[More Information Needed]
|
136 |
-
|
137 |
-
### Results
|
138 |
-
|
139 |
-
[More Information Needed]
|
140 |
-
|
141 |
-
#### Summary
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
## Model Examination [optional]
|
146 |
-
|
147 |
-
<!-- Relevant interpretability work for the model goes here -->
|
148 |
-
|
149 |
-
[More Information Needed]
|
150 |
-
|
151 |
-
## Environmental Impact
|
152 |
-
|
153 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
154 |
-
|
155 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
156 |
-
|
157 |
-
- **Hardware Type:** [More Information Needed]
|
158 |
-
- **Hours used:** [More Information Needed]
|
159 |
-
- **Cloud Provider:** [More Information Needed]
|
160 |
-
- **Compute Region:** [More Information Needed]
|
161 |
-
- **Carbon Emitted:** [More Information Needed]
|
162 |
-
|
163 |
-
## Technical Specifications [optional]
|
164 |
-
|
165 |
-
### Model Architecture and Objective
|
166 |
-
|
167 |
-
[More Information Needed]
|
168 |
-
|
169 |
-
### Compute Infrastructure
|
170 |
-
|
171 |
-
[More Information Needed]
|
172 |
-
|
173 |
-
#### Hardware
|
174 |
-
|
175 |
-
[More Information Needed]
|
176 |
-
|
177 |
-
#### Software
|
178 |
-
|
179 |
-
[More Information Needed]
|
180 |
-
|
181 |
-
## Citation [optional]
|
182 |
-
|
183 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
184 |
-
|
185 |
-
**BibTeX:**
|
186 |
-
|
187 |
-
[More Information Needed]
|
188 |
-
|
189 |
-
**APA:**
|
190 |
|
191 |
-
|
|
|
|
|
192 |
|
193 |
-
|
|
|
|
|
|
|
194 |
|
195 |
-
|
|
|
196 |
|
197 |
-
|
198 |
|
199 |
-
|
|
|
|
|
|
|
|
|
200 |
|
201 |
-
|
202 |
|
203 |
-
|
|
|
|
|
|
|
|
|
204 |
|
205 |
-
|
206 |
|
207 |
-
##
|
|
|
208 |
|
209 |
-
|
|
|
2 |
library_name: transformers
|
3 |
license: mit
|
4 |
datasets:
|
5 |
+
- ajaykarthick/imdb-movie-reviews # Assuming this is the dataset you used on HF
|
6 |
language:
|
7 |
- en
|
8 |
metrics:
|
|
|
13 |
- distilbert/distilbert-base-uncased-finetuned-sst-2-english
|
14 |
---
|
15 |
|
16 |
+
# Model Card for distilbert-imdb-sentiment
|
|
|
|
|
|
|
17 |
|
18 |
+
This model is a DistilBERT-based binary sentiment classifier, fine-tuned on the IMDb movie review dataset. It predicts whether a given piece of English text expresses a **Positive** or **Negative** sentiment, specifically optimized for movie review contexts.
|
19 |
|
20 |
## Model Details
|
21 |
|
22 |
### Model Description
|
23 |
|
24 |
+
This is a fine-tuned version of the `distilbert-base-uncased-finetuned-sst-2-english` model, further adapted for binary sentiment classification using the IMDb Large Movie Review Dataset. The base model, DistilBERT, is a smaller, faster, and lighter version of BERT, making this model efficient for inference while retaining strong performance.
|
25 |
|
26 |
+
The model processes input text and outputs logits for two classes: 0 (Negative) and 1 (Positive).
|
27 |
|
28 |
+
- **Developed by:** Anthony Nguyen ([Your GitHub Profile Link, e.g., @DeepAxion])
|
29 |
+
- **Model type:** Text Classification (Sentiment Analysis)
|
30 |
+
- **Language(s) (NLP):** English
|
31 |
+
- **License:** MIT
|
32 |
+
- **Finetuned from model:** `distilbert-base-uncased-finetuned-sst-2-english` (This model was already fine-tuned on SST-2, and we further fine-tuned it on IMDb.)
|
|
|
|
|
33 |
|
34 |
+
### Model Sources
|
35 |
|
36 |
+
- **Repository:** [https://github.com/DeepAxion/distilbert-imdb-sentiment](https://github.com/DeepAxion/distilbert-imdb-sentiment) (Link to your GitHub repo)
|
37 |
+
- **Demo:** [https://huggingface.co/spaces/[Your-Username]/[Your-Space-Name]](https://huggingface.co/spaces/[Your-Username]/[Your-Space-Name]) (If you deploy a Hugging Face Space demo)
|
|
|
|
|
|
|
38 |
|
39 |
## Uses
|
40 |
|
|
|
|
|
41 |
### Direct Use
|
42 |
|
43 |
+
This model is intended for direct use in applications requiring binary sentiment classification of English text, particularly in domains related to movie reviews, literary critiques, or general consumer feedback where a positive/negative distinction is relevant. It can be integrated into web applications, chatbots, data analysis pipelines, or research projects.
|
44 |
|
45 |
+
### Downstream Use
|
46 |
|
47 |
+
This model can serve as a strong baseline for further fine-tuning on highly specific sentiment analysis tasks (e.g., product reviews for a niche industry) or as a component within larger NLP systems (e.g., content moderation, recommender systems, customer support automation).
|
|
|
|
|
|
|
|
|
48 |
|
49 |
### Out-of-Scope Use
|
50 |
|
51 |
+
This model is **not** intended for:
|
52 |
+
- **Multilingual sentiment analysis:** It's trained only on English.
|
53 |
+
- **Sarcasm or irony detection:** While it can infer sentiment, it may struggle with subtle human communication nuances like sarcasm.
|
54 |
+
- **Fine-grained sentiment:** It only provides binary (positive/negative) classification, not granular scores or emotion detection (e.g., joy, anger, sadness).
|
55 |
+
- **Sensitive contexts:** Do not use this model for high-stakes decisions without thorough domain-specific validation and human oversight, especially in areas like medical diagnoses, legal judgments, or financial advice.
|
56 |
+
- **Generating text:** This is a classification model, not a generative model.
|
57 |
|
58 |
## Bias, Risks, and Limitations
|
59 |
|
60 |
+
* **Dataset Bias:** The model's performance and biases are influenced by the IMDb dataset. This dataset is primarily focused on movie reviews and may not generalize perfectly to other domains (e.g., product reviews, news articles) without further fine-tuning. It may also reflect biases present in the original dataset (e.g., demographic biases in movie reviews).
|
61 |
+
* **Language Nuances:** While strong, the model may misinterpret highly nuanced, ambiguous, or context-dependent language.
|
62 |
+
* **Toxic Content:** The model's training on general movie reviews does not guarantee robust performance on identifying or classifying toxic, hateful, or abusive language. Its primary function is sentiment.
|
63 |
|
64 |
### Recommendations
|
65 |
|
66 |
+
Users (both direct and downstream) should be made aware of the risks, biases, and limitations of the model.
|
67 |
+
* **Domain Adaptation:** For optimal performance on text outside of movie reviews, consider further fine-tuning on domain-specific data.
|
68 |
+
* **Human Oversight:** Always incorporate human review for critical applications.
|
69 |
+
* **Bias Auditing:** If deploying in sensitive applications, conduct thorough bias auditing on relevant demographic or linguistic subgroups.
|
70 |
|
71 |
## How to Get Started with the Model
|
72 |
|
73 |
+
You can use this model directly with the Hugging Face `transformers` library.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
+
```python
|
76 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
77 |
+
import torch
|
78 |
|
79 |
+
# Load the model and tokenizer from the Hugging Face Hub
|
80 |
+
model_name = "DeepAxion/distilbert-imdb-sentiment" # REPLACE with your actual model ID
|
81 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
82 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
83 |
|
84 |
+
# Example Inference
|
85 |
+
text = "This movie totally blew me away, absolutely brilliant acting and a fantastic plot!"
|
86 |
|
87 |
+
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
|
88 |
|
89 |
+
with torch.no_grad():
|
90 |
+
outputs = model(**inputs)
|
91 |
+
logits = outputs.logits
|
92 |
+
probabilities = torch.softmax(logits, dim=-1)
|
93 |
+
prediction = torch.argmax(probabilities, dim=-1).item()
|
94 |
|
95 |
+
sentiment_labels = {0: "Negative", 1: "Positive"} # Assuming 0: Negative, 1: Positive
|
96 |
|
97 |
+
print(f"Input Text: \"{text}\"")
|
98 |
+
print(f"Predicted Sentiment: {sentiment_labels[prediction]}")
|
99 |
+
print(f"Confidence (Negative): {probabilities[0][0].item():.4f}")
|
100 |
+
print(f"Confidence (Positive): {probabilities[0][1].item():.4f}")
|
101 |
+
```
|
102 |
|
103 |
+
### Training Details
|
104 |
|
105 |
+
## Training Data
|
106 |
+
The model was fine-tuned on the IMDb Large Movie Review Dataset. This dataset consists of 50,000 highly polar movie reviews (25,000 for training, 25,000 for testing), labeled as either positive or negative. Reviews with a score of <= 4 out of 10 are labeled negative, and those with a score of >= 7 out of 10 are labeled positive.
|
107 |
|
108 |
+
Dataset Card: https://huggingface.co/datasets/ajaykarthick/imdb-movie-reviews (or the official IMDb dataset link if different)
|