Llammas
Llammas是基于Llama-2-7B模型适配爱沙尼亚语的开源对话模型,通过两阶段训练实现跨语言知识迁移
下载量 400
发布时间 : 11/29/2023
模型简介
该模型通过持续预训练和指令微调专门适配爱沙尼亚语,支持双语对话、文本生成和指令跟随任务
模型特点
双语支持
专为爱沙尼亚语优化,同时保留英语能力,支持双语混合使用
跨语言知识迁移
通过英语高质量指令数据微调提升爱沙尼亚语表现
对话优化
整合多源对话数据集,优化多轮对话和指令跟随能力
模型能力
双语文本生成
多轮对话
指令跟随
常识推理
翻译辅助
使用案例
教育
语言学习助手
帮助学习爱沙尼亚语的学生进行对话练习和写作指导
提供符合语言习惯的反馈和建议
商业
双语客服
处理爱沙尼亚语和英语的客户咨询
自动生成专业且符合语境的回复
🚀 LLammas 🐑
LLammas是针对爱沙尼亚语对Llama - 2 - 7B进行两阶段指令微调后的模型。它解决了在爱沙尼亚语场景下缺乏高效语言模型的问题,为爱沙尼亚语的文本生成等任务提供了有力支持。
🚀 快速开始
模型使用
- 文本生成管道:
from transformers import pipeline
import torch
pipe = pipeline("text-generation", model="tartuNLP/Llammas", torch_dtype=torch.bfloat16, device_map="auto")
messages = [
{"role": "user", "content": "Tere!"},
{"role": "assistant", "content": "Tere! Kas saaksin teid kuidagi aidata?"},
{"role": "user", "content": "Kuidas alustada kirja kirjutamist?"}
]
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.6, top_k=50, top_p=0.9)
print(outputs[0]["generated_text"][len(prompt):])
- 对话管道:(适用于transformers==4.36.2版本,新版本可能存在输出问题)
from transformers import pipeline, Conversation
import torch
pipe = pipeline("conversational", model="tartuNLP/Llammas", torch_dtype=torch.bfloat16, device_map="auto")
messages = [
{"role": "user", "content": "Tere!"},
{"role": "assistant", "content": "Tere! Kas saaksin teid kuidagi aidata?"},
{"role": "user", "content": "Kuidas alustada kirja kirjutamist?"}
]
conversation = Conversation(messages)
conversation = pipe(conversation)
- 对话格式:
<|user|>
Tere!
<|assistant|>
Tere! Kas saaksin teid kuidagi aidata?</s>
<|user|>
Kuidas alustada kirja kirjutamist?
<|assistant|>
Kirja kirjutamiseks alustage tervitusega, näiteks "Tere!" või "Tere hommikust!". Seejärel tutvustage ennast ja mainige, kellega kirjutate. Kirjeldage oma mõtteid või küsimusi, mida soovite arutada. Lõpetage kiri viisakalt, näiteks "Tänan teid tähelepanu eest!" või "Parimate soovidega!"</s>
✨ 主要特性
- 两阶段微调:
- 持续预训练:使用包含50亿个标记的CulturaX数据集进行持续预训练,其中75%的文档为爱沙尼亚语,25%为英语(详见 Llammas-base)。
- 指令微调:使用Alpaca - cleaned、Alpaca - est、OASST1排名前1的英语对话、CoT和FLAN - V2(遵循open - instruct,各10000条)、WMT18英爱翻译开发数据(作为文档)以及通用MTee验证英爱保留数据进行指令微调。
- 特定数据集:Alpaca - est 是一个使用 gpt - 3.5 - turbo - 0613 为爱沙尼亚语生成的指令数据集,遵循Alpaca格式。更多详细信息可参考我们的 论文。
📚 详细文档
额外资源
- 论文:https://aclanthology.org/2024.findings-naacl.210/
- 代码:github.com/TartuNLP/llammas
- 基础模型:tartuNLP/Llammas-base
- 4位量化GGUF模型:AlbertUnn/LlammasGGUF
- Alpaca - est数据集:github.com/TartuNLP/alpaca-est
📄 许可证
引用信息
@inproceedings{kuulmets-etal-2024-teaching,
title = "Teaching Llama a New Language Through Cross-Lingual Knowledge Transfer",
author = "Kuulmets, Hele-Andra and
Purason, Taido and
Luhtaru, Agnes and
Fishel, Mark",
editor = "Duh, Kevin and
Gomez, Helena and
Bethard, Steven",
booktitle = "Findings of the Association for Computational Linguistics: NAACL 2024",
month = jun,
year = "2024",
address = "Mexico City, Mexico",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2024.findings-naacl.210",
doi = "10.18653/v1/2024.findings-naacl.210",
pages = "3309--3325",
abstract = "This paper explores cost-efficient methods to adapt pretrained Large Language Models (LLMs) to new lower-resource languages, with a specific focus on Estonian. Leveraging the Llama 2 model, we investigate the impact of combining cross-lingual instruction-tuning with additional monolingual pretraining. Our results demonstrate that even a relatively small amount of additional monolingual pretraining followed by cross-lingual instruction-tuning significantly enhances results on Estonian. Furthermore, we showcase cross-lingual knowledge transfer from high-quality English instructions to Estonian, resulting in improvements in commonsense reasoning and multi-turn conversation capabilities. Our best model, named Llammas, represents the first open-source instruction-following LLM for Estonian. Additionally, we publish Alpaca-est, the first general task instruction dataset for Estonia. These contributions mark the initial progress in the direction of developing open-source LLMs for Estonian.",
}
📦 信息表格
属性 | 详情 |
---|---|
模型类型 | 针对爱沙尼亚语进行两阶段指令微调的Llama - 2 - 7B模型 |
训练数据 | 持续预训练:CulturaX数据集(50亿标记,75%爱沙尼亚语文档,25%英语文档);指令微调:Alpaca - cleaned、Alpaca - est、OASST1英语对话、CoT、FLAN - V2、WMT18英爱翻译开发数据、通用MTee验证英爱保留数据 |
Phi 2 GGUF
其他
Phi-2是微软开发的一个小型但强大的语言模型,具有27亿参数,专注于高效推理和高质量文本生成。
大型语言模型 支持多种语言
P
TheBloke
41.5M
205
Roberta Large
MIT
基于掩码语言建模目标预训练的大型英语语言模型,采用改进的BERT训练方法
大型语言模型 英语
R
FacebookAI
19.4M
212
Distilbert Base Uncased
Apache-2.0
DistilBERT是BERT基础模型的蒸馏版本,在保持相近性能的同时更轻量高效,适用于序列分类、标记分类等自然语言处理任务。
大型语言模型 英语
D
distilbert
11.1M
669
Llama 3.1 8B Instruct GGUF
Meta Llama 3.1 8B Instruct 是一个多语言大语言模型,针对多语言对话用例进行了优化,在常见的行业基准测试中表现优异。
大型语言模型 英语
L
modularai
9.7M
4
Xlm Roberta Base
MIT
XLM-RoBERTa是基于100种语言的2.5TB过滤CommonCrawl数据预训练的多语言模型,采用掩码语言建模目标进行训练。
大型语言模型 支持多种语言
X
FacebookAI
9.6M
664
Roberta Base
MIT
基于Transformer架构的英语预训练模型,通过掩码语言建模目标在海量文本上训练,支持文本特征提取和下游任务微调
大型语言模型 英语
R
FacebookAI
9.3M
488
Opt 125m
其他
OPT是由Meta AI发布的开放预训练Transformer语言模型套件,参数量从1.25亿到1750亿,旨在对标GPT-3系列性能,同时促进大规模语言模型的开放研究。
大型语言模型 英语
O
facebook
6.3M
198
1
基于transformers库的预训练模型,适用于多种NLP任务
大型语言模型
Transformers

1
unslothai
6.2M
1
Llama 3.1 8B Instruct
Llama 3.1是Meta推出的多语言大语言模型系列,包含8B、70B和405B参数规模,支持8种语言和代码生成,优化了多语言对话场景。
大型语言模型
Transformers 支持多种语言

L
meta-llama
5.7M
3,898
T5 Base
Apache-2.0
T5基础版是由Google开发的文本到文本转换Transformer模型,参数规模2.2亿,支持多语言NLP任务。
大型语言模型 支持多种语言
T
google-t5
5.4M
702
精选推荐AI模型
Llama 3 Typhoon V1.5x 8b Instruct
专为泰语设计的80亿参数指令模型,性能媲美GPT-3.5-turbo,优化了应用场景、检索增强生成、受限生成和推理任务
大型语言模型
Transformers 支持多种语言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一个基于SODA数据集训练的超小型对话模型,专为边缘设备推理设计,体积仅为Cosmo-3B模型的2%左右。
对话系统
Transformers 英语

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基于RoBERTa架构的中文抽取式问答模型,适用于从给定文本中提取答案的任务。
问答系统 中文
R
uer
2,694
98
智启未来,您的人工智能解决方案智库
简体中文