Update README.md
Browse files
README.md
CHANGED
@@ -23,29 +23,8 @@ To use this model, you'll need to install the Hugging Face Transformers library
|
|
23 |
|
24 |
```bash
|
25 |
pip install transformers
|
|
|
26 |
|
27 |
-
|
28 |
-
|
29 |
You can easily load the pre-trained model for sentiment analysis using Hugging Face's AutoModelForSequenceClassification.
|
30 |
|
31 |
-
```python
|
32 |
-
from transformers import DistilBertForSequenceClassification, DistilBertTokenizerFast
|
33 |
-
import torch
|
34 |
-
|
35 |
-
model_name = "ongaunjie/distilbert-cloths-sentiment"
|
36 |
-
tokenizer = DistilBertTokenizerFast.from_pretrained(model_name)
|
37 |
-
model = DistilBertForSequenceClassification.from_pretrained(model_name)
|
38 |
-
|
39 |
-
## Inference
|
40 |
-
You can use this model to perform sentiment analysis on text. Here's an example of how to do it in Python:
|
41 |
-
|
42 |
-
```python
|
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))
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
23 |
|
24 |
```bash
|
25 |
pip install transformers
|
26 |
+
pip install torch
|
27 |
|
28 |
+
## Model Loading
|
|
|
29 |
You can easily load the pre-trained model for sentiment analysis using Hugging Face's AutoModelForSequenceClassification.
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|