Instructions to use mistralai/Mistral-7B-Instruct-v0.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mistralai/Mistral-7B-Instruct-v0.1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mistralai/Mistral-7B-Instruct-v0.1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.1") model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.1", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mistralai/Mistral-7B-Instruct-v0.1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Install mistral-common: pip install --upgrade mistral-common # Start the vLLM server: vllm serve "mistralai/Mistral-7B-Instruct-v0.1" --tokenizer_mode mistral --config_format mistral --load_format mistral --tool-call-parser mistral --enable-auto-tool-choice # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mistralai/Mistral-7B-Instruct-v0.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mistralai/Mistral-7B-Instruct-v0.1
- SGLang
How to use mistralai/Mistral-7B-Instruct-v0.1 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "mistralai/Mistral-7B-Instruct-v0.1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mistralai/Mistral-7B-Instruct-v0.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "mistralai/Mistral-7B-Instruct-v0.1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mistralai/Mistral-7B-Instruct-v0.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use mistralai/Mistral-7B-Instruct-v0.1 with Docker Model Runner:
docker model run hf.co/mistralai/Mistral-7B-Instruct-v0.1
Access request for Mistral model
Hello,
I am a developer working on a project to run the Mistral 7B model locally with ONNX. I need access to download the tokenizer and model files to continue my work. Thank you very much for your consideration.
Hello,
I would like to cancel my access request for version 0.1 of the model, as I am now requesting access for version 0.3 instead. Please disregard my previous request.
Thank you for your understanding.
Best regards,
me too i'd love access :)
For accessing this model required permission because it's a gated repo. For permission, please follow the steps: - login hugging face->click https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1->click on Access Repository->click on Request Access->click on agree-> some time its given access instantly or take few min.
Hello,
I’m a developer currently working on a project that requires running the Mistral 7B model via API inference. I’d like to request access to the model for evaluation and integration purposes.
Thank you for your time and consideration.
Best regards,
For accessing this model required permission because it's a gated repo. For permission, please follow the steps: - login hugging face->click https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1->click on Access Repository->click on Request Access->click on agree-> some time its given access instantly or take few min.
I tried that but its still not working even when it says "You have been granted the access".
Did you all received access later after messaging here?
Leaving messages and dirtying up the 'list' is the wrong way to do it. Following directions, is the correct way.
With luck you pissed them off and wont ever get it.
I am requesting access to the mistralai/Mistral-7B-Instruct-v0.1 model for a non-commercial educational project. I am developing an educational platform that leverages fine-tuned language models to provide Q&A and tutoring features for students, focusing on subjects like math, science, and programming.
Hello,
I would love access to the model "Mistral-7B-Instruct-v0.3" for personal/research use.
Details:
Username: Faruna01
Purpose: Personal project
Email: farunagodwin01@gmail.com
Thanks!