Upload model
Browse files- config.json +6 -1
- model.py +22 -0
- pytorch_model.bin +3 -0
config.json
CHANGED
@@ -1,6 +1,10 @@
|
|
1 |
{
|
|
|
|
|
|
|
2 |
"auto_map": {
|
3 |
-
"AutoConfig": "config.SentimentConfig"
|
|
|
4 |
},
|
5 |
"class_map": {
|
6 |
"0": "sad",
|
@@ -14,5 +18,6 @@
|
|
14 |
"h1": 44,
|
15 |
"h2": 46,
|
16 |
"model_type": "SententenceTransformerSentimentClassifier",
|
|
|
17 |
"transformers_version": "4.29.0"
|
18 |
}
|
|
|
1 |
{
|
2 |
+
"architectures": [
|
3 |
+
"SententenceTransformerSentimentModel"
|
4 |
+
],
|
5 |
"auto_map": {
|
6 |
+
"AutoConfig": "config.SentimentConfig",
|
7 |
+
"AutoModelForSequenceClassification": "model.SententenceTransformerSentimentModel"
|
8 |
},
|
9 |
"class_map": {
|
10 |
"0": "sad",
|
|
|
18 |
"h1": 44,
|
19 |
"h2": 46,
|
20 |
"model_type": "SententenceTransformerSentimentClassifier",
|
21 |
+
"torch_dtype": "float32",
|
22 |
"transformers_version": "4.29.0"
|
23 |
}
|
model.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from config import SentimentConfig
|
2 |
+
from transformers import PreTrainedModel
|
3 |
+
import torch.nn as nn
|
4 |
+
import torch.nn.functional as F
|
5 |
+
|
6 |
+
|
7 |
+
class SententenceTransformerSentimentModel(PreTrainedModel):
|
8 |
+
config_class = SentimentConfig
|
9 |
+
|
10 |
+
def __init__(self, config):
|
11 |
+
super().__init__(config)
|
12 |
+
|
13 |
+
self.fc1 = nn.Linear(384, config.h1)
|
14 |
+
self.fc2 = nn.Linear(config.h1, config.h2)
|
15 |
+
self.out = nn.Linear(config.h2, 6)
|
16 |
+
|
17 |
+
def forward(self, x):
|
18 |
+
x = F.relu(self.fc1(x))
|
19 |
+
x = F.relu(self.fc2(x))
|
20 |
+
x = self.out(x)
|
21 |
+
out = F.softmax(x, dim=1)
|
22 |
+
return out
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1d238713227d95357792f7e83ff25a5ecb56fd0c1bd076cb1739681baa462c9d
|
3 |
+
size 79111
|