Downloads · 30 days
15
0% of all-time downloads
solonsophy/name-gender-classifier-ko
name-gender-classifier-ko is a text classification model from solonsophy. 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.
Downloads · 30 days
15
0% of all-time downloads
All-time downloads
83.9K
Public
Parameters
278M
1.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.1 GB · 98%
From the Hugging Face model README
XLM-RoBERTa 기반 한국어/영어 이름 성별 분류 모델
male, femalefrom transformers import pipeline
classifier = pipeline("text-classification", model="solonsophy/name-gender-classifier-ko")
# Korean names
classifier("민준") # → male
classifier("서연") # → female
classifier("김민준") # → male
# English names
classifier("James") # → male
classifier("Emma") # → female
# Cross-cultural names
classifier("다니엘") # → male
classifier("소피아") # → female
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
tokenizer = AutoTokenizer.from_pretrained("solonsophy/name-gender-classifier-ko")
model = AutoModelForSequenceClassification.from_pretrained("solonsophy/name-gender-classifier-ko")
def predict(name):
inputs = tokenizer(name, return_tensors="pt", padding=True, truncation=True, max_length=32)
with torch.no_grad():
outputs = model(**inputs)
probs = torch.softmax(outputs.logits, dim=1)
pred_id = torch.argmax(probs, dim=1).item()
return model.config.id2label[pred_id], probs[0][pred_id].item()
print(predict("서준")) # ('male', 0.996)
This model was trained with computing resources provided by DDOK.AI.
Apache-2.0