Instructions to use RedHatAI/OpenHermes-2.5-Mistral-7B-pruned50-quant-ds with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RedHatAI/OpenHermes-2.5-Mistral-7B-pruned50-quant-ds with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RedHatAI/OpenHermes-2.5-Mistral-7B-pruned50-quant-ds") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("RedHatAI/OpenHermes-2.5-Mistral-7B-pruned50-quant-ds") model = AutoModelForCausalLM.from_pretrained("RedHatAI/OpenHermes-2.5-Mistral-7B-pruned50-quant-ds", 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use RedHatAI/OpenHermes-2.5-Mistral-7B-pruned50-quant-ds with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RedHatAI/OpenHermes-2.5-Mistral-7B-pruned50-quant-ds" # 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/OpenHermes-2.5-Mistral-7B-pruned50-quant-ds", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/RedHatAI/OpenHermes-2.5-Mistral-7B-pruned50-quant-ds
- SGLang
How to use RedHatAI/OpenHermes-2.5-Mistral-7B-pruned50-quant-ds 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/OpenHermes-2.5-Mistral-7B-pruned50-quant-ds" \ --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/OpenHermes-2.5-Mistral-7B-pruned50-quant-ds", "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/OpenHermes-2.5-Mistral-7B-pruned50-quant-ds" \ --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/OpenHermes-2.5-Mistral-7B-pruned50-quant-ds", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use RedHatAI/OpenHermes-2.5-Mistral-7B-pruned50-quant-ds with Docker Model Runner:
docker model run hf.co/RedHatAI/OpenHermes-2.5-Mistral-7B-pruned50-quant-ds
Create recipe.yaml
Browse files- recipe.yaml +31 -0
recipe.yaml
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
test_stage:
|
| 2 |
+
obcq_modifiers:
|
| 3 |
+
QuantizationModifier:
|
| 4 |
+
ignore:
|
| 5 |
+
# These operations don't make sense to quantize
|
| 6 |
+
- MistralRotaryEmbedding
|
| 7 |
+
- MistralRMSNorm
|
| 8 |
+
- SiLUActivation
|
| 9 |
+
# Skip quantizing the BMMs
|
| 10 |
+
# - QuantizableMatMul
|
| 11 |
+
# Skip quantizing the layers with the most sensitive activations
|
| 12 |
+
- model.layers.1.mlp.down_proj
|
| 13 |
+
- model.layers.31.mlp.down_proj
|
| 14 |
+
- model.layers.30.mlp.down_proj
|
| 15 |
+
- model.layers.30.mlp.gate_proj
|
| 16 |
+
- model.layers.30.mlp.up_proj
|
| 17 |
+
post_oneshot_calibration: true
|
| 18 |
+
scheme_overrides:
|
| 19 |
+
Embedding:
|
| 20 |
+
input_activations: null
|
| 21 |
+
weights:
|
| 22 |
+
num_bits: 8
|
| 23 |
+
symmetric: false
|
| 24 |
+
SparseGPTModifier:
|
| 25 |
+
sparsity: 0.5
|
| 26 |
+
block_size: 128
|
| 27 |
+
sequential_update: true
|
| 28 |
+
quantize: true
|
| 29 |
+
percdamp: 0.01
|
| 30 |
+
mask_structure: "0:0"
|
| 31 |
+
targets: ["re:model.layers.\\d*$"]
|