Mango-Juice commited on
Commit
aea7fc4
·
verified ·
1 Parent(s): 171791e

Upload 9 files

Browse files
README.md ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GoEmotions Fine-tuned Model
2
+
3
+ 이 모델은 GoEmotions 데이터셋으로 훈련된 다중 감정 분류 모델입니다.
4
+
5
+ ## 모델 정보
6
+ - **Base Model**: Mango-Juice/trpg_mlm
7
+ - **Task**: Multi-label Emotion Classification
8
+ - **Labels**: 28개의 감정 라벨
9
+ - **Training**: 2차 파인튜닝 완료 (goEmotions 데이터 및 TRPG 문장 데이터)
10
+
11
+ ## 감정 라벨 목록
12
+ - admiration
13
+ - amusement
14
+ - anger
15
+ - annoyance
16
+ - approval
17
+ - caring
18
+ - confusion
19
+ - curiosity
20
+ - desire
21
+ - disappointment
22
+ - disapproval
23
+ - disgust
24
+ - embarrassment
25
+ - excitement
26
+ - fear
27
+ - gratitude
28
+ - grief
29
+ - joy
30
+ - love
31
+ - nervousness
32
+ - optimism
33
+ - pride
34
+ - realization
35
+ - relief
36
+ - remorse
37
+ - sadness
38
+ - surprise
39
+ - neutral
40
+
41
+ ## 사용 방법
42
+
43
+ ```python
44
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
45
+ import torch
46
+
47
+ # 모델과 토크나이저 로드
48
+ tokenizer = AutoTokenizer.from_pretrained("your-username/final_emotion_model")
49
+ model = AutoModelForSequenceClassification.from_pretrained("your-username/final_emotion_model")
50
+
51
+ # 추론
52
+ def predict_emotions(text):
53
+ inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=128)
54
+ with torch.no_grad():
55
+ logits = model(**inputs).logits
56
+ probs = torch.sigmoid(logits).cpu().numpy()[0]
57
+
58
+ emotion_labels = ['admiration', 'amusement', 'anger', 'annoyance', 'approval', 'caring', 'confusion', 'curiosity', 'desire', 'disappointment', 'disapproval', 'disgust', 'embarrassment', 'excitement', 'fear', 'gratitude', 'grief', 'joy', 'love', 'nervousness', 'optimism', 'pride', 'realization', 'relief', 'remorse', 'sadness', 'surprise', 'neutral']
59
+ return {emotion: float(prob) for emotion, prob in zip(emotion_labels, probs)}
60
+
61
+ # 예시
62
+ text = "I am so happy today!"
63
+ emotions = predict_emotions(text)
64
+ print(emotions)
65
+ ```
66
+
67
+ ## 성능
68
+ - Fine-tuning 완료된 모델로 향상된 감정 분류 성능 제공
69
+ - 희소 클래스에 대한 데이터 증강 적용
70
+
71
+ ## 훈련 세부사항
72
+ - 데이터 증강: 파라프레이징 및 역번역 기반 오버샘플링
73
+ - 손실 함수: Focal Loss with Label Smoothing
74
+ - 옵티마이저: AdamW
75
+ - 스케줄러: ReduceLROnPlateau
added_tokens.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "[MASK]": 128000
3
+ }
config.json ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "DebertaV2ForSequenceClassification"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.2,
6
+ "hidden_act": "gelu",
7
+ "hidden_dropout_prob": 0.2,
8
+ "hidden_size": 1024,
9
+ "id2label": {
10
+ "0": "admiration",
11
+ "1": "amusement",
12
+ "2": "anger",
13
+ "3": "annoyance",
14
+ "4": "approval",
15
+ "5": "caring",
16
+ "6": "confusion",
17
+ "7": "curiosity",
18
+ "8": "desire",
19
+ "9": "disappointment",
20
+ "10": "disapproval",
21
+ "11": "disgust",
22
+ "12": "embarrassment",
23
+ "13": "excitement",
24
+ "14": "fear",
25
+ "15": "gratitude",
26
+ "16": "grief",
27
+ "17": "joy",
28
+ "18": "love",
29
+ "19": "nervousness",
30
+ "20": "optimism",
31
+ "21": "pride",
32
+ "22": "realization",
33
+ "23": "relief",
34
+ "24": "remorse",
35
+ "25": "sadness",
36
+ "26": "surprise",
37
+ "27": "neutral"
38
+ },
39
+ "initializer_range": 0.02,
40
+ "intermediate_size": 4096,
41
+ "label2id": {
42
+ "admiration": 0,
43
+ "amusement": 1,
44
+ "anger": 2,
45
+ "annoyance": 3,
46
+ "approval": 4,
47
+ "caring": 5,
48
+ "confusion": 6,
49
+ "curiosity": 7,
50
+ "desire": 8,
51
+ "disappointment": 9,
52
+ "disapproval": 10,
53
+ "disgust": 11,
54
+ "embarrassment": 12,
55
+ "excitement": 13,
56
+ "fear": 14,
57
+ "gratitude": 15,
58
+ "grief": 16,
59
+ "joy": 17,
60
+ "love": 18,
61
+ "nervousness": 19,
62
+ "optimism": 20,
63
+ "pride": 21,
64
+ "realization": 22,
65
+ "relief": 23,
66
+ "remorse": 24,
67
+ "sadness": 25,
68
+ "surprise": 26,
69
+ "neutral": 27
70
+ },
71
+ "layer_norm_eps": 1e-07,
72
+ "legacy": true,
73
+ "max_position_embeddings": 512,
74
+ "max_relative_positions": -1,
75
+ "model_type": "deberta-v2",
76
+ "norm_rel_ebd": "layer_norm",
77
+ "num_attention_heads": 16,
78
+ "num_hidden_layers": 24,
79
+ "pad_token_id": 0,
80
+ "pooler_dropout": 0,
81
+ "pooler_hidden_act": "gelu",
82
+ "pooler_hidden_size": 1024,
83
+ "pos_att_type": [
84
+ "p2c",
85
+ "c2p"
86
+ ],
87
+ "position_biased_input": false,
88
+ "position_buckets": 256,
89
+ "problem_type": "multi_label_classification",
90
+ "relative_attention": true,
91
+ "share_att_key": true,
92
+ "torch_dtype": "float32",
93
+ "transformers_version": "4.52.3",
94
+ "type_vocab_size": 0,
95
+ "vocab_size": 128100
96
+ }
label_info.json ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "emotion_labels": [
3
+ "admiration",
4
+ "amusement",
5
+ "anger",
6
+ "annoyance",
7
+ "approval",
8
+ "caring",
9
+ "confusion",
10
+ "curiosity",
11
+ "desire",
12
+ "disappointment",
13
+ "disapproval",
14
+ "disgust",
15
+ "embarrassment",
16
+ "excitement",
17
+ "fear",
18
+ "gratitude",
19
+ "grief",
20
+ "joy",
21
+ "love",
22
+ "nervousness",
23
+ "optimism",
24
+ "pride",
25
+ "realization",
26
+ "relief",
27
+ "remorse",
28
+ "sadness",
29
+ "surprise",
30
+ "neutral"
31
+ ],
32
+ "num_labels": 28,
33
+ "label2id": {
34
+ "admiration": 0,
35
+ "amusement": 1,
36
+ "anger": 2,
37
+ "annoyance": 3,
38
+ "approval": 4,
39
+ "caring": 5,
40
+ "confusion": 6,
41
+ "curiosity": 7,
42
+ "desire": 8,
43
+ "disappointment": 9,
44
+ "disapproval": 10,
45
+ "disgust": 11,
46
+ "embarrassment": 12,
47
+ "excitement": 13,
48
+ "fear": 14,
49
+ "gratitude": 15,
50
+ "grief": 16,
51
+ "joy": 17,
52
+ "love": 18,
53
+ "nervousness": 19,
54
+ "optimism": 20,
55
+ "pride": 21,
56
+ "realization": 22,
57
+ "relief": 23,
58
+ "remorse": 24,
59
+ "sadness": 25,
60
+ "surprise": 26,
61
+ "neutral": 27
62
+ },
63
+ "id2label": {
64
+ "0": "admiration",
65
+ "1": "amusement",
66
+ "2": "anger",
67
+ "3": "annoyance",
68
+ "4": "approval",
69
+ "5": "caring",
70
+ "6": "confusion",
71
+ "7": "curiosity",
72
+ "8": "desire",
73
+ "9": "disappointment",
74
+ "10": "disapproval",
75
+ "11": "disgust",
76
+ "12": "embarrassment",
77
+ "13": "excitement",
78
+ "14": "fear",
79
+ "15": "gratitude",
80
+ "16": "grief",
81
+ "17": "joy",
82
+ "18": "love",
83
+ "19": "nervousness",
84
+ "20": "optimism",
85
+ "21": "pride",
86
+ "22": "realization",
87
+ "23": "relief",
88
+ "24": "remorse",
89
+ "25": "sadness",
90
+ "26": "surprise",
91
+ "27": "neutral"
92
+ }
93
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:da0a4283b913863fc4d52afa9e40ed487c8a9d7ecda984ec0b2ec4e2b3eae590
3
+ size 1740411056
special_tokens_map.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "[CLS]",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "[CLS]",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "[SEP]",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "mask_token": {
24
+ "content": "[MASK]",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "pad_token": {
31
+ "content": "[PAD]",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "sep_token": {
38
+ "content": "[SEP]",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "unk_token": {
45
+ "content": "[UNK]",
46
+ "lstrip": false,
47
+ "normalized": true,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
spm.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c679fbf93643d19aab7ee10c0b99e460bdbc02fedf34b92b05af343b4af586fd
3
+ size 2464616
thresholds.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "optimal_thresholds": [
3
+ 0.5,
4
+ 0.4,
5
+ 0.3,
6
+ 0.3,
7
+ 0.45,
8
+ 0.25,
9
+ 0.3,
10
+ 0.45,
11
+ 0.5,
12
+ 0.25,
13
+ 0.45,
14
+ 0.55,
15
+ 0.4,
16
+ 0.6000000000000001,
17
+ 0.25,
18
+ 0.45,
19
+ 0.05,
20
+ 0.55,
21
+ 0.5,
22
+ 0.3,
23
+ 0.55,
24
+ 0.5,
25
+ 0.35000000000000003,
26
+ 0.35000000000000003,
27
+ 0.4,
28
+ 0.5,
29
+ 0.3,
30
+ 0.4
31
+ ],
32
+ "threshold_description": "Optimized thresholds for each emotion label for best F1 score"
33
+ }
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
+ }