当前位置:   article > 正文

NLP 任务:意图识别_qanastek/xlmroberta-alexa-intents-classification

qanastek/xlmroberta-alexa-intents-classification

使用Huggingface BERT模型识别意图

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)

# [{'label': 'weather_query', 'score': 0.9999779462814331}]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

论文 同时预测意图和槽位

BERT for Joint Intent Classification and Slot Filling:https://arxiv.org/abs/1902.10909

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/374050
推荐阅读
相关标签
  

闽ICP备14008679号