Text Generation
Transformers
Safetensors
mistral
conversational
Eval Results (legacy)
text-generation-inference
4-bit precision
gptq
Instructions to use RedHatAI/Mistral-7B-Instruct-v0.3-GPTQ-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RedHatAI/Mistral-7B-Instruct-v0.3-GPTQ-4bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RedHatAI/Mistral-7B-Instruct-v0.3-GPTQ-4bit") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("RedHatAI/Mistral-7B-Instruct-v0.3-GPTQ-4bit") model = AutoModelForCausalLM.from_pretrained("RedHatAI/Mistral-7B-Instruct-v0.3-GPTQ-4bit") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use RedHatAI/Mistral-7B-Instruct-v0.3-GPTQ-4bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RedHatAI/Mistral-7B-Instruct-v0.3-GPTQ-4bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RedHatAI/Mistral-7B-Instruct-v0.3-GPTQ-4bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/RedHatAI/Mistral-7B-Instruct-v0.3-GPTQ-4bit
- SGLang
How to use RedHatAI/Mistral-7B-Instruct-v0.3-GPTQ-4bit 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 "RedHatAI/Mistral-7B-Instruct-v0.3-GPTQ-4bit" \ --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": "RedHatAI/Mistral-7B-Instruct-v0.3-GPTQ-4bit", "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 "RedHatAI/Mistral-7B-Instruct-v0.3-GPTQ-4bit" \ --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": "RedHatAI/Mistral-7B-Instruct-v0.3-GPTQ-4bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use RedHatAI/Mistral-7B-Instruct-v0.3-GPTQ-4bit with Docker Model Runner:
docker model run hf.co/RedHatAI/Mistral-7B-Instruct-v0.3-GPTQ-4bit
Model Card for Mistral-7B-Instruct-v0.3 quantized to 4bit weights
- Weight-only quantization of Mistral-7B-Instruct-v0.3 via GPTQ to 4bits with group_size=128
- GPTQ optimized for 99.75% accuracy recovery relative to the unquantized model
Open LLM Leaderboard evaluation scores
| Mistral-7B-Instruct-v0.3 | Mistral-7B-Instruct-v0.3-GPTQ-4bit (this model) |
|
|---|---|---|
| arc-c 25-shot |
63.48 | 63.40 |
| mmlu 5-shot |
61.13 | 60.89 |
| hellaswag 10-shot |
84.49 | 84.04 |
| winogrande 5-shot |
79.16 | 79.08 |
| gsm8k 5-shot |
43.37 | 45.41 |
| truthfulqa 0-shot |
59.65 | 57.48 |
| Average Accuracy |
65.21 | 65.05 |
| Recovery | 100% | 99.75% |
vLLM Inference Performance
This model is ready for optimized inference using the Marlin mixed-precision kernels in vLLM: https://github.com/vllm-project/vllm
Simply start this model as an inference server with:
python -m vllm.entrypoints.openai.api_server --model neuralmagic/Mistral-7B-Instruct-v0.3-GPTQ-4bit
- Downloads last month
- 1,180
Model tree for RedHatAI/Mistral-7B-Instruct-v0.3-GPTQ-4bit
Base model
mistralai/Mistral-7B-v0.3 Finetuned
mistralai/Mistral-7B-Instruct-v0.3Evaluation results
- normalized accuracy on AI2 Reasoning Challenge (25-Shot)test set self-reported63.400
- normalized accuracy on HellaSwag (10-Shot)validation set self-reported84.040
- mc2 on TruthfulQA (0-shot)validation set self-reported57.480
- accuracy on GSM8k (5-shot)test set self-reported45.410
- accuracy on MMLU (5-Shot)test set self-reported61.070
- accuracy on Winogrande (5-shot)validation set self-reported79.080
