ongaunjie commited on
Commit
ebfb356
1 Parent(s): 3580d92

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +16 -8
README.md CHANGED
@@ -1,5 +1,6 @@
1
  ---
2
  language: en
 
3
  ---
4
 
5
  # Women's Clothing Reviews Sentiment Analysis with DistilBERT
@@ -11,25 +12,27 @@ This Hugging Face repository contains a fine-tuned DistilBERT model for sentimen
11
  ## Model Details
12
 
13
  - **Model Architecture**: Fine-tuned DistilBERT
14
- - **Sentiment Categories**: Neutral[0], Negative[1], Positive[2]
15
  - **Input Format**: Text-based clothing reviews
16
  - **Output Format**: Sentiment category labels
17
 
18
- ## Usage
19
 
 
 
 
 
 
20
  ## Installation
21
 
22
  To use this model, you'll need to install the Hugging Face Transformers library and any additional dependencies.
 
 
23
 
24
- ```bash
25
- pip install transformers
26
- pip install torch
27
 
28
- Usage
29
  You can easily load the pre-trained model for sentiment analysis using Hugging Face's DistilBertForSequenceClassification and DistilBertTokenizerFast.
30
 
31
- python
32
- Copy code
33
  from transformers import DistilBertForSequenceClassification, DistilBertTokenizerFast
34
  import torch
35
 
@@ -37,3 +40,8 @@ model_name = "ongaunjie/distilbert-cloths-sentiment"
37
  tokenizer = DistilBertTokenizerFast.from_pretrained(model_name)
38
  model = DistilBertForSequenceClassification.from_pretrained(model_name)
39
 
 
 
 
 
 
 
1
  ---
2
  language: en
3
+ license: apache-2.0
4
  ---
5
 
6
  # Women's Clothing Reviews Sentiment Analysis with DistilBERT
 
12
  ## Model Details
13
 
14
  - **Model Architecture**: Fine-tuned DistilBERT
15
+ - **Sentiment Categories**: Neutral [0], Negative [1], Positive [2]
16
  - **Input Format**: Text-based clothing reviews
17
  - **Output Format**: Sentiment category labels
18
 
 
19
 
20
+ ## Training result
21
+ It achieves the following results on the evaluation set:
22
+ - **Validation Loss**: 1.1677
23
+
24
+
25
  ## Installation
26
 
27
  To use this model, you'll need to install the Hugging Face Transformers library and any additional dependencies.
28
+ - **pip install transformers**
29
+ - **pip install torch**
30
 
 
 
 
31
 
32
+ ## Usage
33
  You can easily load the pre-trained model for sentiment analysis using Hugging Face's DistilBertForSequenceClassification and DistilBertTokenizerFast.
34
 
35
+ ```bash
 
36
  from transformers import DistilBertForSequenceClassification, DistilBertTokenizerFast
37
  import torch
38
 
 
40
  tokenizer = DistilBertTokenizerFast.from_pretrained(model_name)
41
  model = DistilBertForSequenceClassification.from_pretrained(model_name)
42
 
43
+ review = "This dress is amazing, I love it!"
44
+ inputs = tokenizer.encode(review, return_tensors="pt")
45
+ with torch.no_grad():
46
+ outputs = model(inputs)
47
+ predicted_class = int(torch.argmax(outputs.logits))