🚀 文本摘要模型 - Llama 3.1 微調版
本項目是針對文本摘要任務對 Llama 3.1 進行微調後的版本,支持英語、西班牙語和中文,能有效助力不同語言場景下的文本摘要工作。
🚀 快速開始
本模型可直接用於英語、西班牙語和中文的文本摘要任務。你可以藉助 Hugging Face 提供的工具和庫,輕鬆加載並使用該模型。
✨ 主要特性
- 多語言支持:支持英語、西班牙語和中文,適用於不同語言環境下的文本摘要。
- 強大的基礎模型:基於 Meta 的 Llama 3.1 多語言大語言模型,在行業基準測試中表現出色。
- 優化架構:採用優化的變壓器架構,結合監督微調(SFT)和基於人類反饋的強化學習(RLHF),更符合人類對有用性和安全性的偏好。
📦 安裝指南
暫未提供相關安裝步驟,可關注後續更新。
💻 使用示例
基礎用法
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
model_name = "your_model_path"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
input_text = "Hugging Face: Revolutionizing Natural Language Processing Introduction In the rapidly evolving field of Natural Language Processing (NLP), Hugging Face has emerged as a prominent and innovative force. This article will explore the story and significance of Hugging Face, a company that has made remarkable contributions to NLP and AI as a whole. From its inception to its role in democratizing AI, Hugging Face has left an indelible mark on the industry."
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
summary_ids = model.generate(input_ids)
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
print("摘要:", summary)
高級用法
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
model_name = "your_model_path"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
input_text = "Hugging Face: Revolutionizing Natural Language Processing Introduction In the rapidly evolving field of Natural Language Processing (NLP), Hugging Face has emerged as a prominent and innovative force. This article will explore the story and significance of Hugging Face, a company that has made remarkable contributions to NLP and AI as a whole. From its inception to its role in democratizing AI, Hugging Face has left an indelible mark on the industry."
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
summary_ids = model.generate(input_ids, max_length=100, min_length=30, repetition_penalty=1.2)
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
print("摘要:", summary)
📚 詳細文檔
模型信息
這是 Llama 3.1 的微調版本,針對英語、西班牙語和中文的文本摘要任務進行了訓練。
Meta 的 Llama 3.1 多語言大語言模型(LLMs)集合包含 8B、70B 和 405B 規模的預訓練和指令微調生成模型(文本輸入/文本輸出)。Llama 3.1 僅文本的指令微調模型(8B、70B、405B)針對多語言對話用例進行了優化,在常見的行業基準測試中優於許多可用的開源和閉源聊天模型。
模型開發者:Meta
模型架構:Llama 3.1 是一種自迴歸語言模型,採用了優化的變壓器架構。微調版本使用監督微調(SFT)和基於人類反饋的強化學習(RLHF),以符合人類對有用性和安全性的偏好。
🔧 技術細節
Llama 3.1 作為自迴歸語言模型,其優化的變壓器架構使得模型在處理長文本時更加高效。監督微調(SFT)通過大量的標註數據,讓模型學習到如何生成符合要求的摘要;基於人類反饋的強化學習(RLHF)則進一步根據人類的偏好對模型進行優化,提高摘要的質量和安全性。
📄 許可證
本模型遵循 Apache-2.0 許可證。