Downloads · 30 days
0
cringepnh/korean-movie-review-predictor
korean-movie-review-predictor is a text classification model from cringepnh. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as mit.
Predict the score (1–10) a viewer would give a Korean movie based on their review text.
Downloads · 30 days
0
Access
Public
Updated Mar 9, 2026
Repo size
450 MB
Likes
0
Public
Click a slice to open those files.
.pt450 MB · 100%
From the Hugging Face model README
Predict the score (1–10) a viewer would give a Korean movie based on their review text.
Fine-tuned from monologg/koelectra-base-v3-discriminator using ordinal classification (10-class softmax) on 153k Korean movie reviews from the NSMC dataset.
| Metric | Value |
|---|---|
| MAE | 1.29 |
| RMSE | 2.24 |
| Accuracy ±1 | 79.98% |
Evaluated on 19,195 held-out test samples.
import torch
from transformers import ElectraModel, ElectraTokenizer
import torch.nn as nn
# 1. Define the model architecture (must match training)
class KoELECTRAOrdinalClassifier(nn.Module):
def __init__(self, model_name, num_classes=10):
super().__init__()
self.electra = ElectraModel.from_pretrained(model_name)
hidden = self.electra.config.hidden_size # 768
self.head = nn.Sequential(
nn.Dropout(0.3),
nn.Linear(hidden, 256),
nn.GELU(),
nn.Dropout(0.3),
nn.Linear(256, num_classes),
)
def forward(self, input_ids, attention_mask):
outputs = self.electra(input_ids=input_ids, attention_mask=attention_mask)
cls_emb = outputs.last_hidden_state[:, 0, :]
return self.head(cls_emb)
# 2. Load model
MODEL_NAME = "monologg/koelectra-base-v3-discriminator"
model = KoELECTRAOrdinalClassifier(MODEL_NAME, num_classes=10)
model.load_state_dict(torch.load("best_model.pt", map_location="cpu"))
model.eval()
# 3. Tokenize and predict
tokenizer = ElectraTokenizer.from_pretrained(MODEL_NAME)
text = "정말 재미있는 영화였습니다! 배우들의 연기가 훌륭해요."
enc = tokenizer(text, max_length=256, padding="max_length", truncation=True, return_tensors="pt")
with torch.no_grad():
logits = model(enc["input_ids"], enc["attention_mask"])
probs = torch.softmax(logits, dim=1).squeeze()
score = int(torch.argmax(probs)) + 1 # 1-10
print(f"Predicted score: {score}/10")
print(f"Confidence: {probs[score-1]*100:.1f}%")
| Parameter | Value |
|---|---|
| Base model | monologg/koelectra-base-v3-discriminator |
| Training data | 153,556 reviews |
| Epochs | 5 (best at epoch 2) |
| Batch size | 16 |
| Learning rate | 2e-5 |
| Optimizer | AdamW (weight decay 0.01) |
| Loss | CrossEntropyLoss |
| Hardware | NVIDIA RTX 4080 Laptop GPU |