🚀 全量訓練XSum數據集的BART摘要模型
本模型基於BART架構,在XSum數據集上進行微調,用於抽象式文本摘要任務。它能接收長文檔輸入並生成簡潔的摘要,為信息提取提供高效解決方案。
✨ 主要特性
- 架構:採用BART(雙向和自迴歸變換器)架構。
- 任務:專注於抽象式文本摘要。
- 數據集:基於XSum(極端摘要)數據集進行訓練。
- 訓練硬件:使用2塊NVIDIA T4 GPU(藉助Kaggle平臺)。
- 訓練時間:約9小時。
📦 安裝指南
文檔未提及具體安裝步驟,可參考Hugging Face的transformers
庫安裝方法。
💻 使用示例
基礎用法
from transformers import pipeline
summarizer = pipeline("summarization", model="bhargavis/fulltrain-xsum-bart")
input_text = """
Authorities have issued a warning after multiple sightings of a large brown bear in the woods. The bear is known to become aggressive if disturbed, and residents are urged to exercise caution. Last week, a group of hikers reported a close encounter with the animal. While no injuries were sustained, the bear displayed defensive behavior when approached. Wildlife officials advise keeping a safe distance and avoiding the area if possible. Those encountering the bear should remain calm, back away slowly, and refrain from making sudden movements. Officials continue to monitor the situation.
"""
summary = summarizer(input_text, max_length=64, min_length=30, do_sample=False)
print(summary[0]["summary_text"])
📚 詳細文檔
數據集詳情
數據集類型 |
樣本數量 |
訓練集 |
204,045個樣本 |
驗證集 |
11,332個樣本 |
測試集 |
11,334個樣本 |
XSum數據集包含BBC文章及其對應的單句摘要。模型經過訓練,旨在生成簡潔且能抓住輸入文檔核心內容的摘要。
訓練詳情
訓練參數 |
值 |
訓練輪數 |
1 |
批次大小 |
8(每個設備) |
學習率 |
5e - 5 |
權重衰減 |
0.01 |
熱身步數 |
500 |
FP16訓練 |
啟用 |
評估策略 |
每輪評估 |
最佳模型選擇 |
基於驗證損失(eval_loss) |
評估指標
模型使用以下指標進行評估:
指標 |
得分 |
訓練損失 |
0.3771 |
驗證損失 |
0.350379 |
Rouge - 1 |
0.401344019 |
Rouge - 2 |
0.188076798 |
Rouge - L |
0.33460693 |
這些指標使用rouge_scorer
庫計算ROUGE分數。
訓練參數
模型使用以下Hugging Face Seq2SeqTrainingArguments進行訓練:
參數 |
值 |
保存策略 |
每輪保存 |
日誌記錄步數 |
1000 |
數據加載器工作進程數 |
4 |
預測時生成 |
啟用 |
訓練結束時加載最佳模型 |
啟用 |
最佳模型評估指標 |
驗證損失(eval_loss) |
分數越高越好 |
否(驗證損失越低越好) |
報告工具 |
Weights & Biases (WandB) |
其他注意事項
- 該模型在XSum數據集(包含BBC文章)上進行微調,在其他領域或文本類型上的性能可能有所不同,且可能繼承XSum數據集中存在的偏差。
- 模型基於訓練中學習到的模式生成摘要,偶爾可能生成不準確或有誤導性的摘要,尤其是對於複雜或有歧義的輸入文本。
- 由於模型未在高度技術或特定領域的內容上進行明確訓練,可能在處理此類內容時遇到困難。
- 模型僅支持英文摘要生成。
📄 許可證
本模型採用MIT許可證。