How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-classification", model="solonsophy/name-gender-classifier-ko")
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("solonsophy/name-gender-classifier-ko")
model = AutoModelForSequenceClassification.from_pretrained("solonsophy/name-gender-classifier-ko", device_map="auto")
Quick Links

Name Gender Classifier (Korean/English)

XLM-RoBERTa 기반 ν•œκ΅­μ–΄/μ˜μ–΄ 이름 성별 λΆ„λ₯˜ λͺ¨λΈ

Model Description

  • Base Model: FacebookAI/xlm-roberta-base
  • Task: Text Classification (name β†’ gender)
  • Languages: Korean (ko), English (en)
  • Labels: male, female

Usage

from 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

Direct Model Usage

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)

Limitations

  • Optimized for Korean and English names
  • May have lower accuracy for names from other language origins
  • Some unisex names may show lower confidence scores

Acknowledgments

This model was trained with computing resources provided by DDOK.AI.

License

Apache-2.0

Downloads last month
46
Safetensors
Model size
0.3B params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for solonsophy/name-gender-classifier-ko

Finetuned
(4,298)
this model