🚀 意圖分類微調模型
本項目是一個用於意圖分類的微調模型,基於KLUE RoBERTa小模型在3i4k數據集上進行微調,可對不同類型的語句意圖進行分類。
🚀 快速開始
本項目主要圍繞模型的微調、使用和評估展開,下面將詳細介紹各部分內容。
✨ 主要特性
- 預訓練模型:使用 klue/roberta-small 作為預訓練模型。
- 數據集:採用 3i4k 數據集進行微調,該數據集包含訓練集、驗證集和測試集。
- 標籤信息:涵蓋多種語句意圖標籤,如片段、陳述、問題、命令等。
- 訓練參數:設置了訓練的輪數、批次大小、優化器等參數。
📦 安裝指南
本README未提及具體安裝步驟,可參考相關依賴庫(如transformers、keras等)的官方文檔進行安裝。
💻 使用示例
基礎用法
from transformers import RobertaTokenizerFast, RobertaForSequenceClassification, TextClassificationPipeline
HUGGINGFACE_MODEL_PATH = "bespin-global/klue-roberta-small-3i4k-intent-classification"
loaded_tokenizer = RobertaTokenizerFast.from_pretrained(HUGGINGFACE_MODEL_PATH )
loaded_model = RobertaForSequenceClassification.from_pretrained(HUGGINGFACE_MODEL_PATH )
text_classifier = TextClassificationPipeline(
tokenizer=loaded_tokenizer,
model=loaded_model,
return_all_scores=True
)
text = "your text"
preds_list = text_classifier(text)
best_pred = preds_list[0]
print(f"Label of Best Intentatioin: {best_pred['label']}")
print(f"Score of Best Intentatioin: {best_pred['score']}")
📚 詳細文檔
微調信息
- 預訓練模型:klue/roberta-small
- 微調數據集:3i4k
- 訓練集:46,863
- 驗證集:8,271(佔訓練集的15%)
- 測試集:6,121
- 標籤信息
- 0: "fragment"(片段)
- 1: "statement"(陳述)
- 2: "question"(問題)
- 3: "command"(命令)
- 4: "rhetorical question"(反問句)
- 5: "rhetorical command"(反問命令)
- 6: "intonation-dependent utterance"(語調依賴語句)
- 訓練參數
{
"epochs": 3 (setting 10 but early stopped),
"batch_size":32,
"optimizer_class": "<keras.optimizer_v2.adam.Adam'>",
"optimizer_params": {
"lr": 5e-05
},
"min_delta": 0.01
}
評估結果
precision recall f1-score support
command 0.89 0.92 0.90 1296
fragment 0.98 0.96 0.97 600
intonation-depedent utterance 0.71 0.69 0.70 327
question 0.95 0.97 0.96 1786
rhetorical command 0.87 0.64 0.74 108
rhetorical question 0.61 0.63 0.62 174
statement 0.91 0.89 0.90 1830
accuracy 0.90 6121
macro avg 0.85 0.81 0.83 6121
weighted avg 0.90 0.90 0.90 6121
📄 許可證
本項目採用 CC BY-NC 4.0 許可證。
👥 引用與作者
作者為 Jaehyeong,所屬公司為 Bespin Global。