🚀 [Google的T5 - 閉卷問答模型]
本項目基於Google的T5模型,用於閉卷問答任務。該模型通過在多個大型數據集上進行預訓練和微調,能夠在不借助外部知識源的情況下回答問題,為自然語言處理領域的知識問答提供了有效的解決方案。
🚀 快速開始
本模型可按如下方式用於閉卷問答:
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
t5_qa_model = AutoModelForSeq2SeqLM.from_pretrained("google/t5-11b-ssm-nq")
t5_tok = AutoTokenizer.from_pretrained("google/t5-11b-ssm-nq")
input_ids = t5_tok("When was Franklin D. Roosevelt born?", return_tensors="pt").input_ids
gen_output = t5_qa_model.generate(input_ids)[0]
print(t5_tok.decode(gen_output, skip_special_tokens=True))
✨ 主要特性
📦 安裝指南
文檔中未提及具體安裝步驟,故跳過此章節。
💻 使用示例
基礎用法
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
t5_qa_model = AutoModelForSeq2SeqLM.from_pretrained("google/t5-11b-ssm-nq")
t5_tok = AutoTokenizer.from_pretrained("google/t5-11b-ssm-nq")
input_ids = t5_tok("When was Franklin D. Roosevelt born?", return_tensors="pt").input_ids
gen_output = t5_qa_model.generate(input_ids)[0]
print(t5_tok.decode(gen_output, skip_special_tokens=True))
📚 詳細文檔
模型信息
自然問題測試集結果
編號 |
鏈接 |
精確匹配率 |
T5-small |
https://huggingface.co/google/t5-small-ssm-nq |
25.5 |
T5-large |
https://huggingface.co/google/t5-large-ssm-nq |
30.4 |
T5-xl |
https://huggingface.co/google/t5-xl-ssm-nq |
35.6 |
T5-xxl |
https://huggingface.co/google/t5-xxl-ssm-nq |
37.9 |
T5-3b |
https://huggingface.co/google/t5-3b-ssm-nq |
33.2 |
T5-11b |
https://huggingface.co/google/t5-11b-ssm-nq |
36.6 |
相關鏈接
摘要
近期研究發現,在非結構化文本上訓練的神經語言模型可以使用自然語言查詢隱式地存儲和檢索知識。在這篇簡短的論文中,我們通過微調預訓練模型在不訪問任何外部上下文或知識的情況下回答問題,來衡量這種方法的實際效用。我們表明,這種方法隨著模型規模的增大而表現更好,並且在回答問題時與從外部知識源顯式檢索答案的開放域系統具有競爭力。為了便於復現和未來研究,我們在https://goo.gle/t5-cbqa 上發佈了我們的代碼和訓練好的模型。

🔧 技術細節
文檔中未提及具體技術實現細節,故跳過此章節。
📄 許可證
本模型使用的許可證為:apache-2.0。
⚠️ 重要提示
該模型在Natural Questions (NQ)的全部訓練分割數據上進行了10000步的微調。
💡 使用建議
文檔中未提及使用建議,故跳過此提示。