Seonghaa commited on
Commit
f34ad4f
·
verified ·
1 Parent(s): bd4abeb

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Korean Emotion Classifier 😃😡😢😨😲😌
2
+
3
+ 본 모델은 한국어 텍스트를 **6가지 감정(분노, 불안, 슬픔, 평온, 당황, 기쁨)**으로 분류합니다.
4
+ `klue/roberta-base` 기반으로 파인튜닝되었습니다.
5
+
6
+ ---
7
+
8
+ ## 📊 Evaluation Results
9
+
10
+ | Emotion | Precision | Recall | F1-Score |
11
+ |---------|-----------|--------|----------|
12
+ | 분노 | 0.9801 | 0.9788 | 0.9795 |
13
+ | 불안 | 0.9864 | 0.9848 | 0.9856 |
14
+ | 슬픔 | 0.9837 | 0.9854 | 0.9845 |
15
+ | 평온 | 0.9782 | 0.9750 | 0.9766 |
16
+ | 당황 | 0.9607 | 0.9668 | 0.9652 |
17
+ | 기쁨 | 0.9857 | 0.9886 | 0.9872 |
18
+
19
+ **Accuracy**: 0.9831
20
+ **Macro Avg**: Precision=0.9791 / Recall=0.9804 / F1=0.9798
21
+ **Weighted Avg**: Precision=0.9831 / Recall=0.9831 / F1=0.9831
22
+
23
+ ```python
24
+ from transformers import pipeline
25
+ import torch
26
+
27
+ model_id = "Seonghaa/korean-emotion-classifier-roberta"
28
+
29
+ device = 0 if torch.cuda.is_available() else -1 # GPU 있으면 0, 없으면 CPU(-1)
30
+
31
+ clf = pipeline(
32
+ "text-classification",
33
+ model=model_id,
34
+ tokenizer=model_id,
35
+ device=device
36
+ )
37
+
38
+ texts = [
39
+ "오늘 길에서 10만원을 주웠어",
40
+ "오늘 친구들이랑 노래방에 갔어",
41
+ "오늘 시험 망쳤어",
42
+ ]
43
+
44
+ for t in texts:
45
+ pred = clf(t, truncation=True, max_length=256)[0]
46
+ print(f"입력: {t}")
47
+ print(f"→ 예측 감정: {pred['label']}, 점수: {pred['score']:.4f}
48
+ ")
49
+
50
+ ```
51
+ 출력 예시:
52
+ 입력: 오늘 길에서 10만원을 주웠어
53
+ → 예측 감정: 기쁨, 점수: 0.9619
54
+
55
+ 입력: 오늘 친구들이랑 노래방에 갔어
56
+ → 예측 감정: 기쁨, 점수: 0.9653
57
+
58
+ 입력: 오늘 시험 망쳤어
59
+ → 예측 감정: 슬픔, 점수: 0.9602
config.json ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "klue/roberta-base",
3
+ "architectures": [
4
+ "RobertaForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": 0,
8
+ "classifier_dropout": null,
9
+ "eos_token_id": 2,
10
+ "gradient_checkpointing": false,
11
+ "hidden_act": "gelu",
12
+ "hidden_dropout_prob": 0.1,
13
+ "hidden_size": 768,
14
+ "id2label": {
15
+ "0": "\ubd84\ub178",
16
+ "1": "\ubd88\uc548",
17
+ "2": "\uc2ac\ud514",
18
+ "3": "\ud3c9\uc628",
19
+ "4": "\ub2f9\ud669",
20
+ "5": "\uae30\uc068"
21
+ },
22
+ "initializer_range": 0.02,
23
+ "intermediate_size": 3072,
24
+ "label2id": {
25
+ "\uae30\uc068": 5,
26
+ "\ub2f9\ud669": 4,
27
+ "\ubd84\ub178": 0,
28
+ "\ubd88\uc548": 1,
29
+ "\uc2ac\ud514": 2,
30
+ "\ud3c9\uc628": 3
31
+ },
32
+ "layer_norm_eps": 1e-05,
33
+ "max_position_embeddings": 514,
34
+ "model_type": "roberta",
35
+ "num_attention_heads": 12,
36
+ "num_hidden_layers": 12,
37
+ "pad_token_id": 1,
38
+ "position_embedding_type": "absolute",
39
+ "tokenizer_class": "BertTokenizer",
40
+ "torch_dtype": "float32",
41
+ "transformers_version": "4.45.2",
42
+ "type_vocab_size": 1,
43
+ "use_cache": true,
44
+ "vocab_size": 32000
45
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7504fe9cd71500537d81c8a96aee67a654427c3badcc9c6b7b849d3dd4ba3971
3
+ size 442515048
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": false,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[CLS]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "[PAD]",
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": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "4": {
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_basic_tokenize": true,
48
+ "do_lower_case": false,
49
+ "eos_token": "[SEP]",
50
+ "mask_token": "[MASK]",
51
+ "model_max_length": 512,
52
+ "never_split": null,
53
+ "pad_token": "[PAD]",
54
+ "sep_token": "[SEP]",
55
+ "strip_accents": null,
56
+ "tokenize_chinese_chars": true,
57
+ "tokenizer_class": "BertTokenizer",
58
+ "unk_token": "[UNK]"
59
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c345af2764be8e4c253e4182835df1b916df5631874f2af26e81c6bd9e47e82e
3
+ size 5280
vocab.txt ADDED
The diff for this file is too large to render. See raw diff