Instructions to use ariG23498/Mistral-7B-Instruct-v0.3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ariG23498/Mistral-7B-Instruct-v0.3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ariG23498/Mistral-7B-Instruct-v0.3")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ariG23498/Mistral-7B-Instruct-v0.3") model = AutoModelForCausalLM.from_pretrained("ariG23498/Mistral-7B-Instruct-v0.3", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ariG23498/Mistral-7B-Instruct-v0.3 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ariG23498/Mistral-7B-Instruct-v0.3" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ariG23498/Mistral-7B-Instruct-v0.3", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ariG23498/Mistral-7B-Instruct-v0.3
- SGLang
How to use ariG23498/Mistral-7B-Instruct-v0.3 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 "ariG23498/Mistral-7B-Instruct-v0.3" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ariG23498/Mistral-7B-Instruct-v0.3", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "ariG23498/Mistral-7B-Instruct-v0.3" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ariG23498/Mistral-7B-Instruct-v0.3", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ariG23498/Mistral-7B-Instruct-v0.3 with Docker Model Runner:
docker model run hf.co/ariG23498/Mistral-7B-Instruct-v0.3
Turns out that Mistral-7B-Instruct-v0.3 only have safetensors. This repo
is created to have the .bin files of the model.
This repo is created by:
model_id = "mistralai/Mistral-7B-Instruct-v0.3"
model = AutoModelForCausalLM.from_pretrained(model_id)
model.push_to_hub("ariG23498/Mistral-7B-Instruct-v0.3", safe_serialization=False)
This is due to the fact that the TensorFlow port cannot use safetensors and need bin files.
You can use this model with TF like so:
model_tf = TFAutoModelForCausalLM.from_pretrained("ariG23498/Mistral-7B-Instruct-v0.3", from_pt=True)
tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.3")
prompt = "My favourite condiment is"
model_inputs = tokenizer([prompt], return_tensors="tf")
generated_ids = model_tf.generate(**model_inputs, max_new_tokens=100, do_sample=True)
tokenizer.batch_decode(generated_ids)[0]
As soon as the safetensors and TensorFlow issue is sorted one can ditch this repository and use the official repository!
Update:
I have uploaded the .h5 models as well. You can now use the following and make the entire code work!
model_tf = TFAutoModelForCausalLM.from_pretrained("ariG23498/Mistral-7B-Instruct-v0.3")
- Downloads last month
- 16
Model tree for ariG23498/Mistral-7B-Instruct-v0.3
Unable to build the model tree, the base model loops to the model itself. Learn more.