🚀 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。