Downloads · 30 days
9
11% of all-time downloads
conviette/korPolBERT
korPolBERT is a text classification model from conviette. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
This model is a binary classifier developed to analyze comment authorship patterns on Korean news articles. For further details, refer to our paper on Journalism: News comment sections and online echo chambers: The id…
Downloads · 30 days
9
11% of all-time downloads
All-time downloads
82
Public
Repo size
878 MB
Likes
1
Public
Click a slice to open those files.
.bin439 MB · 100%
From the Hugging Face model README
This model is a binary classifier developed to analyze comment authorship patterns on Korean news articles. For further details, refer to our paper on Journalism: News comment sections and online echo chambers: The ideological alignment between partisan news stories and their user comments
BertTokenizer, which can be found in the file KorBertTokenizer.py.from KorBertTokenizer import KorBertTokenizer
from transformers import BertForSequenceClassification
import torch
tokenizer = KorBertTokenizer.from_pretrained('conviette/korPolBERT')
model = BertForSequenceClassification.from_pretrained('conviette/korPolBERT')
def classify(text):
inputs = tokenizer(text, padding='max_length', max_length=70, return_tensors='pt')
with torch.no_grad():
logits=model(**inputs).logits
predicted_class_id = logits.argmax().item()
return model.config.id2label[predicted_class_id]
input_strings = ['좌파가 나라 경제 안보 말아먹는다',
'수꼴들은 나라 일본한테 팔아먹었냐']
for input_string in input_strings:
print('===\n입력 텍스트: {}\n분류 결과: {}\n==='.format(input_string, classify(input_string)))