🚀 文本摘要模型 - 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 许可证。