KoBART 기반 한국어 슬랭 번역기
이 모델은 KoBART를 파인튜닝하여 한국어 비속어를 표준어로 번역해주는 번역기입니다.
사용한 모델
데이터셋
AI Hub의 텍스트 윤리검증 데이터를 사용하였습니다.
사용 예시
Input Text: 야이 미친놈아 꺼져
Generated Text: 이런, 제발 그만 좀 해줘.
학습 세부정보
하이퍼 파라미터(미완)
training_args = TrainingArguments(
)
학습 환경
• GPU: NVIDIA RTX A5000
• 학습 시간: 약 3시간
학습 결과 (미완)
| Step | Training Loss | Validation Loss |
|---|---|---|
| 0 | 0. | 0.0 |
사용 방법
모델은 입력 문장의 앞에 반드시
[순화]토큰을 붙여야 올바르게 작동합니다.
import torch
from transformers import BartForConditionalGeneration, PreTrainedTokenizerFast
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = BartForConditionalGeneration.from_pretrained("heloolkjdasklfjlasdf/slang-kobart").to(device)
tokenizer = PreTrainedTokenizerFast.from_pretrained("heloolkjdasklfjlasdf/slang-kobart")
model.eval()
def refine_text(text):
input_text = "[순화] " + text
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(device)
with torch.no_grad():
output = model.generate(
input_ids=input_ids,
max_length=128,
num_beams=5,
early_stopping=True
)
return tokenizer.decode(output[0], skip_special_tokens=True)
# ✅ 테스트 예시
print("🧨 원문:", "야이 미친놈아 꺼져")
print("✅ 순화:", refine_text("야이 미친놈아 꺼져"))