Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
725106a
[ChatQnA] Switch to vLLM as default llm backend on Xeon
wangkl2 Jan 14, 2025
f108812
Use vllm llm backend for pinecone eg
wangkl2 Jan 14, 2025
31c11c6
Update readme
wangkl2 Jan 14, 2025
9ba9897
Use vllm llm backend for qdrant eg
wangkl2 Jan 14, 2025
c319bb0
Update names of ut scripts
wangkl2 Jan 14, 2025
937375a
Fix the vllm test script
wangkl2 Jan 14, 2025
58f611a
Update the wo-rerank test script
wangkl2 Jan 14, 2025
0417459
Update the pinecone test script
wangkl2 Jan 14, 2025
df03057
Update the qdrant test script
wangkl2 Jan 14, 2025
29816b2
Align the function names and llm svc val parameters in all test scripts
wangkl2 Jan 16, 2025
34a918a
Merge branch 'opea-project:main' into vllm-default
wangkl2 Jan 16, 2025
a9dd2ae
Update readme for descriptions of several deployment variants
wangkl2 Jan 16, 2025
09b6a7d
Merge branch 'vllm-default' of https://github.com/wangkl2/GenAIExampl…
wangkl2 Jan 16, 2025
b268cd2
fix test script isssue for docker start and stop
wangkl2 Jan 16, 2025
1fec5ab
solve conflicts
wangkl2 Jan 16, 2025
490026f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 16, 2025
4c27467
Merge branch 'main' into vllm-default
wangkl2 Jan 16, 2025
b0bcc46
Fix ci issues
wangkl2 Jan 16, 2025
65c59b5
Merge branch 'vllm-default' of https://github.com/wangkl2/GenAIExampl…
wangkl2 Jan 16, 2025
e790569
Merge branch 'main' into vllm-default
wangkl2 Jan 16, 2025
2156bd3
Fix ci issues
wangkl2 Jan 16, 2025
dbe5d35
Merge branch 'vllm-default' of https://github.com/wangkl2/GenAIExampl…
wangkl2 Jan 16, 2025
4d9c6dc
Fix ci issues
wangkl2 Jan 16, 2025
d4938e1
Merge branch 'main' into vllm-default
wangkl2 Jan 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 25 additions & 21 deletions ChatQnA/docker_compose/intel/cpu/xeon/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Build Mega Service of ChatQnA on Xeon

This document outlines the deployment process for a ChatQnA application utilizing the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice pipeline on Intel Xeon server. The steps include Docker image creation, container deployment via Docker Compose, and service execution to integrate microservices such as `embedding`, `retriever`, `rerank`, and `llm`. We will publish the Docker images to Docker Hub soon, it will simplify the deployment process for this service.
This document outlines the deployment process for a ChatQnA application utilizing the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice pipeline on Intel Xeon server. The steps include Docker image creation, container deployment via Docker Compose, and service execution to integrate microservices such as `embedding`, `retriever`, `rerank`, and `llm`.

The default pipeline deploys with vLLM as the LLM serving component and leverages rerank component. It also provides options of not using rerank in the pipeline and using TGI backend for LLM microservice, please refer to [start-all-the-services-docker-containers](#start-all-the-services-docker-containers) section in this page. Besides, refer to [Build with Pinecone VectorDB](./README_pinecone.md) and [Build with Qdrant VectorDB](./README_qdrant.md) for other deployment variants.

Quick Start:

Expand Down Expand Up @@ -186,14 +188,17 @@ By default, the embedding, reranking and LLM models are set to a default value a

Change the `xxx_MODEL_ID` below for your needs.

For users in China who are unable to download models directly from Huggingface, you can use [ModelScope](https://www.modelscope.cn/models) or a Huggingface mirror to download models. TGI can load the models either online or offline as described below:
For users in China who are unable to download models directly from Huggingface, you can use [ModelScope](https://www.modelscope.cn/models) or a Huggingface mirror to download models. The vLLM/TGI can load the models either online or offline as described below:

1. Online

```bash
export HF_TOKEN=${your_hf_token}
export HF_ENDPOINT="https://hf-mirror.com"
model_name="Intel/neural-chat-7b-v3-3"
# Start vLLM LLM Service
docker run -p 8008:80 -v ./data:/data --name vllm-service -e HF_ENDPOINT=$HF_ENDPOINT -e http_proxy=$http_proxy -e https_proxy=$https_proxy --shm-size 128g opea/vllm:latest --model $model_name --host 0.0.0.0 --port 80
# Start TGI LLM Service
docker run -p 8008:80 -v ./data:/data --name tgi-service -e HF_ENDPOINT=$HF_ENDPOINT -e http_proxy=$http_proxy -e https_proxy=$https_proxy --shm-size 1g ghcr.io/huggingface/text-generation-inference:2.4.0-intel-cpu --model-id $model_name
```

Expand All @@ -203,12 +208,15 @@ For users in China who are unable to download models directly from Huggingface,

- Click on `Download this model` button, and choose one way to download the model to your local path `/path/to/model`.

- Run the following command to start TGI service.
- Run the following command to start the LLM service.

```bash
export HF_TOKEN=${your_hf_token}
export model_path="/path/to/model"
docker run -p 8008:80 -v $model_path:/data --name tgi_service --shm-size 1g ghcr.io/huggingface/text-generation-inference:2.4.0-intel-cpu --model-id /data
# Start vLLM LLM Service
docker run -p 8008:80 -v $model_path:/data --name vllm-service --shm-size 128g opea/vllm:latest --model /data --host 0.0.0.0 --port 80
# Start TGI LLM Service
docker run -p 8008:80 -v $model_path:/data --name tgi-service --shm-size 1g ghcr.io/huggingface/text-generation-inference:2.4.0-intel-cpu --model-id /data
```

### Setup Environment Variables
Expand Down Expand Up @@ -246,7 +254,7 @@ For users in China who are unable to download models directly from Huggingface,
cd GenAIExamples/ChatQnA/docker_compose/intel/cpu/xeon/
```

If use TGI backend.
If use vLLM as the LLM serving backend.

```bash
# Start ChatQnA with Rerank Pipeline
Expand All @@ -255,10 +263,10 @@ docker compose -f compose.yaml up -d
docker compose -f compose_without_rerank.yaml up -d
```

If use vLLM backend.
If use TGI as the LLM serving backend.

```bash
docker compose -f compose_vllm.yaml up -d
docker compose -f compose_tgi.yaml up -d
```

### Validate Microservices
Expand Down Expand Up @@ -305,37 +313,34 @@ For details on how to verify the correctness of the response, refer to [how-to-v

4. LLM backend Service

In first startup, this service will take more time to download the model files. After it's finished, the service will be ready.
In the first startup, this service will take more time to download, load and warm up the model. After it's finished, the service will be ready.

Try the command below to check whether the LLM serving is ready.

```bash
docker logs tgi-service | grep Connected
# vLLM service
docker logs vllm-service 2>&1 | grep complete
# If the service is ready, you will get the response like below.
INFO: Application startup complete.
```

If the service is ready, you will get the response like below.

```
```bash
# TGI service
docker logs tgi-service | grep Connected
# If the service is ready, you will get the response like below.
2024-09-03T02:47:53.402023Z INFO text_generation_router::server: router/src/server.rs:2311: Connected
```

Then try the `cURL` command below to validate services.

```bash
# TGI service
# either vLLM or TGI service
curl http://${host_ip}:9009/v1/chat/completions \
-X POST \
-d '{"model": "Intel/neural-chat-7b-v3-3", "messages": [{"role": "user", "content": "What is Deep Learning?"}], "max_tokens":17}' \
-H 'Content-Type: application/json'
```

```bash
# vLLM Service
curl http://${host_ip}:9009/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "Intel/neural-chat-7b-v3-3", "messages": [{"role": "user", "content": "What is Deep Learning?"}]}'
```

5. MegaService

```bash
Expand All @@ -362,7 +367,6 @@ Or run this command to get the file on a terminal.

```bash
wget https://raw.githubusercontent.com/opea-project/GenAIComps/v1.1/comps/retrievers/redis/data/nke-10k-2023.pdf

```

Upload:
Expand Down
21 changes: 11 additions & 10 deletions ChatQnA/docker_compose/intel/cpu/xeon/README_pinecone.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Build Mega Service of ChatQnA on Xeon

This document outlines the deployment process for a ChatQnA application utilizing the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice pipeline on Intel Xeon server. The steps include Docker image creation, container deployment via Docker Compose, and service execution to integrate microservices such as `embedding`, `retriever`, `rerank`, and `llm`. We will publish the Docker images to Docker Hub soon, it will simplify the deployment process for this service.
This document outlines the deployment process for a ChatQnA application utilizing the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice pipeline on Intel Xeon server. The steps include Docker image creation, container deployment via Docker Compose, and service execution to integrate microservices such as `embedding`, `retriever`, `rerank`, and `llm`.

The default pipeline deploys with vLLM as the LLM serving component and leverages rerank component.

Quick Start:

Expand Down Expand Up @@ -189,15 +191,15 @@ By default, the embedding, reranking and LLM models are set to a default value a

Change the `xxx_MODEL_ID` below for your needs.

For users in China who are unable to download models directly from Huggingface, you can use [ModelScope](https://www.modelscope.cn/models) or a Huggingface mirror to download models. TGI can load the models either online or offline as described below:
For users in China who are unable to download models directly from Huggingface, you can use [ModelScope](https://www.modelscope.cn/models) or a Huggingface mirror to download models. The vLLM can load the models either online or offline as described below:

1. Online

```bash
export HF_TOKEN=${your_hf_token}
export HF_ENDPOINT="https://hf-mirror.com"
model_name="Intel/neural-chat-7b-v3-3"
docker run -p 8008:80 -v ./data:/data --name tgi-service -e HF_ENDPOINT=$HF_ENDPOINT -e http_proxy=$http_proxy -e https_proxy=$https_proxy --shm-size 1g ghcr.io/huggingface/text-generation-inference:2.4.0-intel-cpu --model-id $model_name
docker run -p 8008:80 -v ./data:/data --name vllm-service -e HF_ENDPOINT=$HF_ENDPOINT -e http_proxy=$http_proxy -e https_proxy=$https_proxy --shm-size 128g opea/vllm:latest --model $model_name --host 0.0.0.0 --port 80
```

2. Offline
Expand All @@ -206,12 +208,12 @@ For users in China who are unable to download models directly from Huggingface,

- Click on `Download this model` button, and choose one way to download the model to your local path `/path/to/model`.

- Run the following command to start TGI service.
- Run the following command to start the LLM service.

```bash
export HF_TOKEN=${your_hf_token}
export model_path="/path/to/model"
docker run -p 8008:80 -v $model_path:/data --name tgi_service --shm-size 1g ghcr.io/huggingface/text-generation-inference:2.4.0-intel-cpu --model-id /data
docker run -p 8008:80 -v $model_path:/data --name vllm-service --shm-size 128g opea/vllm:latest --model /data --host 0.0.0.0 --port 80
```

### Setup Environment Variables
Expand Down Expand Up @@ -252,7 +254,7 @@ For users in China who are unable to download models directly from Huggingface,
cd GenAIExamples/ChatQnA/docker_compose/intel/cpu/xeon/
```

If use TGI backend.
If use vLLM backend.

```bash
# Start ChatQnA with Rerank Pipeline
Expand Down Expand Up @@ -303,24 +305,23 @@ For details on how to verify the correctness of the response, refer to [how-to-v

4. LLM backend Service

In first startup, this service will take more time to download the model files. After it's finished, the service will be ready.
In the first startup, this service will take more time to download, load and warm up the model. After it's finished, the service will be ready.

Try the command below to check whether the LLM serving is ready.

```bash
docker logs tgi-service | grep Connected
docker logs vllm-service 2>&1 | grep complete
```

If the service is ready, you will get the response like below.

```text
2024-09-03T02:47:53.402023Z INFO text_generation_router::server: router/src/server.rs:2311: Connected
INFO: Application startup complete.
```

Then try the `cURL` command below to validate services.

```bash
# TGI service
curl http://${host_ip}:9009/v1/chat/completions \
-X POST \
-d '{"model": "Intel/neural-chat-7b-v3-3", "messages": [{"role": "user", "content": "What is Deep Learning?"}], "max_tokens":17}' \
Expand Down
22 changes: 12 additions & 10 deletions ChatQnA/docker_compose/intel/cpu/xeon/README_qdrant.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Build Mega Service of ChatQnA (with Qdrant) on Xeon

This document outlines the deployment process for a ChatQnA application utilizing the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice pipeline on Intel Xeon server. The steps include Docker image creation, container deployment via Docker Compose, and service execution to integrate microservices such as `embedding`, `retriever`, `rerank`, and `llm`. We will publish the Docker images to Docker Hub soon, it will simplify the deployment process for this service.
This document outlines the deployment process for a ChatQnA application utilizing the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice pipeline on Intel Xeon server. The steps include Docker image creation, container deployment via Docker Compose, and service execution to integrate microservices such as `embedding`, `retriever`, `rerank`, and `llm`.

The default pipeline deploys with vLLM as the LLM serving component and leverages rerank component.

## 🚀 Apply Xeon Server on AWS

Expand Down Expand Up @@ -44,7 +46,7 @@ reranking
=========
Port 6046 - Open to 0.0.0.0/0

tgi-service
vllm-service
===========
Port 6042 - Open to 0.0.0.0/0

Expand Down Expand Up @@ -170,7 +172,7 @@ export your_hf_api_token="Your_Huggingface_API_Token"
**Append the value of the public IP address to the no_proxy list if you are in a proxy environment**

```
export your_no_proxy=${your_no_proxy},"External_Public_IP",chatqna-xeon-ui-server,chatqna-xeon-backend-server,dataprep-qdrant-service,tei-embedding-service,retriever,tei-reranking-service,tgi-service
export your_no_proxy=${your_no_proxy},"External_Public_IP",chatqna-xeon-ui-server,chatqna-xeon-backend-server,dataprep-qdrant-service,tei-embedding-service,retriever,tei-reranking-service,tgi-service,vllm-service
```

```bash
Expand Down Expand Up @@ -233,23 +235,23 @@ For details on how to verify the correctness of the response, refer to [how-to-v
-H 'Content-Type: application/json'
```

4. TGI Service
4. LLM Backend Service

In first startup, this service will take more time to download the model files. After it's finished, the service will be ready.
In the first startup, this service will take more time to download, load and warm up the model. After it's finished, the service will be ready.

Try the command below to check whether the TGI service is ready.
Try the command below to check whether the LLM service is ready.

```bash
docker logs ${CONTAINER_ID} | grep Connected
docker logs vllm-service 2>&1 | grep complete
```

If the service is ready, you will get the response like below.

```
2024-09-03T02:47:53.402023Z INFO text_generation_router::server: router/src/server.rs:2311: Connected
```text
INFO: Application startup complete.
```

Then try the `cURL` command below to validate TGI.
Then try the `cURL` command below to validate vLLM service.

```bash
curl http://${host_ip}:6042/v1/chat/completions \
Expand Down
19 changes: 9 additions & 10 deletions ChatQnA/docker_compose/intel/cpu/xeon/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,32 +74,31 @@ services:
HF_HUB_DISABLE_PROGRESS_BARS: 1
HF_HUB_ENABLE_HF_TRANSFER: 0
command: --model-id ${RERANK_MODEL_ID} --auto-truncate
tgi-service:
image: ghcr.io/huggingface/text-generation-inference:2.4.0-intel-cpu
container_name: tgi-service
vllm-service:
image: ${REGISTRY:-opea}/vllm:${TAG:-latest}
container_name: vllm-service
ports:
- "9009:80"
volumes:
- "./data:/data"
shm_size: 1g
shm_size: 128g
environment:
no_proxy: ${no_proxy}
http_proxy: ${http_proxy}
https_proxy: ${https_proxy}
HF_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
HF_HUB_DISABLE_PROGRESS_BARS: 1
HF_HUB_ENABLE_HF_TRANSFER: 0
command: --model-id ${LLM_MODEL_ID} --cuda-graphs 0
LLM_MODEL_ID: ${LLM_MODEL_ID}
VLLM_TORCH_PROFILER_DIR: "/mnt"
command: --model $LLM_MODEL_ID --host 0.0.0.0 --port 80
chatqna-xeon-backend-server:
image: ${REGISTRY:-opea}/chatqna:${TAG:-latest}
container_name: chatqna-xeon-backend-server
depends_on:
- redis-vector-db
- tei-embedding-service
- dataprep-redis-service
- retriever
- tei-reranking-service
- tgi-service
- vllm-service
ports:
- "8888:8888"
environment:
Expand All @@ -112,7 +111,7 @@ services:
- RETRIEVER_SERVICE_HOST_IP=retriever
- RERANK_SERVER_HOST_IP=tei-reranking-service
- RERANK_SERVER_PORT=${RERANK_SERVER_PORT:-80}
- LLM_SERVER_HOST_IP=tgi-service
- LLM_SERVER_HOST_IP=vllm-service
- LLM_SERVER_PORT=${LLM_SERVER_PORT:-80}
- LLM_MODEL=${LLM_MODEL_ID}
- LOGFLAG=${LOGFLAG}
Expand Down
18 changes: 9 additions & 9 deletions ChatQnA/docker_compose/intel/cpu/xeon/compose_pinecone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,22 @@ services:
HF_HUB_DISABLE_PROGRESS_BARS: 1
HF_HUB_ENABLE_HF_TRANSFER: 0
command: --model-id ${RERANK_MODEL_ID} --auto-truncate
tgi-service:
image: ghcr.io/huggingface/text-generation-inference:2.4.0-intel-cpu
container_name: tgi-service
vllm-service:
image: ${REGISTRY:-opea}/vllm:${TAG:-latest}
container_name: vllm-service
ports:
- "9009:80"
volumes:
- "./data:/data"
shm_size: 1g
shm_size: 128g
environment:
no_proxy: ${no_proxy}
http_proxy: ${http_proxy}
https_proxy: ${https_proxy}
HF_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
HF_HUB_DISABLE_PROGRESS_BARS: 1
HF_HUB_ENABLE_HF_TRANSFER: 0
command: --model-id ${LLM_MODEL_ID} --cuda-graphs 0
LLM_MODEL_ID: ${LLM_MODEL_ID}
VLLM_TORCH_PROFILER_DIR: "/mnt"
command: --model $LLM_MODEL_ID --host 0.0.0.0 --port 80
chatqna-xeon-backend-server:
image: ${REGISTRY:-opea}/chatqna:${TAG:-latest}
container_name: chatqna-xeon-backend-server
Expand All @@ -92,7 +92,7 @@ services:
- dataprep-pinecone-service
- retriever
- tei-reranking-service
- tgi-service
- vllm-service
ports:
- "8888:8888"
environment:
Expand All @@ -105,7 +105,7 @@ services:
- RETRIEVER_SERVICE_HOST_IP=retriever
- RERANK_SERVER_HOST_IP=tei-reranking-service
- RERANK_SERVER_PORT=${RERANK_SERVER_PORT:-80}
- LLM_SERVER_HOST_IP=tgi-service
- LLM_SERVER_HOST_IP=vllm-service
- LLM_SERVER_PORT=${LLM_SERVER_PORT:-80}
- LOGFLAG=${LOGFLAG}
- LLM_MODEL=${LLM_MODEL_ID}
Expand Down
Loading