iitanish commited on
Commit
70dc691
·
verified ·
1 Parent(s): 1a42faf

Initial upload: DeBERTa emotion classifier (0.801 F1)

Browse files
README.md ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ license: mit
4
+ tags:
5
+ - emotion-classification
6
+ - multi-label
7
+ ---
8
+
9
+ # Emotion Classifier (DeBERTa-v3-base)
10
+
11
+ F1: 0.8008092786408941
12
+
13
+ ## Usage
14
+
15
+ import torch
16
+ import torch.nn as nn
17
+ from transformers import DebertaV2Tokenizer, DebertaV2Model
18
+
19
+ class TransformerClassifier(nn.Module):
20
+ def init(self, model_name, n_classes=5):
21
+ super().init()
22
+ self.transformer = DebertaV2Model.from_pretrained(model_name)
23
+ self.classifier = nn.Linear(768, n_classes)
24
+
25
+ def forward(self, input_ids, attention_mask):
26
+ outputs = self.transformer(input_ids=input_ids, attention_mask=attention_mask)
27
+ return self.classifier(outputs.last_hidden_state[:, 0])
28
+ tokenizer = DebertaV2Tokenizer.from_pretrained('YOUR_USERNAME/emotion-classifier-deberta')
29
+ model = TransformerClassifier('YOUR_USERNAME/emotion-classifier-deberta')
30
+ checkpoint = torch.load('pytorch_model.bin')
31
+ model.load_state_dict(checkpoint['model_state_dict'])
32
+ model.eval()
33
+
34
+
35
+ Anish Sharma (23f1001021) - IIT Madras 2025
added_tokens.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "[MASK]": 128000
3
+ }
config.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "attention_probs_dropout_prob": 0.1,
3
+ "hidden_act": "gelu",
4
+ "hidden_dropout_prob": 0.1,
5
+ "hidden_size": 768,
6
+ "initializer_range": 0.02,
7
+ "intermediate_size": 3072,
8
+ "layer_norm_eps": 1e-07,
9
+ "legacy": true,
10
+ "max_position_embeddings": 512,
11
+ "max_relative_positions": -1,
12
+ "model_type": "deberta-v2",
13
+ "norm_rel_ebd": "layer_norm",
14
+ "num_attention_heads": 12,
15
+ "num_hidden_layers": 12,
16
+ "pad_token_id": 0,
17
+ "pooler_dropout": 0,
18
+ "pooler_hidden_act": "gelu",
19
+ "pooler_hidden_size": 768,
20
+ "pos_att_type": [
21
+ "p2c",
22
+ "c2p"
23
+ ],
24
+ "position_biased_input": false,
25
+ "position_buckets": 256,
26
+ "relative_attention": true,
27
+ "share_att_key": true,
28
+ "transformers_version": "4.52.4",
29
+ "type_vocab_size": 0,
30
+ "vocab_size": 128100
31
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:87efff4245bf775217153f56e7c724ec36bf6af347dbc97032ec4c4960abc8a2
3
+ size 735425770
special_tokens_map.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "[CLS]",
3
+ "cls_token": "[CLS]",
4
+ "eos_token": "[SEP]",
5
+ "mask_token": "[MASK]",
6
+ "pad_token": "[PAD]",
7
+ "sep_token": "[SEP]",
8
+ "unk_token": {
9
+ "content": "[UNK]",
10
+ "lstrip": false,
11
+ "normalized": true,
12
+ "rstrip": false,
13
+ "single_word": false
14
+ }
15
+ }
spm.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c679fbf93643d19aab7ee10c0b99e460bdbc02fedf34b92b05af343b4af586fd
3
+ size 2464616
tokenizer_config.json ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[PAD]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "[CLS]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "[SEP]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "[UNK]",
29
+ "lstrip": false,
30
+ "normalized": true,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "128000": {
36
+ "content": "[MASK]",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "bos_token": "[CLS]",
45
+ "clean_up_tokenization_spaces": false,
46
+ "cls_token": "[CLS]",
47
+ "do_lower_case": false,
48
+ "eos_token": "[SEP]",
49
+ "extra_special_tokens": {},
50
+ "mask_token": "[MASK]",
51
+ "model_max_length": 1000000000000000019884624838656,
52
+ "pad_token": "[PAD]",
53
+ "sep_token": "[SEP]",
54
+ "sp_model_kwargs": {},
55
+ "split_by_punct": false,
56
+ "tokenizer_class": "DebertaV2Tokenizer",
57
+ "unk_token": "[UNK]",
58
+ "vocab_type": "spm"
59
+ }