arnab04 commited on
Commit
2b42e66
·
verified ·
1 Parent(s): 2a97acf

Upload folder using huggingface_hub

Browse files
config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "EmoAxis"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "auto_map": {
7
+ "AutoConfig": "configuration_emoaxis.EmoAxisConfig",
8
+ "AutoModel": "modeling_emoaxis.EmoAxis"
9
+ },
10
+ "bos_token_id": 0,
11
+ "classifier_dropout": null,
12
+ "dtype": "float32",
13
+ "eos_token_id": 2,
14
+ "freeze_upto": 0,
15
+ "hidden_act": "gelu",
16
+ "hidden_dropout_prob": 0.1,
17
+ "hidden_size": 768,
18
+ "initializer_range": 0.02,
19
+ "intermediate_size": 3072,
20
+ "layer_norm_eps": 1e-12,
21
+ "max_position_embeddings": 514,
22
+ "model_type": "emoaxis",
23
+ "num_attention_heads": 12,
24
+ "num_classes": 28,
25
+ "num_hidden_layers": 12,
26
+ "pad_token_id": 1,
27
+ "position_embedding_type": "absolute",
28
+ "transformers_version": "4.57.3",
29
+ "type_vocab_size": 1,
30
+ "use_cache": true,
31
+ "vocab_size": 50265
32
+ }
configuration_emoaxis.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import RobertaConfig
2
+ class EmoAxisConfig(RobertaConfig):
3
+ model_type = "emoaxis"
4
+ def __init__(self, num_classes=28, freeze_upto=0, **kwargs):
5
+ kwargs["max_position_embeddings"] = 514
6
+ kwargs["type_vocab_size"] = 1
7
+ super().__init__(**kwargs)
8
+ self.num_classes = num_classes
9
+ self.freeze_upto = freeze_upto
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c1e18aa9f12900ec531911e9e1563d6e428872e7cf9fa620e542ab2b1ea78ec
3
+ size 497880872
modeling_emoaxis.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import torch.nn as nn
3
+ import torch.nn.functional as F
4
+ from transformers import RobertaPreTrainedModel, RobertaModel
5
+ from .configuration_emoaxis import EmoAxisConfig
6
+
7
+ class EmoAxis(RobertaPreTrainedModel):
8
+ config_class = EmoAxisConfig
9
+ def __init__(self, config):
10
+ super().__init__(config)
11
+ self.roberta = RobertaModel(config, add_pooling_layer=False)
12
+ self.mlp = nn.Sequential(
13
+ nn.Linear(config.hidden_size, 512),
14
+ nn.LayerNorm(512),
15
+ nn.GELU(),
16
+ nn.Dropout(0.25),
17
+ nn.Linear(512, config.num_classes)
18
+ )
19
+ self.post_init()
20
+ def forward(self, input_ids=None, attention_mask=None, **kwargs):
21
+ outputs = self.roberta(input_ids=input_ids, attention_mask=attention_mask, output_hidden_states=True)
22
+ last_hidden_state = outputs.hidden_states[-1]
23
+ mask = attention_mask.unsqueeze(-1).float()
24
+ text_emb = (last_hidden_state * mask).sum(dim=1) / mask.sum(dim=1).clamp(min=1e-9)
25
+ text_emb = F.normalize(text_emb, p=2, dim=1)
26
+ logits = self.mlp(text_emb)
27
+ return text_emb, logits
special_tokens_map.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "cls_token": "<s>",
4
+ "eos_token": "</s>",
5
+ "mask_token": {
6
+ "content": "<mask>",
7
+ "lstrip": true,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "pad_token": "<pad>",
13
+ "sep_token": "</s>",
14
+ "unk_token": "<unk>"
15
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "0": {
5
+ "content": "<s>",
6
+ "lstrip": false,
7
+ "normalized": true,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "1": {
13
+ "content": "<pad>",
14
+ "lstrip": false,
15
+ "normalized": true,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "2": {
21
+ "content": "</s>",
22
+ "lstrip": false,
23
+ "normalized": true,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "3": {
29
+ "content": "<unk>",
30
+ "lstrip": false,
31
+ "normalized": true,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "50264": {
37
+ "content": "<mask>",
38
+ "lstrip": true,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ }
44
+ },
45
+ "bos_token": "<s>",
46
+ "clean_up_tokenization_spaces": false,
47
+ "cls_token": "<s>",
48
+ "eos_token": "</s>",
49
+ "errors": "replace",
50
+ "extra_special_tokens": {},
51
+ "mask_token": "<mask>",
52
+ "model_max_length": 512,
53
+ "pad_token": "<pad>",
54
+ "sep_token": "</s>",
55
+ "tokenizer_class": "RobertaTokenizer",
56
+ "trim_offsets": true,
57
+ "unk_token": "<unk>"
58
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff