🚀 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許可證。
⚠️ 重要提示
如果你想了解更多關於我們如何處理您的個人數據的信息,請閱讀我們的 隱私政策。