Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# RoBert Emotion Classifier
|
| 2 |
-
PyTorch model trained for classification on XYZ dataset.
|
| 3 |
-
Save format: state_dict
|
| 4 |
-
To load: import Model_class and load state dict.
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
from huggingface_hub import hf_hub_download
|
| 8 |
import torch
|
| 9 |
-
from
|
| 10 |
|
| 11 |
-
# Download model weights from HuggingFace
|
| 12 |
model_path = hf_hub_download(repo_id="aadhi3/RoBert_Model", filename="model.pth")
|
| 13 |
|
| 14 |
-
model =
|
| 15 |
model.load_state_dict(torch.load(model_path, map_location="cpu"))
|
| 16 |
model.eval()
|
| 17 |
```
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: pytorch
|
| 3 |
+
tags:
|
| 4 |
+
- emotion-classification
|
| 5 |
+
- roberta
|
| 6 |
+
- deep-learning
|
| 7 |
+
- transformer
|
| 8 |
+
license: apache-2.0
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
# RoBert Emotion Classifier
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
PyTorch model trained for emotion classification on XYZ dataset.
|
| 14 |
+
Saved format: `state_dict`.
|
| 15 |
+
|
| 16 |
+
## 🔧 How to Load the Model
|
| 17 |
+
```python
|
| 18 |
from huggingface_hub import hf_hub_download
|
| 19 |
import torch
|
| 20 |
+
from BertEmotionClassifier import BertEmotionClassifier
|
| 21 |
|
|
|
|
| 22 |
model_path = hf_hub_download(repo_id="aadhi3/RoBert_Model", filename="model.pth")
|
| 23 |
|
| 24 |
+
model = BertEmotionClassifier(num_labels=5)
|
| 25 |
model.load_state_dict(torch.load(model_path, map_location="cpu"))
|
| 26 |
model.eval()
|
| 27 |
```
|