Skip to content

Commit

Permalink
Reorg of helm charts (#104)
Browse files Browse the repository at this point in the history
* Reorg of helm charts

Removed duplicate charts and use local dependencies.
Defined global volume for cached models.
Fixed a few issues.

Signed-off-by: Dolpher Du <Dolpher.Du@intel.com>
  • Loading branch information
yongfengdu authored Jun 20, 2024
1 parent a58849e commit d332c2e
Show file tree
Hide file tree
Showing 108 changed files with 128 additions and 1,907 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/chart-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: |
changed_charts=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | \
grep "^$CHARTS_DIR/" | \
grep -vE 'README.md|common' | \
grep -vE 'README.md|common|update_dependency.sh' | \
cut -d'/' -f2 | sort -u )
# set run_matrix to be "{"chart":["chart1","chart2",...]}"
run_matrix="{\"chart\":["
Expand Down Expand Up @@ -88,6 +88,7 @@ jobs:
id: install
run: |
echo "should_cleanup=true" >> $GITHUB_ENV
helm-charts/update_dependency.sh && helm dependency update helm-charts/${{ matrix.chart }}
if ! helm install --create-namespace --namespace $NAMESPACE --wait --timeout "$ROLLOUT_TIMEOUT_SECONDS" $RELEASE_NAME $CHARTS_DIR/${{ matrix.chart }} ; then
echo "Failed to install chart ${{ matrix.chart }}"
echo "skip_validate=true" >> $GITHUB_ENV
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/chart-validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,6 @@ jobs:
fi
- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --check-version-increment=false --validate-maintainers=false --chart-dirs ${{ env.CHARTS_DIR }} --target-branch ${{ github.event.repository.default_branch }}
run: |
helm-charts/update_dependency.sh
ct lint --check-version-increment=false --validate-maintainers=false --chart-dirs ${{ env.CHARTS_DIR }} --target-branch ${{ github.event.repository.default_branch }}
14 changes: 4 additions & 10 deletions .github/workflows/scripts/e2e/chart_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ function init_codegen() {

function init_chatqna() {
# replace volume: /mnt with volume: $CHART_MOUNT
find . -name '*.yaml' -type f -exec sed -i "s#volume: /mnt#volume: $CHART_MOUNT#g" {} \;
find .. -name '*values.yaml' -type f -exec sed -i "s#volume: /mnt#volume: $CHART_MOUNT#g" {} \;
# replace the repository "image: opea/*" with "image: $IMAGE_REPO/opea/"
find . -name '*.yaml' -type f -exec sed -i "s#repository: opea/*#repository: $IMAGE_REPO/opea/#g" {} \;
find .. -name '*values.yaml' -type f -exec sed -i "s#repository: opea/*#repository: $IMAGE_REPO/opea/#g" {} \;
# set huggingface token
find . -name '*.yaml' -type f -exec sed -i "s#insert-your-huggingface-token-here#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \;
find .. -name '*values.yaml' -type f -exec sed -i "s#insert-your-huggingface-token-here#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \;
}

function validate_codegen() {
Expand Down Expand Up @@ -55,17 +55,11 @@ function validate_codegen() {

function validate_chatqna() {
sleep 60
# make sure microservice retriever svcname=$RELEASE_NAME-retriever-usvc is ready
ip_address=$(kubectl get svc $RELEASE_NAME-retriever-usvc -n $NAMESPACE -o jsonpath='{.spec.clusterIP}')
port=$(kubectl get svc $RELEASE_NAME-retriever-usvc -n $NAMESPACE -o jsonpath='{.spec.ports[0].port}')
until curl http://${ip_address}:${port}/v1/retrieval -X POST \
-d '{"text":"What is the revenue of Nike in 2023?","embedding":"'"${your_embedding}"'"}' \
-H 'Content-Type: application/json'; do sleep 10; done
set -xe
ip_address=$(kubectl get svc $RELEASE_NAME -n $NAMESPACE -o jsonpath='{.spec.clusterIP}')
port=$(kubectl get svc $RELEASE_NAME -n $NAMESPACE -o jsonpath='{.spec.ports[0].port}')
# Curl the Mega Service
curl http://${ip_address}:${port}/v1/chatqna -H "Content-Type: application/json" -d '{
"model": "Intel/neural-chat-7b-v3-3",
"messages": "What is the revenue of Nike in 2023?"}' > ${LOG_PATH}/curl_megaservice.log
exit_code=$?

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
**/bin/
*.out
**/Chart.lock
**/charts/*.tgz
4 changes: 4 additions & 0 deletions helm-charts/chatqna/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ type: application
dependencies:
- name: llm-uservice
version: "0.1.0"
repository: "file://../common/llm-uservice"
- name: embedding-usvc
version: "0.1.0"
repository: "file://../common/embedding-usvc"
- name: reranking-usvc
version: "0.1.0"
repository: "file://../common/reranking-usvc"
- name: retriever-usvc
version: "0.1.0"
repository: "file://../common/retriever-usvc"
version: 0.1.0
appVersion: "1.0.0"
21 changes: 12 additions & 9 deletions helm-charts/chatqna/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,23 @@ Helm chart for deploying ChatQnA service.
To install the chart, run the following:

```console
cd GenAIInfra/helm-charts/
./update_dependency.sh
helm dependency update chatqna
export HFTOKEN="insert-your-huggingface-token-here"
export MODELDIR="/mnt"
export MODELNAME="Intel/neural-chat-7b-v3-3"
helm install chatqna chatqna --set llm-uservice.HUGGINGFACEHUB_API_TOKEN=${HFTOKEN} --set llm-uservice.tgi.volume=${MODELDIR} --set llm-uservice.tgi.LLM_MODEL_ID=${MODELNAME}
helm install chatqna chatqna --set global.HUGGINGFACEHUB_API_TOKEN=${HFTOKEN} --set global.volume=${MODELDIR} --set llm-uservice.tgi.LLM_MODEL_ID=${MODELNAME}
# To use Gaudi device
# helm install chatqna chatqna --set llm-uservice.HUGGINGFACEHUB_API_TOKEN=${HFTOKEN} --values chatqna/gaudi-values.yaml
# helm install chatqna chatqna --set global.HUGGINGFACEHUB_API_TOKEN=${HFTOKEN} --values chatqna/gaudi-values.yaml
```

## Values

| Key | Type | Default | Description |
| ------------------------------------- | ------ | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| image.repository | string | `"opea/chatqna:latest"` | |
| service.port | string | `"8888"` | |
| llm-uservice.HUGGINGFACEHUB_API_TOKEN | string | `""` | Your own Hugging Face API token |
| llm-uservice.tgi.LLM_MODEL_ID | string | `"Intel/neural-chat-7b-v3-3"` | Models id from https://huggingface.co/, or predownloaded model directory |
| llm-uservice.tgi.volume | string | `"/mnt"` | Cached models directory, tgi will not download if the model is cached here. The "volume" will be mounted to container as /data directory |
| Key | Type | Default | Description |
| ------------------------------- | ------ | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| image.repository | string | `"opea/chatqna:latest"` | |
| service.port | string | `"8888"` | |
| global.HUGGINGFACEHUB_API_TOKEN | string | `""` | Your own Hugging Face API token |
| global.volume | string | `"/mnt"` | Cached models directory, tgi will not download if the model is cached here. The "volume" will be mounted to container as /data directory |
| llm-uservice.tgi.LLM_MODEL_ID | string | `"Intel/neural-chat-7b-v3-3"` | Models id from https://huggingface.co/, or predownloaded model directory |
10 changes: 0 additions & 10 deletions helm-charts/chatqna/charts/embedding-usvc/charts/tei/Chart.yaml

This file was deleted.

32 changes: 0 additions & 32 deletions helm-charts/chatqna/charts/embedding-usvc/charts/tei/README.md

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

57 changes: 0 additions & 57 deletions helm-charts/chatqna/charts/embedding-usvc/charts/tei/values.yaml

This file was deleted.

Loading

0 comments on commit d332c2e

Please sign in to comment.