Intent Classification
Intent Classification
의도 감지(또는 분류)는 주어진 텍스트 입력 뒤에 숨겨진 사용자의 의도나 목적을 식별하는 프로세스입니다.
from transformers import AutoTokenizer, AutoModelForSequenceClassification, TextClassificationPipeline
model_name = 'qanastek/XLMRoberta-Alexa-Intents-Classification'
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
classifier = TextClassificationPipeline(
model=model,
tokenizer=tokenizer
)
res = classifier("What's the weather like today?")
print(res)
/home/kubwa/anaconda3/envs/pytorch/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
from .autonotebook import tqdm as notebook_tqdm
tokenizer_config.json: 100%|██████████| 398/398 [00:00<00:00, 752kB/s]
sentencepiece.bpe.model: 100%|██████████| 5.07M/5.07M [00:01<00:00, 3.28MB/s]
tokenizer.json: 100%|██████████| 17.1M/17.1M [00:02<00:00, 8.17MB/s]
special_tokens_map.json: 100%|██████████| 239/239 [00:00<00:00, 422kB/s]
config.json: 100%|██████████| 4.00k/4.00k [00:00<00:00, 8.84MB/s]
pytorch_model.bin: 100%|██████████| 1.11G/1.11G [00:55<00:00, 19.9MB/s]
[{'label': 'weather_query', 'score': 0.9999779462814331}]
Last updated