-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add kubernetes support for VisualQnA (#578)
* Add kubernetes support for VisualQnA Signed-off-by: lvliang-intel <[email protected]> * update gmc file Signed-off-by: lvliang-intel <[email protected]> * update pic Signed-off-by: lvliang-intel <[email protected]> --------- Signed-off-by: lvliang-intel <[email protected]>
- Loading branch information
1 parent
80e3e2a
commit 4f7fc39
Showing
9 changed files
with
784 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Deploy VisualQnA in a Kubernetes Cluster | ||
|
||
This document outlines the deployment process for a Visual Question Answering (VisualQnA) application that utilizes the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice components on Intel Xeon servers and Gaudi machines. | ||
|
||
Please install GMC in your Kubernetes cluster, if you have not already done so, by following the steps in Section "Getting Started" at [GMC Install](https://github.com/opea-project/GenAIInfra/tree/main/microservices-connector#readme). We will soon publish images to Docker Hub, at which point no builds will be required, further simplifying install. | ||
|
||
If you have only Intel Xeon machines you could use the visualqna_xeon.yaml file or if you have a Gaudi cluster you could use visualqna_gaudi.yaml | ||
In the below example we illustrate on Xeon. | ||
|
||
## Deploy the VisualQnA application | ||
|
||
1. Create the desired namespace if it does not already exist and deploy the application | ||
```bash | ||
export APP_NAMESPACE=CT | ||
kubectl create ns $APP_NAMESPACE | ||
sed -i "s|namespace: visualqna|namespace: $APP_NAMESPACE|g" ./visualqna_xeon.yaml | ||
kubectl apply -f ./visualqna_xeon.yaml | ||
``` | ||
|
||
2. Check if the application is up and ready | ||
```bash | ||
kubectl get pods -n $APP_NAMESPACE | ||
``` | ||
|
||
3. Deploy a client pod for testing | ||
```bash | ||
kubectl create deployment client-test -n $APP_NAMESPACE --image=python:3.8.13 -- sleep infinity | ||
``` | ||
|
||
4. Check that client pod is ready | ||
```bash | ||
kubectl get pods -n $APP_NAMESPACE | ||
``` | ||
|
||
5. Send request to application | ||
```bash | ||
export CLIENT_POD=$(kubectl get pod -n $APP_NAMESPACE -l app=client-test -o jsonpath={.items..metadata.name}) | ||
export accessUrl=$(kubectl get gmc -n $APP_NAMESPACE -o jsonpath="{.items[?(@.metadata.name=='visualqna')].status.accessUrl}") | ||
kubectl exec "$CLIENT_POD" -n $APP_NAMESPACE -- curl $accessUrl -X POST -d '{"messages": [ | ||
{ | ||
"role": "user", | ||
"content": [ | ||
{ | ||
"type": "text", | ||
"text": "What'\''s in this image?" | ||
}, | ||
{ | ||
"type": "image_url", | ||
"image_url": { | ||
"url": "https://www.ilankelman.org/stopsigns/australia.jpg" | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"max_tokens": 128}' -H 'Content-Type: application/json' > $LOG_PATH/gmc_visualqna.log | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Deploy VisualQnA in Kubernetes Cluster | ||
|
||
> [NOTE] | ||
> You can also customize the "LVM_MODEL_ID" if needed. | ||
> You need to make sure you have created the directory `/mnt/opea-models` to save the cached model on the node where the visualqna workload is running. Otherwise, you need to modify the `visualqna.yaml` file to change the `model-volume` to a directory that exists on the node. | ||
## Deploy On Xeon | ||
|
||
``` | ||
cd GenAIExamples/visualqna/kubernetes/manifests/xeon | ||
kubectl apply -f visualqna.yaml | ||
``` | ||
|
||
## Deploy On Gaudi | ||
|
||
``` | ||
cd GenAIExamples/visualqna/kubernetes/manifests/gaudi | ||
kubectl apply -f visualqna.yaml | ||
``` | ||
|
||
## Verify Services | ||
|
||
To verify the installation, run the command `kubectl get pod` to make sure all pods are running. | ||
|
||
Then run the command `kubectl port-forward svc/visualqna 8888:8888` to expose the visualqna service for access. | ||
|
||
Open another terminal and run the following command to verify the service if working: | ||
|
||
```console | ||
curl http://localhost:8888/v1/visualqna \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{"messages": [ | ||
{ | ||
"role": "user", | ||
"content": [ | ||
{ | ||
"type": "text", | ||
"text": "What'\''s in this image?" | ||
}, | ||
{ | ||
"type": "image_url", | ||
"image_url": { | ||
"url": "https://www.ilankelman.org/stopsigns/australia.jpg" | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"max_tokens": 128}' | ||
``` |
Oops, something went wrong.