Update all examples yaml files of GMC in GenAIExample (#436)

* Update all examples yaml files of GMC in GenAIExample.
Signed-off-by: zhlsunshine <huailong.zhang@intel.com>
This commit is contained in:
Steve Zhang
2024-07-23 16:40:51 +08:00
committed by GitHub
parent 8ad7f36fe2
commit 290a74fae9
16 changed files with 313 additions and 9 deletions

View File

@@ -0,0 +1,40 @@
<h1 align="center" id="title">Deploy CodeGen in a Kubernetes Cluster</h1>
This document outlines the deployment process for a Code Generation (CodeGen) 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 codegen_xeon.yaml file or if you have a Gaudi cluster you could use codegen_gaudi.yaml
In the below example we illustrate on Xeon.
## Deploy the RAG 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: codegen|namespace: $APP_NAMESPACE|g" ./codegen_xeon.yaml
kubectl apply -f ./codegen_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=='codegen')].status.accessUrl}")
kubectl exec "$CLIENT_POD" -n $APP_NAMESPACE -- curl $accessUrl -X POST -d '{"query": "def print_hello_world():"}' -H 'Content-Type: application/json' > $LOG_PATH/gmc_codegen.log
```

View File

@@ -24,10 +24,11 @@ spec:
serviceName: llm-service
config:
endpoint: /v1/chat/completions
TGI_LLM_ENDPOINT: tgi-gaudi-svc
- name: TgiGaudi
internalService:
serviceName: tgi-gaudi-svc
config:
LLM_MODEL_ID: ise-uiuc/Magicoder-S-DS-6.7B
MODEL_ID: ise-uiuc/Magicoder-S-DS-6.7B
endpoint: /generate
isDownstreamService: true

View File

@@ -24,10 +24,11 @@ spec:
serviceName: llm-service
config:
endpoint: /v1/chat/completions
TGI_LLM_ENDPOINT: tgi-service
- name: Tgi
internalService:
serviceName: tgi-service
config:
LLM_MODEL_ID: ise-uiuc/Magicoder-S-DS-6.7B
MODEL_ID: ise-uiuc/Magicoder-S-DS-6.7B
endpoint: /generate
isDownstreamService: true

View File

@@ -44,7 +44,7 @@ function validate_codegen() {
echo "Checking response results, make sure the output is reasonable. "
local status=false
if [[ -f $LOG_PATH/gmc_codegen.log ]] && \
[[ $(grep -c "print" $LOG_PATH/gmc_codegen.log) != 0 ]]; then
[[ $(grep -c "[DONE]" $LOG_PATH/gmc_codegen.log) != 0 ]]; then
status=true
fi
if [ $status == false ]; then

View File

@@ -44,7 +44,7 @@ function validate_codegen() {
echo "Checking response results, make sure the output is reasonable. "
local status=false
if [[ -f $LOG_PATH/gmc_codegen.log ]] && \
[[ $(grep -c "print" $LOG_PATH/gmc_codegen.log) != 0 ]]; then
[[ $(grep -c "[DONE]" $LOG_PATH/gmc_codegen.log) != 0 ]]; then
status=true
fi
if [ $status == false ]; then