Zefiro 7b Beta ITA V0.1
Zefiro 是一個基於 Mistral 的意大利語 SFT 微調模型,旨在創建適合意大利語的開源模型和數據集。
下載量 2,629
發布時間 : 1/9/2024
模型概述
Zefiro 是將 Zephyr 模型移植到意大利語的成果,使用了 alignment-handbook 的配方,並借鑑了 Llamantino 模型的見解。該模型適合意大利語特定對話任務。
模型特點
意大利語優化
專門針對意大利語進行微調,適合意大利語對話任務。
開源模型
基於開源模型 Mistral 和 Zephyr,遵循 Apache 2.0 許可證。
合成數據訓練
使用 UltraChat-ITA 數據集的過濾和預處理版本進行訓練。
模型能力
意大利語文本生成
對話任務處理
多輪對話支持
使用案例
對話系統
飲食計劃生成
生成每週午餐和晚餐的飲食清單。
政治觀點分析
回答關於意大利政治的問題。
🚀 Zefiro-7B-Beta-ITA-v0.1模型
Zefiro是基於Mistral的意大利語SFT微調模型。本項目旨在創建適用於意大利語的開源模型和數據集,此為首個實驗模型,可作為意大利語特定對話任務的基礎模型。
🚀 快速開始
若要使用🤗 Transformers運行該模型,可參考以下代碼:
# Install transformers from source - only needed for versions <= v4.34
# pip install git+https://github.com/huggingface/transformers.git
# pip install accelerate
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "giux78/zefiro-7b-beta-ITA-v0.1"
model = AutoModelForCausalLM.from_pretrained(model_id)
model.to('cuda')
tokenizer = AutoTokenizer.from_pretrained(model_id, padding_side="left")
sys_prompt = "Sei un assistente disponibile, rispettoso e onesto. " \
"Rispondi sempre nel modo piu' utile possibile, pur essendo sicuro. " \
"Le risposte non devono includere contenuti dannosi, non etici, razzisti, sessisti, tossici, pericolosi o illegali. " \
"Assicurati che le tue risposte siano socialmente imparziali e positive. " \
"Se una domanda non ha senso o non e' coerente con i fatti, spiegane il motivo invece di rispondere in modo non corretto. " \
"Se non conosci la risposta a una domanda, non condividere informazioni false."
messages = [{ 'content' : sys_prompt, 'role' : 'assistant'},
{'content' : 'Crea una lista su cosa mangiare a pranzo ogni giorno della settimana a pranzo e cena', 'role' : 'user'}]
def generate_text(sys_prompt, user_prompt):
messages = [{ 'content' : sys_prompt, 'role' : 'assistant'},
{'content' : user_prompt, 'role' : 'user'}]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
model_inputs = tokenizer([prompt], return_tensors="pt").to("cuda")
generated_ids = model.generate(**model_inputs, max_new_tokens=1024)
return tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
generate_text(sys_prompt, 'cosa ne pensi della politica italiana?')
✨ 主要特性
- 基於Mistral架構,專為意大利語進行SFT微調。
- 可作為意大利語特定對話任務的基礎模型。
📦 安裝指南
運行模型前,需安裝必要的庫:
# Install transformers from source - only needed for versions <= v4.34
pip install git+https://github.com/huggingface/transformers.git
pip install accelerate
💻 使用示例
基礎用法
# Install transformers from source - only needed for versions <= v4.34
# pip install git+https://github.com/huggingface/transformers.git
# pip install accelerate
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "giux78/zefiro-7b-beta-ITA-v0.1"
model = AutoModelForCausalLM.from_pretrained(model_id)
model.to('cuda')
tokenizer = AutoTokenizer.from_pretrained(model_id, padding_side="left")
sys_prompt = "Sei un assistente disponibile, rispettoso e onesto. " \
"Rispondi sempre nel modo piu' utile possibile, pur essendo sicuro. " \
"Le risposte non devono includere contenuti dannosi, non etici, razzisti, sessisti, tossici, pericolosi o illegali. " \
"Assicurati che le tue risposte siano socialmente imparziali e positive. " \
"Se una domanda non ha senso o non e' coerente con i fatti, spiegane il motivo invece di rispondere in modo non corretto. " \
"Se non conosci la risposta a una domanda, non condividere informazioni false."
messages = [{ 'content' : sys_prompt, 'role' : 'assistant'},
{'content' : 'Crea una lista su cosa mangiare a pranzo ogni giorno della settimana a pranzo e cena', 'role' : 'user'}]
def generate_text(sys_prompt, user_prompt):
messages = [{ 'content' : sys_prompt, 'role' : 'assistant'},
{'content' : user_prompt, 'role' : 'user'}]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
model_inputs = tokenizer([prompt], return_tensors="pt").to("cuda")
generated_ids = model.generate(**model_inputs, max_new_tokens=1024)
return tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
generate_text(sys_prompt, 'cosa ne pensi della politica italiana?')
高級用法
在更復雜的對話場景中,可根據具體需求調整sys_prompt
和user_prompt
的內容,以獲取更符合預期的回覆。
📚 詳細文檔
模型詳情
Zefiro是將Zephyr模型移植到意大利語的版本,借鑑了alignment-handbook的方法,同時也從Llamantino模型中獲得靈感。在實現過程中,結合了上述兩個模型以及開源社區的不同方法。
模型描述
屬性 | 詳情 |
---|---|
模型類型 | 一個具有70億參數的類GPT模型,在公開可用的合成數據集上進行微調。 |
語言 | 主要為意大利語 |
許可證 | Apache 2 |
微調基礎模型 | mistralai/Mistral-7B-v0.1 |
開發者 | giux78 |
資助方 | Business Operating System |
預期用途與限制
該模型最初在經過過濾和預處理的UltraChat-ITA數據集上進行微調,該數據集是UltraChat
數據集的過濾版本,包含ChatGPT生成的各種合成對話。
偏差、風險和限制
Zefiro-7b-beta-ITA-v0.1未在RLHF階段進行人類偏好對齊,也未像ChatGPT那樣對回覆進行即時過濾,因此可能會產生有問題的輸出(尤其是在特定提示下)。此外,不清楚基礎模型(mistralai/Mistral-7B-v0.1
)的訓練語料庫的規模和組成,但可能包含網絡數據、書籍和代碼等技術來源。可參考Falcon 180B模型卡片瞭解相關情況。
訓練數據
使用UltraChat-ITA作為訓練數據,這是UltraChat
的過濾版本。在翻譯數據集時,結合了不同的工具和API,目前正在評估最佳的翻譯方法。翻譯階段至關重要,可能會引入語法和語義錯誤。
總結
Zefiro-7b-beta-ITA-v0.1是使用zephyr方法對mistral-7b進行微調的意大利語版本。
📄 許可證
本模型採用Apache 2.0許可證。
引用
@misc{tunstall2023zephyr,
title={Zephyr: Direct Distillation of LM Alignment},
author={Lewis Tunstall and Edward Beeching and Nathan Lambert and Nazneen Rajani and Kashif Rasul and Younes Belkada and Shengyi Huang and Leandro von Werra and Clémentine Fourrier and Nathan Habib and Nathan Sarrazin and Omar Sanseviero and Alexander M. Rush and Thomas Wolf},
year={2023},
eprint={2310.16944},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
@misc{basile2023llamantino,
title={LLaMAntino: LLaMA 2 Models for Effective Text Generation in Italian Language},
author={Pierpaolo Basile and Elio Musacchio and Marco Polignano and Lucia Siciliani and Giuseppe Fiameni and Giovanni Semeraro},
year={2023},
eprint={2312.09993},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
模型卡片作者
模型卡片聯繫方式
ale.ercolani@gmail.com
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