Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Koelectra-five-sentiment-classification
|
| 2 |
+
Koelectra on hugging face Transformers for Psychological Counseling
|
| 3 |
+
- [full project link](https://github.com/jiminAn/Capstone_2022)
|
| 4 |
+
|
| 5 |
+
## how to use
|
| 6 |
+
```
|
| 7 |
+
from transformers import ElectraModel, ElectraTokenizer
|
| 8 |
+
|
| 9 |
+
model = ElectraModel.from_pretrained("withU/Koelectra-five-sentiment-classification")
|
| 10 |
+
tokenizer = ElectraTokenizer.from_pretrained("withU/Koelectra-five-sentiment-classification")
|
| 11 |
+
categories = "withU/Koelectra-five-sentiment-classification" # 카테고리, index 파일
|
| 12 |
+
|
| 13 |
+
sentence = "나는 방금 밥을 먹었다."
|
| 14 |
+
inputs = tokenizer.encode(sentence, return_tensors="pt")
|
| 15 |
+
outputs = model(**inputs)
|
| 16 |
+
softmax_logit = nn.Softmax(outputs).dim
|
| 17 |
+
softmax_logit = softmax_logit[0].squeeze()
|
| 18 |
+
max_index = torch.argmax(softmax_logit).item()
|
| 19 |
+
prediction = max_index
|
| 20 |
+
|
| 21 |
+
print(sentence, categories[prediction])
|
| 22 |
+
```
|
| 23 |
+
## dataset finetuned on
|
| 24 |
+
|
| 25 |
+
- [wellness dataset](https://aihub.or.kr/opendata/keti-data/recognition-laguage/KETI-02-006)
|
| 26 |
+
- [chatbot data](https://jeongukjae.github.io/tfds-korean/datasets/korean_chatbot_qa_data.html)
|
| 27 |
+
- [korean-hate-speech](https://github.com/kocohub/korean-hate-speech)
|
| 28 |
+
|
| 29 |
+
## references
|
| 30 |
+
|
| 31 |
+
- [WelllnessConversation-LanguageModel](https://github.com/nawnoes/WellnessConversation-LanguageModel)
|
| 32 |
+
- [KoELECTRA](https://github.com/monologg/KoELECTRA)
|
| 33 |
+
|