alexmarques commited on
Commit
b6815a6
·
verified ·
1 Parent(s): 33b5f2b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +23 -14
README.md CHANGED
@@ -111,32 +111,41 @@ The [llm-compressor](https://github.com/vllm-project/llm-compressor) library is
111
 
112
  ## Deployment
113
 
114
- This model can be deployed efficiently using the [vLLM](https://docs.vllm.ai/en/latest/) backend, as shown in the example below.
 
 
 
 
 
115
 
116
  ```python
117
- from vllm import LLM, SamplingParams
118
- from transformers import AutoProcessor
119
 
120
- model_id = "RedHatAI/Mistral-Small-3.1-24B-Instruct-2503-FP8-dynamic"
121
- number_gpus = 4
 
122
 
123
- sampling_params = SamplingParams(temperature=0.7, top_p=0.8, max_tokens=256)
124
- processor = AutoProcessor.from_pretrained(model_id)
 
 
125
 
126
- messages = [{"role": "user", "content": "Give me a short introduction to large language model."}]
127
 
128
- prompts = processor.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
129
 
130
- llm = LLM(model=model_id, tensor_parallel_size=number_gpus)
 
 
131
 
132
- outputs = llm.generate(prompts, sampling_params)
 
 
 
133
 
134
- generated_text = outputs[0].outputs[0].text
135
  print(generated_text)
136
  ```
137
 
138
- vLLM aslo supports OpenAI-compatible serving. See the [documentation](https://docs.vllm.ai/en/latest/) for more details.
139
-
140
  <details>
141
  <summary>Deploy on <strong>Red Hat AI Inference Server</strong></summary>
142
 
 
111
 
112
  ## Deployment
113
 
114
+ 1. Initialize vLLM server:
115
+ ```
116
+ vllm serve RedHatAI/Mistral-Small-3.1-24B-Instruct-2503-quantized.w4a16 --tensor_parallel_size 1 --tokenizer_mode mistral
117
+ ```
118
+
119
+ 2. Send requests to the server:
120
 
121
  ```python
122
+ from openai import OpenAI
 
123
 
124
+ # Modify OpenAI's API key and API base to use vLLM's API server.
125
+ openai_api_key = "EMPTY"
126
+ openai_api_base = "http://<your-server-host>:8000/v1"
127
 
128
+ client = OpenAI(
129
+ api_key=openai_api_key,
130
+ base_url=openai_api_base,
131
+ )
132
 
133
+ model = "RedHatAI/Mistral-Small-3.1-24B-Instruct-2503-quantized.w4a16"
134
 
 
135
 
136
+ messages = [
137
+ {"role": "user", "content": "Explain quantum mechanics clearly and concisely."},
138
+ ]
139
 
140
+ outputs = client.chat.completions.create(
141
+ model=model,
142
+ messages=messages,
143
+ )
144
 
145
+ generated_text = outputs.choices[0].message.content
146
  print(generated_text)
147
  ```
148
 
 
 
149
  <details>
150
  <summary>Deploy on <strong>Red Hat AI Inference Server</strong></summary>
151