🚀 Mistral-7B-Instruct-v0.1分片版本
這是Mistral-7B-Instruct-v0.1的分片版本,當你的CPU內存有限時可以使用它。
🚀 快速開始
Mistral-7B-Instruct-v0.1大語言模型(LLM)是Mistral-7B-v0.1生成式文本模型的指令微調版本,它使用了各種公開可用的對話數據集進行微調。
如需瞭解該模型的完整詳情,請閱讀我們的發佈博客文章。
✨ 主要特性
指令格式
為了利用指令微調,你的提示語應該用 [INST]
和 [\INST]
標記包圍。第一條指令應從句子起始標識符開始,後續指令則不需要。助手生成的內容將以句子結束標識符結束。
💻 使用示例
基礎用法
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cuda"
model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.1")
tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.1")
text = "<s>[INST] What is your favourite condiment? [/INST]"
"Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!</s> "
"[INST] Do you have mayonnaise recipes? [/INST]"
encodeds = tokenizer(text, return_tensors="pt", add_special_tokens=False)
model_inputs = encodeds.to(device)
model.to(device)
generated_ids = model.generate(**model_inputs, max_new_tokens=1000, do_sample=True)
decoded = tokenizer.batch_decode(generated_ids)
print(decoded[0])
🔧 技術細節
模型架構
這個指令模型基於Mistral-7B-v0.1,這是一個具有以下架構選擇的Transformer模型:
- 分組查詢注意力(Grouped-Query Attention)
- 滑動窗口注意力(Sliding-Window Attention)
- 字節回退BPE分詞器(Byte-fallback BPE tokenizer)
📄 許可證
本項目採用Apache-2.0許可證。
團隊信息
Mistral AI團隊
Albert Jiang、Alexandre Sablayrolles、Arthur Mensch、Chris Bamford、Devendra Singh Chaplot、Diego de las Casas、Florian Bressand、Gianna Lengyel、Guillaume Lample、Lélio Renard Lavaud、Lucile Saulnier、Marie-Anne Lachaux、Pierre Stock、Teven Le Scao、Thibaut Lavril、Thomas Wang、Timothée Lacroix、William El Sayed。