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