🚀 關鍵詞提取模型
本模型是 Flan - T5 small 模型的微調版本,專門用於從段落中提取關鍵詞。它藉助 T5 架構的強大能力,識別並輸出能夠概括輸入文本核心內容的關鍵短語。
🚀 快速開始
此模型以段落作為輸入,生成一系列關鍵詞或關鍵短語,用以概括文本的主要主題。它在以下場景中特別有用:
- 總結長文本
- 為文章或博客文章生成標籤
- 識別文檔中的主要主題
✨ 主要特性
預期用途
- 快速總結長段落
- 為內容管理系統生成元數據
- 輔助進行 SEO 關鍵詞識別
侷限性
- 模型有時可能會生成不相關的關鍵詞。
- 性能可能會因輸入文本的長度和複雜度而有所不同:
- 為獲得最佳效果,請使用較長且清晰的文本。
- 由於 Flan - T5 架構的限制,長度上限為 512 個標記。
- 該模型是在英文文本上進行訓練的,在其他語言上的表現可能不佳。
📦 安裝指南
此部分原文檔未提及具體安裝步驟,故跳過。
💻 使用示例
基礎用法
以下是一個使用該模型的簡單示例:
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
model_name = "agentlans/flan-t5-small-keywords"
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
input_text = "Your paragraph here..."
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**inputs, max_length=512)
decoded_output = tokenizer.decode(outputs[0], skip_special_tokens=True)
keywords = list(set(decoded_output.split('||')))
print(keywords)
示例輸入段落:
In the heart of the bustling city, a hidden gem awaits discovery: a quaint little bookstore that seems to have escaped the relentless march of time. As you step inside, the scent of aged paper and rich coffee envelops you, creating an inviting atmosphere that beckons you to explore its shelves. Each corner is adorned with carefully curated collections, from classic literature to contemporary bestsellers, inviting readers of all tastes to lose themselves in the pages of a good book. The soft glow of warm lighting casts a cozy ambiance, while the gentle hum of conversation among fellow book lovers adds to the charm. This bookstore is not just a place to buy books; it's a sanctuary for those seeking solace, inspiration, and a sense of community in the fast-paced world outside.
示例輸出關鍵詞:
['old paper coffee scent', 'cosy hum of conversation', 'quaint bookstore', 'community in the fast-paced world', 'solace inspiration', 'curated collections']
📚 詳細文檔
訓練與評估
該模型在一個包含英文維基百科段落及其對應關鍵詞的數據集上進行了微調,該數據集涵蓋了各種不同的主題,以確保模型具有廣泛的適用性。
侷限性和偏差
此模型是在英文維基百科段落上進行訓練的,這可能會引入偏差。用戶應注意,生成的關鍵詞可能反映這些偏差,因此應謹慎使用輸出結果。
訓練細節
屬性 |
詳情 |
模型類型 |
基於 Flan - T5 small 微調的關鍵詞提取模型 |
訓練數據 |
維基百科段落和關鍵詞數據集 |
訓練過程 |
對 google/flan - t5 - small 進行微調 |
訓練超參數
訓練過程中使用了以下超參數:
- 學習率:5e - 05
- 訓練批次大小:8
- 評估批次大小:8
- 隨機種子:42
- 優化器:Adam(β1 = 0.9,β2 = 0.999,ε = 1e - 08)
- 學習率調度器類型:線性
- 訓練輪數:10.0
框架版本
- Transformers 4.45.1
- Pytorch 2.4.1+cu121
- Datasets 3.0.1
- Tokenizers 0.20.0
倫理考量
在使用此模型時,請考慮自動關鍵詞提取對內容創作和 SEO 實踐的潛在影響。確保使用該模型符合相關準則,且不會導致創建誤導性或垃圾內容。
📄 許可證
本項目採用 MIT 許可證。