code-gen-react-ui (#417)

* CodeGen: Manifest to deploy CodeGen with ReactUI into Kubernetes

Include manifest to deploy CodeGen pipeline with ReactUI into
Kubernetes. Include as well README file for the steps.

Signed-off-by: Yeoh, Hoong Tee <hoong.tee.yeoh@intel.com>

* code-gen-react-ui

Signed-off-by: jaswanth8888 <karani.jaswanth@gmail.com>

* made changes as per PR suggestions

Signed-off-by: jaswanth8888 <karani.jaswanth@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updated readme

Signed-off-by: jaswanth8888 <karani.jaswanth@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update base image

Signed-off-by: jaswanth8888 <karani.jaswanth@gmail.com>

* updated codegn dockerfile react

Signed-off-by: jaswanth8888 <karani.jaswanth@gmail.com>

* updated wait time

Signed-off-by: jaswanth8888 <karani.jaswanth@gmail.com>

* updated as per PR comments

Signed-off-by: jaswanth8888 <karani.jaswanth@gmail.com>

* aded react ui in gaudi test file

Signed-off-by: jaswanth8888 <karani.jaswanth@gmail.com>

* fixed PR comments

Signed-off-by: jaswanth8888 <karani.jaswanth@gmail.com>

* added docker pull for text-generation-model

Signed-off-by: jaswanth8888 <karani.jaswanth@gmail.com>

* removed unused files

Signed-off-by: jaswanth8888 <karani.jaswanth@gmail.com>

---------

Signed-off-by: Yeoh, Hoong Tee <hoong.tee.yeoh@intel.com>
Signed-off-by: jaswanth8888 <karani.jaswanth@gmail.com>
Co-authored-by: Yeoh, Hoong Tee <hoong.tee.yeoh@intel.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: chen, suyue <suyue.chen@intel.com>
This commit is contained in:
Jaswanth Karani
2024-07-24 21:31:16 +05:30
committed by GitHub
parent 8c4a2534c1
commit 1b48e54a3d
51 changed files with 1513 additions and 4 deletions

View File

@@ -0,0 +1,36 @@
# Deploy CodeGen with ReactUI
The README provides a step-by-step guide on how to deploy CodeGen with ReactUI, a popular React-based user interface library in Kubernetes cluster.
You can use react-codegen.yaml to deploy CodeGen with reactUI.
```
kubectl apply -f react-codegen.yaml
```
## Prerequisites for Deploying CodeGen with ReactUI:
Before deploying the react-codegen.yaml file, ensure that you have the following prerequisites in place:
1. Kubernetes installation: Make sure that you have Kubernetes installed.
2. Configuration Values: Set the following values in react-codegen.yaml before proceeding with the deployment:
#### a. HUGGINGFACEHUB_API_TOKEN (Your HuggingFace token to download your desired model from HuggingFace):
```
# You may set the HUGGINGFACEHUB_API_TOKEN via method:
export HUGGINGFACEHUB_API_TOKEN="YourOwnToken"
cd GenAIExamples/CodeGen/kubernetes/manifests/xeon/ui/
sed -i "s/insert-your-huggingface-token-here/${HUGGINGFACEHUB_API_TOKEN}/g" react-codegen.yaml
```
#### b. Set the proxies based on your network configuration
```
# Look for http_proxy, https_proxy, no_proxy key and fill up the value with your proxy configuration.
```
3. MODEL_ID and model-volume (OPTIONAL): You may as well customize the "MODEL_ID" to use different model and model-volume for the volume to be mounted.
4. After completing these, you can proceed with the deployment of the react-codegen.yaml file.
## Verify Services:
Make sure all the pods are running, you should see total of 4 pods running:
1. codegen
2. codegen-llm-uservice
3. codegen-react-ui
4. codegen-tgi
You may open up the UI by using the codegen-react-ui endpoint in the browser.

View File

@@ -0,0 +1,280 @@
---
# Source: codegen/charts/llm-uservice/charts/tgi/templates/service.yaml
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
apiVersion: v1
kind: Service
metadata:
name: codegen-tgi
labels:
helm.sh/chart: tgi-0.1.0
app.kubernetes.io/name: tgi
app.kubernetes.io/instance: codegen
app.kubernetes.io/version: "1.4"
app.kubernetes.io/managed-by: Helm
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 80
protocol: TCP
name: tgi
selector:
app.kubernetes.io/name: tgi
app.kubernetes.io/instance: codegen
---
apiVersion: v1
kind: Service
metadata:
name: codegen-llm-uservice
labels:
helm.sh/chart: llm-uservice-0.1.0
app.kubernetes.io/name: llm-uservice
app.kubernetes.io/instance: codegen
app.kubernetes.io/version: "1.0.0"
app.kubernetes.io/managed-by: Helm
spec:
type: ClusterIP
ports:
- port: 9000
targetPort: 9000
protocol: TCP
name: llm-uservice
selector:
app.kubernetes.io/name: llm-uservice
app.kubernetes.io/instance: codegen
---
apiVersion: v1
kind: Service
metadata:
name: codegen
labels:
helm.sh/chart: codegen-0.1.0
app.kubernetes.io/name: codegen
app.kubernetes.io/instance: codegen
app.kubernetes.io/version: "1.0.0"
app.kubernetes.io/managed-by: Helm
spec:
type: ClusterIP
ports:
- port: 7778
targetPort: 7778
protocol: TCP
name: codegen
selector:
app.kubernetes.io/name: codegen
app.kubernetes.io/instance: codegen
---
apiVersion: v1
kind: Service
metadata:
name: codegen-react-ui
labels:
helm.sh/chart: codegen-react-ui-0.1.0
app.kubernetes.io/name: react-ui
app.kubernetes.io/instance: codegen
app.kubernetes.io/version: "1.0.0"
app.kubernetes.io/managed-by: Helm
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 80
protocol: TCP
name: react-ui
selector:
app.kubernetes.io/name: react-ui
app.kubernetes.io/instance: codegen
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: codegen-tgi
labels:
helm.sh/chart: tgi-0.1.0
app.kubernetes.io/name: tgi
app.kubernetes.io/instance: codegen
app.kubernetes.io/version: "1.4"
app.kubernetes.io/managed-by: Helm
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: tgi
app.kubernetes.io/instance: codegen
template:
metadata:
labels:
app.kubernetes.io/name: tgi
app.kubernetes.io/instance: codegen
spec:
securityContext: {}
containers:
- name: tgi
env:
- name: MODEL_ID
value: ise-uiuc/Magicoder-S-DS-6.7B
- name: PORT
value: "80"
- name: http_proxy
value:
- name: https_proxy
value:
- name: no_proxy
value:
securityContext: {}
image: "ghcr.io/huggingface/text-generation-inference:1.4"
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: /data
name: model-volume
ports:
- name: http
containerPort: 80
protocol: TCP
resources: {}
volumes:
- name: model-volume
hostPath:
path: /mnt
type: Directory
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: codegen-llm-uservice
labels:
helm.sh/chart: llm-uservice-0.1.0
app.kubernetes.io/name: llm-uservice
app.kubernetes.io/instance: codegen
app.kubernetes.io/version: "1.0.0"
app.kubernetes.io/managed-by: Helm
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: llm-uservice
app.kubernetes.io/instance: codegen
template:
metadata:
labels:
app.kubernetes.io/name: llm-uservice
app.kubernetes.io/instance: codegen
spec:
securityContext: {}
containers:
- name: codegen
env:
- name: TGI_LLM_ENDPOINT
value: "http://codegen-tgi:80"
- name: HUGGINGFACEHUB_API_TOKEN
value: "insert-your-huggingface-token-here"
- name: http_proxy
value:
- name: https_proxy
value:
- name: no_proxy
value:
securityContext: {}
image: "opea/llm-tgi:latest"
imagePullPolicy: IfNotPresent
ports:
- name: llm-uservice
containerPort: 9000
protocol: TCP
startupProbe:
exec:
command:
- curl
- http://codegen-tgi:80
initialDelaySeconds: 5
periodSeconds: 5
failureThreshold: 120
resources: {}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: codegen
labels:
helm.sh/chart: codegen-0.1.0
app.kubernetes.io/name: codegen
app.kubernetes.io/instance: codegen
app.kubernetes.io/version: "1.0.0"
app.kubernetes.io/managed-by: Helm
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: codegen
app.kubernetes.io/instance: codegen
template:
metadata:
labels:
app.kubernetes.io/name: codegen
app.kubernetes.io/instance: codegen
spec:
securityContext: null
containers:
- name: codegen
env:
- name: LLM_SERVICE_HOST_IP
value: codegen-llm-uservice
- name: http_proxy
value:
- name: https_proxy
value:
- name: no_proxy
value:
securityContext: null
image: "opea/codegen:latest"
imagePullPolicy: IfNotPresent
ports:
- name: codegen
containerPort: 7778
protocol: TCP
resources: null
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: codegen-react-ui
labels:
helm.sh/chart: codegen-react-ui-0.1.0
app.kubernetes.io/name: react-ui
app.kubernetes.io/instance: codegen
app.kubernetes.io/version: "1.0.0"
app.kubernetes.io/managed-by: Helm
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: react-ui
app.kubernetes.io/instance: codegen
template:
metadata:
labels:
app.kubernetes.io/name: react-ui
app.kubernetes.io/instance: codegen
spec:
securityContext: null
containers:
- name: codegen-react-ui
env:
- name: BASIC_URL
value: "http://codegen:7778/v1/codegen"
- name: http_proxy
value:
- name: https_proxy
value:
- name: no_proxy
value:
securityContext: null
image: "opea/codegen-react-ui:latest"
imagePullPolicy: IfNotPresent
ports:
- name: react-ui
containerPort: 80
protocol: TCP
resources: null