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