Downloads · 30 days
0
withU/Koelectra-five-sentiment-classification
Koelectra-five-sentiment-classification is a machine learning model from withU. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Koelectra on hugging face Transformers for Psychological Counseling - full project link
Downloads · 30 days
0
Access
Public
Updated May 19, 2022
Repo size
1.4 GB
Likes
0
Public
Click a slice to open those files.
.pth1.4 GB · 100%
From the Hugging Face model README
Koelectra on hugging face Transformers for Psychological Counseling
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])