This model fine-tunes the bert-base-uncased model on the AG News dataset for text classification.
It classifies English news articles into one of four categories:
| Label | English Category | Korean Label |
|---|---|---|
| 0 | World | 세계뉴스 |
| 1 | Sports | 스포츠 |
| 2 | Business | 비즈니스 |
| 3 | Science/Technology | 과학/기술 |
bert-base-uncasedBertTokenizer (uncased, max length 128)| Metric | Score |
|---|---|
| Accuracy | 82.5% |
from transformers import AutoTokenizer, AutoModelForSequenceClassification import torch
model_name = "your-username/bert-agnews-korean-labels" tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForSequenceClassification.from_pretrained(model_name)
text = "Apple announces the new iPhone at their annual event." inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True) outputs = model(**inputs) predicted_class = torch.argmax(outputs.logits).item()
label_map = { 0: "세계뉴스", 1: "스포츠", 2: "비즈니스", 3: "과학/기술" }
print("Predicted label:", label_map[predicted_class])
If you use this model, please cite the base paper: @article{devlin2018bert, title={BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding}, author={Devlin, Jacob and Chang, Ming-Wei and Lee, Kenton and Toutanova, Kristina}, journal={arXiv preprint arXiv:1810.04805}, year={2018} }
google-bert/bert-base-uncased