anpmts commited on
Commit
877fdb8
·
verified ·
1 Parent(s): bd863d3

Upload sentiment classifier trained on Amazon Reviews

Browse files
Files changed (2) hide show
  1. config.json +10 -6
  2. configuration_sentiment.py +8 -0
config.json CHANGED
@@ -2,17 +2,21 @@
2
  "architectures": [
3
  "SentimentClassifier"
4
  ],
 
 
 
 
5
  "dropout": 0.1,
6
  "hidden_size": 768,
7
  "id2label": {
8
- "0": "LABEL_0",
9
- "1": "LABEL_1",
10
- "2": "LABEL_2"
11
  },
12
  "label2id": {
13
- "LABEL_0": 0,
14
- "LABEL_1": 1,
15
- "LABEL_2": 2
16
  },
17
  "model_type": "sentiment-classifier",
18
  "pretrained_model": "xlm-roberta-base",
 
2
  "architectures": [
3
  "SentimentClassifier"
4
  ],
5
+ "auto_map": {
6
+ "AutoConfig": "configuration_sentiment.SentimentClassifierConfig",
7
+ "AutoModelForSequenceClassification": "sentiment_classifier.SentimentClassifier"
8
+ },
9
  "dropout": 0.1,
10
  "hidden_size": 768,
11
  "id2label": {
12
+ "0": "negative",
13
+ "1": "neutral",
14
+ "2": "positive"
15
  },
16
  "label2id": {
17
+ "negative": 0,
18
+ "neutral": 1,
19
+ "positive": 2
20
  },
21
  "model_type": "sentiment-classifier",
22
  "pretrained_model": "xlm-roberta-base",
configuration_sentiment.py CHANGED
@@ -44,6 +44,14 @@ class SentimentClassifierConfig(PretrainedConfig):
44
  **kwargs,
45
  ):
46
  """Initialize SentimentClassifierConfig."""
 
 
 
 
 
 
 
 
47
  super().__init__(**kwargs)
48
 
49
  self.pretrained_model = pretrained_model
 
44
  **kwargs,
45
  ):
46
  """Initialize SentimentClassifierConfig."""
47
+ # Set auto_map in kwargs before calling super().__init__
48
+ # This ensures it gets saved to config.json
49
+ if "auto_map" not in kwargs:
50
+ kwargs["auto_map"] = {
51
+ "AutoConfig": "configuration_sentiment.SentimentClassifierConfig",
52
+ "AutoModelForSequenceClassification": "sentiment_classifier.SentimentClassifier",
53
+ }
54
+
55
  super().__init__(**kwargs)
56
 
57
  self.pretrained_model = pretrained_model