사용자의 자연어 입력을 8개 업무 의도(intent)로 분류합니다.
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4model_name = "jiyong1110/koelectra-intent-classifier"
5tokenizer = AutoTokenizer.from_pretrained(model_name)
6model = AutoModelForSequenceClassification.from_pretrained(model_name)
7
8text = "내일 오후 3시에 회의 잡아줘"
9inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)
10
11with torch.no_grad():
12 outputs = model(**inputs)
13 pred = torch.argmax(outputs.logits, dim=-1).item()
14
15id2label = model.config.id2label
16print(f"Intent: {id2label[pred]}") # schedule_add
LangGraph 기반 멀티 에이전트 업무 자동화 시스템의 Intent Classification 모듈입니다.