🚀 Mistral-7B-v0.3大语言模型
Mistral-7B-v0.3是一款大语言模型(LLM),它在Mistral-7B-v0.2的基础上扩展了词汇表。该模型为自然语言处理任务提供了更强大的能力和更广泛的表达范围。
🚀 快速开始
Mistral-7B-v0.3大语言模型在自然语言处理领域展现出强大的能力。下面将为你介绍它的安装、下载、使用示例等内容。
✨ 主要特性
📦 安装指南
建议使用 mistral-inference 来使用 mistralai/Mistral-7B-v0.3
。以下是安装命令:
pip install mistral_inference
💻 使用示例
基础用法
下载模型
from huggingface_hub import snapshot_download
from pathlib import Path
mistral_models_path = Path.home().joinpath('mistral_models', '7B-v0.3')
mistral_models_path.mkdir(parents=True, exist_ok=True)
snapshot_download(repo_id="mistralai/Mistral-7B-v0.3", allow_patterns=["params.json", "consolidated.safetensors", "tokenizer.model.v3"], local_dir=mistral_models_path)
运行演示
安装 mistral_inference
后,你可以在环境中使用 mistral-demo
命令。
mistral-demo $HOME/mistral_models/7B-v0.3
运行后可能会输出类似以下内容:
This is a test of the emergency broadcast system. This is only a test.
If this were a real emergency, you would be told what to do.
This is a test
=====================
This is another test of the new blogging software. I’m not sure if I’m going to keep it or not. I’m not sure if I’m going to keep
=====================
This is a third test, mistral AI is very good at testing. 🙂
This is a third test, mistral AI is very good at testing. 🙂
This
=====================
高级用法
使用 transformers
库生成文本
如果你想使用Hugging Face的 transformers
库来生成文本,可以参考以下代码:
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "mistralai/Mistral-7B-v0.3"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
inputs = tokenizer("Hello my name is", return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=20)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
📚 详细文档
局限性说明
Mistral 7B Instruct模型是一个快速演示,表明基础模型可以很容易地进行微调以实现出色的性能。但它没有任何审核机制。我们期待与社区合作,探索使模型更好地遵循规则的方法,以便在需要审核输出的环境中进行部署。
团队信息
Mistral AI团队由以下成员组成:
Albert Jiang, Alexandre Sablayrolles, Alexis Tacnet, Antoine Roux, Arthur Mensch, Audrey Herblin-Stoop, Baptiste Bout, Baudouin de Monicault, Blanche Savary, Bam4d, Caroline Feldman, Devendra Singh Chaplot, Diego de las Casas, Eleonore Arcelin, Emma Bou Hanna, Etienne Metzger, Gianna Lengyel, Guillaume Bour, Guillaume Lample, Harizo Rajaona, Jean-Malo Delignon, Jia Li, Justus Murke, Louis Martin, Louis Ternon, Lucile Saulnier, Lélio Renard Lavaud, Margaret Jennings, Marie Pellat, Marie Torelli, Marie-Anne Lachaux, Nicolas Schuhl, Patrick von Platen, Pierre Stock, Sandeep Subramanian, Sophia Yang, Szymon Antoniak, Teven Le Scao, Thibaut Lavril, Timothée Lacroix, Théophile Gervet, Thomas Wang, Valera Nemychnikova, William El Sayed, William Marshall
📄 许可证
本项目采用Apache-2.0许可证。
⚠️ 重要提示
如果你想了解更多关于我们如何处理您的个人数据的信息,请阅读我们的 隐私政策。