Update README.md
#2
by
robgreenberg3
- opened
README.md
CHANGED
@@ -19,7 +19,14 @@ tags:
|
|
19 |
- int8
|
20 |
---
|
21 |
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
## Model Overview
|
25 |
- **Model Architecture:** Phi3ForCausalLM
|
@@ -83,6 +90,158 @@ print(generated_text)
|
|
83 |
|
84 |
vLLM aslo supports OpenAI-compatible serving. See the [documentation](https://docs.vllm.ai/en/latest/) for more details.
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
## Creation
|
87 |
|
88 |
<details>
|
|
|
19 |
- int8
|
20 |
---
|
21 |
|
22 |
+
<h1 style="display: flex; align-items: center; gap: 10px; margin: 0;">
|
23 |
+
phi-4-quantized.w8a8
|
24 |
+
<img src="https://www.redhat.com/rhdc/managed-files/Catalog-Validated_model_0.png" alt="Model Icon" width="40" style="margin: 0; padding: 0;" />
|
25 |
+
</h1>
|
26 |
+
|
27 |
+
<a href="https://www.redhat.com/en/products/ai/validated-models" target="_blank" style="margin: 0; padding: 0;">
|
28 |
+
<img src="https://www.redhat.com/rhdc/managed-files/Validated_badge-Dark.png" alt="Validated Badge" width="250" style="margin: 0; padding: 0;" />
|
29 |
+
</a>
|
30 |
|
31 |
## Model Overview
|
32 |
- **Model Architecture:** Phi3ForCausalLM
|
|
|
90 |
|
91 |
vLLM aslo supports OpenAI-compatible serving. See the [documentation](https://docs.vllm.ai/en/latest/) for more details.
|
92 |
|
93 |
+
<details>
|
94 |
+
<summary>Deploy on <strong>Red Hat AI Inference Server</strong></summary>
|
95 |
+
|
96 |
+
```bash
|
97 |
+
$ podman run --rm -it --device nvidia.com/gpu=all -p 8000:8000 \
|
98 |
+
--ipc=host \
|
99 |
+
--env "HUGGING_FACE_HUB_TOKEN=$HF_TOKEN" \
|
100 |
+
--env "HF_HUB_OFFLINE=0" -v ~/.cache/vllm:/home/vllm/.cache \
|
101 |
+
--name=vllm \
|
102 |
+
registry.access.redhat.com/rhaiis/rh-vllm-cuda \
|
103 |
+
vllm serve \
|
104 |
+
--tensor-parallel-size 8 \
|
105 |
+
--max-model-len 32768 \
|
106 |
+
--enforce-eager --model RedHatAI/phi-4-quantized.w8a8
|
107 |
+
```
|
108 |
+
See [Red Hat AI Inference Server documentation](https://docs.redhat.com/en/documentation/red_hat_ai_inference_server/) for more details.
|
109 |
+
</details>
|
110 |
+
|
111 |
+
<details>
|
112 |
+
<summary>Deploy on <strong>Red Hat Enterprise Linux AI</strong></summary>
|
113 |
+
|
114 |
+
```bash
|
115 |
+
# Download model from Red Hat Registry via docker
|
116 |
+
# Note: This downloads the model to ~/.cache/instructlab/models unless --model-dir is specified.
|
117 |
+
ilab model download --repository docker://registry.redhat.io/rhelai1/phi-4-quantized-w8a8:1.5
|
118 |
+
```
|
119 |
+
|
120 |
+
```bash
|
121 |
+
# Serve model via ilab
|
122 |
+
ilab model serve --model-path ~/.cache/instructlab/models/phi-4-quantized-w8a8
|
123 |
+
|
124 |
+
# Chat with model
|
125 |
+
ilab model chat --model ~/.cache/instructlab/models/phi-4-quantized-w8a8
|
126 |
+
```
|
127 |
+
See [Red Hat Enterprise Linux AI documentation](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux_ai/1.4) for more details.
|
128 |
+
</details>
|
129 |
+
|
130 |
+
<details>
|
131 |
+
<summary>Deploy on <strong>Red Hat Openshift AI</strong></summary>
|
132 |
+
|
133 |
+
```python
|
134 |
+
# Setting up vllm server with ServingRuntime
|
135 |
+
# Save as: vllm-servingruntime.yaml
|
136 |
+
apiVersion: serving.kserve.io/v1alpha1
|
137 |
+
kind: ServingRuntime
|
138 |
+
metadata:
|
139 |
+
name: vllm-cuda-runtime # OPTIONAL CHANGE: set a unique name
|
140 |
+
annotations:
|
141 |
+
openshift.io/display-name: vLLM NVIDIA GPU ServingRuntime for KServe
|
142 |
+
opendatahub.io/recommended-accelerators: '["nvidia.com/gpu"]'
|
143 |
+
labels:
|
144 |
+
opendatahub.io/dashboard: 'true'
|
145 |
+
spec:
|
146 |
+
annotations:
|
147 |
+
prometheus.io/port: '8080'
|
148 |
+
prometheus.io/path: '/metrics'
|
149 |
+
multiModel: false
|
150 |
+
supportedModelFormats:
|
151 |
+
- autoSelect: true
|
152 |
+
name: vLLM
|
153 |
+
containers:
|
154 |
+
- name: kserve-container
|
155 |
+
image: quay.io/modh/vllm:rhoai-2.20-cuda # CHANGE if needed. If AMD: quay.io/modh/vllm:rhoai-2.20-rocm
|
156 |
+
command:
|
157 |
+
- python
|
158 |
+
- -m
|
159 |
+
- vllm.entrypoints.openai.api_server
|
160 |
+
args:
|
161 |
+
- "--port=8080"
|
162 |
+
- "--model=/mnt/models"
|
163 |
+
- "--served-model-name={{.Name}}"
|
164 |
+
env:
|
165 |
+
- name: HF_HOME
|
166 |
+
value: /tmp/hf_home
|
167 |
+
ports:
|
168 |
+
- containerPort: 8080
|
169 |
+
protocol: TCP
|
170 |
+
```
|
171 |
+
|
172 |
+
```python
|
173 |
+
# Attach model to vllm server. This is an NVIDIA template
|
174 |
+
# Save as: inferenceservice.yaml
|
175 |
+
apiVersion: serving.kserve.io/v1beta1
|
176 |
+
kind: InferenceService
|
177 |
+
metadata:
|
178 |
+
annotations:
|
179 |
+
openshift.io/display-name: phi-4-quantized.w8a8 # OPTIONAL CHANGE
|
180 |
+
serving.kserve.io/deploymentMode: RawDeployment
|
181 |
+
name: phi-4-quantized.w8a8 # specify model name. This value will be used to invoke the model in the payload
|
182 |
+
labels:
|
183 |
+
opendatahub.io/dashboard: 'true'
|
184 |
+
spec:
|
185 |
+
predictor:
|
186 |
+
maxReplicas: 1
|
187 |
+
minReplicas: 1
|
188 |
+
model:
|
189 |
+
modelFormat:
|
190 |
+
name: vLLM
|
191 |
+
name: ''
|
192 |
+
resources:
|
193 |
+
limits:
|
194 |
+
cpu: '2' # this is model specific
|
195 |
+
memory: 8Gi # this is model specific
|
196 |
+
nvidia.com/gpu: '1' # this is accelerator specific
|
197 |
+
requests: # same comment for this block
|
198 |
+
cpu: '1'
|
199 |
+
memory: 4Gi
|
200 |
+
nvidia.com/gpu: '1'
|
201 |
+
runtime: vllm-cuda-runtime # must match the ServingRuntime name above
|
202 |
+
storageUri: oci://registry.redhat.io/rhelai1/modelcar-phi-4-quantized-w8a8:1.5
|
203 |
+
tolerations:
|
204 |
+
- effect: NoSchedule
|
205 |
+
key: nvidia.com/gpu
|
206 |
+
operator: Exists
|
207 |
+
```
|
208 |
+
|
209 |
+
```bash
|
210 |
+
# make sure first to be in the project where you want to deploy the model
|
211 |
+
# oc project <project-name>
|
212 |
+
# apply both resources to run model
|
213 |
+
# Apply the ServingRuntime
|
214 |
+
oc apply -f vllm-servingruntime.yaml
|
215 |
+
# Apply the InferenceService
|
216 |
+
oc apply -f qwen-inferenceservice.yaml
|
217 |
+
```
|
218 |
+
|
219 |
+
```python
|
220 |
+
# Replace <inference-service-name> and <cluster-ingress-domain> below:
|
221 |
+
# - Run `oc get inferenceservice` to find your URL if unsure.
|
222 |
+
# Call the server using curl:
|
223 |
+
curl https://<inference-service-name>-predictor-default.<domain>/v1/chat/completions
|
224 |
+
-H "Content-Type: application/json" \
|
225 |
+
-d '{
|
226 |
+
"model": "phi-4-quantized.w8a8",
|
227 |
+
"stream": true,
|
228 |
+
"stream_options": {
|
229 |
+
"include_usage": true
|
230 |
+
},
|
231 |
+
"max_tokens": 1,
|
232 |
+
"messages": [
|
233 |
+
{
|
234 |
+
"role": "user",
|
235 |
+
"content": "How can a bee fly when its wings are so small?"
|
236 |
+
}
|
237 |
+
]
|
238 |
+
}'
|
239 |
+
```
|
240 |
+
|
241 |
+
See [Red Hat Openshift AI documentation](https://docs.redhat.com/en/documentation/red_hat_openshift_ai/2025) for more details.
|
242 |
+
</details>
|
243 |
+
|
244 |
+
|
245 |
## Creation
|
246 |
|
247 |
<details>
|