Adding files to deploy AudioQnA application on ROCm vLLM (#1655)
Signed-off-by: Chingis Yundunov <YundunovCN@sibedge.com> Signed-off-by: Artem Astafev <a.astafev@datamonsters.com> Co-authored-by: Chingis Yundunov <YundunovCN@sibedge.com> Co-authored-by: Artem Astafev <a.astafev@datamonsters.com>
This commit is contained in:
committed by
GitHub
parent
7636de02e4
commit
60591d8d56
@@ -3,104 +3,317 @@
|
||||
This document outlines the deployment process for a AudioQnA application utilizing the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice
|
||||
pipeline on server on AMD ROCm GPU platform.
|
||||
|
||||
## 🚀 Build Docker images
|
||||
## Build Docker Images
|
||||
|
||||
### 1. Source Code install GenAIComps
|
||||
### 1. Build Docker Image
|
||||
|
||||
- #### Create application install directory and go to it:
|
||||
|
||||
```bash
|
||||
mkdir ~/audioqna-install && cd audioqna-install
|
||||
```
|
||||
|
||||
- #### Clone the repository GenAIExamples (the default repository branch "main" is used here):
|
||||
|
||||
```bash
|
||||
git clone https://github.com/opea-project/GenAIExamples.git
|
||||
```
|
||||
|
||||
If you need to use a specific branch/tag of the GenAIExamples repository, then (v1.3 replace with its own value):
|
||||
|
||||
```bash
|
||||
git clone https://github.com/opea-project/GenAIExamples.git && cd GenAIExamples && git checkout v1.3
|
||||
```
|
||||
|
||||
We remind you that when using a specific version of the code, you need to use the README from this version:
|
||||
|
||||
- #### Go to build directory:
|
||||
|
||||
```bash
|
||||
cd ~/audioqna-install/GenAIExamples/AudioQnA/docker_image_build
|
||||
```
|
||||
|
||||
- Cleaning up the GenAIComps repository if it was previously cloned in this directory.
|
||||
This is necessary if the build was performed earlier and the GenAIComps folder exists and is not empty:
|
||||
|
||||
```bash
|
||||
echo Y | rm -R GenAIComps
|
||||
```
|
||||
|
||||
- #### Clone the repository GenAIComps (the default repository branch "main" is used here):
|
||||
|
||||
```bash
|
||||
git clone https://github.com/opea-project/GenAIComps.git
|
||||
cd GenAIComps
|
||||
```
|
||||
|
||||
### 2. Build ASR Image
|
||||
We remind you that when using a specific version of the code, you need to use the README from this version.
|
||||
|
||||
```bash
|
||||
docker build -t opea/whisper:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/asr/src/integrations/dependency/whisper/Dockerfile .
|
||||
- #### Setting the list of images for the build (from the build file.yaml)
|
||||
|
||||
If you want to deploy a vLLM-based or TGI-based application, then the set of services is installed as follows:
|
||||
|
||||
#### vLLM-based application
|
||||
|
||||
```bash
|
||||
service_list="vllm-rocm whisper speecht5 audioqna audioqna-ui"
|
||||
```
|
||||
|
||||
#### TGI-based application
|
||||
|
||||
```bash
|
||||
service_list="whisper speecht5 audioqna audioqna-ui"
|
||||
```
|
||||
|
||||
- #### Optional. Pull TGI Docker Image (Do this if you want to use TGI)
|
||||
|
||||
```bash
|
||||
docker pull ghcr.io/huggingface/text-generation-inference:2.3.1-rocm
|
||||
```
|
||||
|
||||
- #### Build Docker Images
|
||||
|
||||
```bash
|
||||
docker compose -f build.yaml build ${service_list} --no-cache
|
||||
```
|
||||
|
||||
After the build, we check the list of images with the command:
|
||||
|
||||
```bash
|
||||
docker image ls
|
||||
```
|
||||
|
||||
The list of images should include:
|
||||
|
||||
##### vLLM-based application:
|
||||
|
||||
- opea/vllm-rocm:latest
|
||||
- opea/whisper:latest
|
||||
- opea/speecht5:latest
|
||||
- opea/audioqna:latest
|
||||
|
||||
##### TGI-based application:
|
||||
|
||||
- ghcr.io/huggingface/text-generation-inference:2.3.1-rocm
|
||||
- opea/whisper:latest
|
||||
- opea/speecht5:latest
|
||||
- opea/audioqna:latest
|
||||
|
||||
---
|
||||
|
||||
## Deploy the AudioQnA Application
|
||||
|
||||
### Docker Compose Configuration for AMD GPUs
|
||||
|
||||
To enable GPU support for AMD GPUs, the following configuration is added to the Docker Compose file:
|
||||
|
||||
- compose_vllm.yaml - for vLLM-based application
|
||||
- compose.yaml - for TGI-based
|
||||
|
||||
```yaml
|
||||
shm_size: 1g
|
||||
devices:
|
||||
- /dev/kfd:/dev/kfd
|
||||
- /dev/dri/:/dev/dri/
|
||||
cap_add:
|
||||
- SYS_PTRACE
|
||||
group_add:
|
||||
- video
|
||||
security_opt:
|
||||
- seccomp:unconfined
|
||||
```
|
||||
|
||||
### 3. Build LLM Image
|
||||
This configuration forwards all available GPUs to the container. To use a specific GPU, specify its `cardN` and `renderN` device IDs. For example:
|
||||
|
||||
For compose for ROCm example AMD optimized image hosted in huggingface repo will be used for TGI service: ghcr.io/huggingface/text-generation-inference:2.3.1-rocm (https://github.com/huggingface/text-generation-inference)
|
||||
|
||||
### 4. Build TTS Image
|
||||
|
||||
```bash
|
||||
docker build -t opea/speecht5:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/tts/src/integrations/dependency/speecht5/Dockerfile .
|
||||
```yaml
|
||||
shm_size: 1g
|
||||
devices:
|
||||
- /dev/kfd:/dev/kfd
|
||||
- /dev/dri/card0:/dev/dri/card0
|
||||
- /dev/dri/render128:/dev/dri/render128
|
||||
cap_add:
|
||||
- SYS_PTRACE
|
||||
group_add:
|
||||
- video
|
||||
security_opt:
|
||||
- seccomp:unconfined
|
||||
```
|
||||
|
||||
### 5. Build MegaService Docker Image
|
||||
**How to Identify GPU Device IDs:**
|
||||
Use AMD GPU driver utilities to determine the correct `cardN` and `renderN` IDs for your GPU.
|
||||
|
||||
To construct the Mega Service, we utilize the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice pipeline within the `audioqna.py` Python script. Build the MegaService Docker image using the command below:
|
||||
### Set deploy environment variables
|
||||
|
||||
#### Setting variables in the operating system environment:
|
||||
|
||||
##### Set variable HUGGINGFACEHUB_API_TOKEN:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/opea-project/GenAIExamples.git
|
||||
cd GenAIExamples/AudioQnA/
|
||||
docker build --no-cache -t opea/audioqna:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f Dockerfile .
|
||||
### Replace the string 'your_huggingfacehub_token' with your HuggingFacehub repository access token.
|
||||
export HUGGINGFACEHUB_API_TOKEN='your_huggingfacehub_token'
|
||||
```
|
||||
|
||||
Then run the command `docker images`, you will have following images ready:
|
||||
#### Set variables value in set_env\*\*\*\*.sh file:
|
||||
|
||||
1. `opea/whisper:latest`
|
||||
2. `opea/speecht5:latest`
|
||||
3. `opea/audioqna:latest`
|
||||
|
||||
## 🚀 Set the environment variables
|
||||
|
||||
Before starting the services with `docker compose`, you have to recheck the following environment variables.
|
||||
Go to Docker Compose directory:
|
||||
|
||||
```bash
|
||||
export host_ip=<your External Public IP> # export host_ip=$(hostname -I | awk '{print $1}')
|
||||
export HUGGINGFACEHUB_API_TOKEN=<your HF token>
|
||||
|
||||
export LLM_MODEL_ID=Intel/neural-chat-7b-v3-3
|
||||
|
||||
export MEGA_SERVICE_HOST_IP=${host_ip}
|
||||
export WHISPER_SERVER_HOST_IP=${host_ip}
|
||||
export SPEECHT5_SERVER_HOST_IP=${host_ip}
|
||||
export LLM_SERVER_HOST_IP=${host_ip}
|
||||
|
||||
export WHISPER_SERVER_PORT=7066
|
||||
export SPEECHT5_SERVER_PORT=7055
|
||||
export LLM_SERVER_PORT=3006
|
||||
|
||||
export BACKEND_SERVICE_ENDPOINT=http://${host_ip}:3008/v1/audioqna
|
||||
cd ~/audioqna-install/GenAIExamples/AudioQnA/docker_compose/amd/gpu/rocm
|
||||
```
|
||||
|
||||
or use set_env.sh file to setup environment variables.
|
||||
The example uses the Nano text editor. You can use any convenient text editor:
|
||||
|
||||
Note: Please replace with host_ip with your external IP address, do not use localhost.
|
||||
|
||||
Note: In order to limit access to a subset of GPUs, please pass each device individually using one or more -device /dev/dri/rendered, where is the card index, starting from 128. (https://rocm.docs.amd.com/projects/install-on-linux/en/latest/how-to/docker.html#docker-restrict-gpus)
|
||||
|
||||
Example for set isolation for 1 GPU
|
||||
|
||||
- /dev/dri/card0:/dev/dri/card0
|
||||
- /dev/dri/renderD128:/dev/dri/renderD128
|
||||
|
||||
Example for set isolation for 2 GPUs
|
||||
|
||||
- /dev/dri/card0:/dev/dri/card0
|
||||
- /dev/dri/renderD128:/dev/dri/renderD128
|
||||
- /dev/dri/card0:/dev/dri/card0
|
||||
- /dev/dri/renderD129:/dev/dri/renderD129
|
||||
|
||||
Please find more information about accessing and restricting AMD GPUs in the link (https://rocm.docs.amd.com/projects/install-on-linux/en/latest/how-to/docker.html#docker-restrict-gpus)
|
||||
|
||||
## 🚀 Start the MegaService
|
||||
#### If you use vLLM
|
||||
|
||||
```bash
|
||||
cd GenAIExamples/AudioQnA/docker_compose/amd/gpu/rocm/
|
||||
docker compose up -d
|
||||
nano set_env_vllm.sh
|
||||
```
|
||||
|
||||
In following cases, you could build docker image from source by yourself.
|
||||
#### If you use TGI
|
||||
|
||||
- Failed to download the docker image.
|
||||
- If you want to use a specific version of Docker image.
|
||||
```bash
|
||||
nano set_env.sh
|
||||
```
|
||||
|
||||
Please refer to 'Build Docker Images' in below.
|
||||
If you are in a proxy environment, also set the proxy-related environment variables:
|
||||
|
||||
## 🚀 Consume the AudioQnA Service
|
||||
```bash
|
||||
export http_proxy="Your_HTTP_Proxy"
|
||||
export https_proxy="Your_HTTPs_Proxy"
|
||||
```
|
||||
|
||||
Set the values of the variables:
|
||||
|
||||
- **HOST_IP, HOST_IP_EXTERNAL** - These variables are used to configure the name/address of the service in the operating system environment for the application services to interact with each other and with the outside world.
|
||||
|
||||
If your server uses only an internal address and is not accessible from the Internet, then the values for these two variables will be the same and the value will be equal to the server's internal name/address.
|
||||
|
||||
If your server uses only an external, Internet-accessible address, then the values for these two variables will be the same and the value will be equal to the server's external name/address.
|
||||
|
||||
If your server is located on an internal network, has an internal address, but is accessible from the Internet via a proxy/firewall/load balancer, then the HOST_IP variable will have a value equal to the internal name/address of the server, and the EXTERNAL_HOST_IP variable will have a value equal to the external name/address of the proxy/firewall/load balancer behind which the server is located.
|
||||
|
||||
We set these values in the file set_env\*\*\*\*.sh
|
||||
|
||||
- **Variables with names like "**\*\*\*\*\*\*\_PORT"\*\* - These variables set the IP port numbers for establishing network connections to the application services.
|
||||
The values shown in the file set_env.sh or set_env_vllm they are the values used for the development and testing of the application, as well as configured for the environment in which the development is performed. These values must be configured in accordance with the rules of network access to your environment's server, and must not overlap with the IP ports of other applications that are already in use.
|
||||
|
||||
#### Set variables with script set_env\*\*\*\*.sh
|
||||
|
||||
#### If you use vLLM
|
||||
|
||||
```bash
|
||||
. set_env_vllm.sh
|
||||
```
|
||||
|
||||
#### If you use TGI
|
||||
|
||||
```bash
|
||||
. set_env.sh
|
||||
```
|
||||
|
||||
### Start the services:
|
||||
|
||||
#### If you use vLLM
|
||||
|
||||
```bash
|
||||
docker compose -f compose_vllm.yaml up -d
|
||||
```
|
||||
|
||||
#### If you use TGI
|
||||
|
||||
```bash
|
||||
docker compose -f compose.yaml up -d
|
||||
```
|
||||
|
||||
All containers should be running and should not restart:
|
||||
|
||||
##### If you use vLLM:
|
||||
|
||||
- audioqna-vllm-service
|
||||
- whisper-service
|
||||
- speecht5-service
|
||||
- audioqna-backend-server
|
||||
- audioqna-ui-server
|
||||
|
||||
##### If you use TGI:
|
||||
|
||||
- audioqna-tgi-service
|
||||
- whisper-service
|
||||
- speecht5-service
|
||||
- audioqna-backend-server
|
||||
- audioqna-ui-server
|
||||
|
||||
---
|
||||
|
||||
## Validate the Services
|
||||
|
||||
### 1. Validate the vLLM/TGI Service
|
||||
|
||||
#### If you use vLLM:
|
||||
|
||||
```bash
|
||||
DATA='{"model": "Intel/neural-chat-7b-v3-3t", '\
|
||||
'"messages": [{"role": "user", "content": "What is Deep Learning?"}], "max_tokens": 256}'
|
||||
|
||||
curl http://${HOST_IP}:${AUDIOQNA_VLLM_SERVICE_PORT}/v1/chat/completions \
|
||||
-X POST \
|
||||
-d "$DATA" \
|
||||
-H 'Content-Type: application/json'
|
||||
```
|
||||
|
||||
Checking the response from the service. The response should be similar to JSON:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "chatcmpl-142f34ef35b64a8db3deedd170fed951",
|
||||
"object": "chat.completion",
|
||||
"created": 1742270316,
|
||||
"model": "Intel/neural-chat-7b-v3-3",
|
||||
"choices": [
|
||||
{
|
||||
"index": 0,
|
||||
"message": {
|
||||
"role": "assistant",
|
||||
"content": "",
|
||||
"tool_calls": []
|
||||
},
|
||||
"logprobs": null,
|
||||
"finish_reason": "length",
|
||||
"stop_reason": null
|
||||
}
|
||||
],
|
||||
"usage": { "prompt_tokens": 66, "total_tokens": 322, "completion_tokens": 256, "prompt_tokens_details": null },
|
||||
"prompt_logprobs": null
|
||||
}
|
||||
```
|
||||
|
||||
If the service response has a meaningful response in the value of the "choices.message.content" key,
|
||||
then we consider the vLLM service to be successfully launched
|
||||
|
||||
#### If you use TGI:
|
||||
|
||||
```bash
|
||||
DATA='{"inputs":"What is Deep Learning?",'\
|
||||
'"parameters":{"max_new_tokens":256,"do_sample": true}}'
|
||||
|
||||
curl http://${HOST_IP}:${AUDIOQNA_TGI_SERVICE_PORT}/generate \
|
||||
-X POST \
|
||||
-d "$DATA" \
|
||||
-H 'Content-Type: application/json'
|
||||
```
|
||||
|
||||
Checking the response from the service. The response should be similar to JSON:
|
||||
|
||||
```json
|
||||
{
|
||||
"generated_text": " "
|
||||
}
|
||||
```
|
||||
|
||||
If the service response has a meaningful response in the value of the "generated_text" key,
|
||||
then we consider the TGI service to be successfully launched
|
||||
|
||||
### 2. Validate MegaServices
|
||||
|
||||
Test the AudioQnA megaservice by recording a .wav file, encoding the file into the base64 format, and then sending the
|
||||
base64 string to the megaservice endpoint. The megaservice will return a spoken response as a base64 string. To listen
|
||||
@@ -114,7 +327,7 @@ curl http://${host_ip}:3008/v1/audioqna \
|
||||
-H 'Content-Type: application/json' | sed 's/^"//;s/"$//' | base64 -d > output.wav
|
||||
```
|
||||
|
||||
## 🚀 Test MicroServices
|
||||
### 3. Validate MicroServices
|
||||
|
||||
```bash
|
||||
# whisper service
|
||||
@@ -123,15 +336,25 @@ curl http://${host_ip}:7066/v1/asr \
|
||||
-d '{"audio": "UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"}' \
|
||||
-H 'Content-Type: application/json'
|
||||
|
||||
# tgi service
|
||||
curl http://${host_ip}:3006/generate \
|
||||
-X POST \
|
||||
-d '{"inputs":"What is Deep Learning?","parameters":{"max_new_tokens":17, "do_sample": true}}' \
|
||||
-H 'Content-Type: application/json'
|
||||
|
||||
# speecht5 service
|
||||
curl http://${host_ip}:7055/v1/tts \
|
||||
-X POST \
|
||||
-d '{"text": "Who are you?"}' \
|
||||
-H 'Content-Type: application/json'
|
||||
```
|
||||
|
||||
### 4. Stop application
|
||||
|
||||
#### If you use vLLM
|
||||
|
||||
```bash
|
||||
cd ~/audioqna-install/GenAIExamples/AudioQnA/docker_compose/amd/gpu/rocm
|
||||
docker compose -f compose_vllm.yaml down
|
||||
```
|
||||
|
||||
#### If you use TGI
|
||||
|
||||
```bash
|
||||
cd ~/audioqna-install/GenAIExamples/AudioQnA/docker_compose/amd/gpu/rocm
|
||||
docker compose -f compose.yaml down
|
||||
```
|
||||
|
||||
101
AudioQnA/docker_compose/amd/gpu/rocm/compose_vllm.yaml
Normal file
101
AudioQnA/docker_compose/amd/gpu/rocm/compose_vllm.yaml
Normal file
@@ -0,0 +1,101 @@
|
||||
# Copyright (C) 2024 Advanced Micro Devices, Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
services:
|
||||
whisper-service:
|
||||
image: ${REGISTRY:-opea}/whisper:${TAG:-latest}
|
||||
container_name: whisper-service
|
||||
ports:
|
||||
- "${WHISPER_SERVER_PORT:-7066}:7066"
|
||||
ipc: host
|
||||
environment:
|
||||
no_proxy: ${no_proxy}
|
||||
http_proxy: ${http_proxy}
|
||||
https_proxy: ${https_proxy}
|
||||
restart: unless-stopped
|
||||
|
||||
speecht5-service:
|
||||
image: ${REGISTRY:-opea}/speecht5:${TAG:-latest}
|
||||
container_name: speecht5-service
|
||||
ports:
|
||||
- "${SPEECHT5_SERVER_PORT:-7055}:7055"
|
||||
ipc: host
|
||||
environment:
|
||||
no_proxy: ${no_proxy}
|
||||
http_proxy: ${http_proxy}
|
||||
https_proxy: ${https_proxy}
|
||||
restart: unless-stopped
|
||||
|
||||
audioqna-vllm-service:
|
||||
image: ${REGISTRY:-opea}/vllm-rocm:${TAG:-latest}
|
||||
container_name: audioqna-vllm-service
|
||||
ports:
|
||||
- "${VLLM_SERVICE_PORT:-8081}:8011"
|
||||
environment:
|
||||
no_proxy: ${no_proxy}
|
||||
http_proxy: ${http_proxy}
|
||||
https_proxy: ${https_proxy}
|
||||
HUGGINGFACEHUB_API_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
|
||||
HF_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
|
||||
HF_HUB_DISABLE_PROGRESS_BARS: 1
|
||||
HF_HUB_ENABLE_HF_TRANSFER: 0
|
||||
WILM_USE_TRITON_FLASH_ATTENTION: 0
|
||||
PYTORCH_JIT: 0
|
||||
volumes:
|
||||
- "${HF_CACHE_DIR:-./data}:/data"
|
||||
shm_size: 20G
|
||||
devices:
|
||||
- /dev/kfd:/dev/kfd
|
||||
- /dev/dri/:/dev/dri/
|
||||
cap_add:
|
||||
- SYS_PTRACE
|
||||
group_add:
|
||||
- video
|
||||
security_opt:
|
||||
- seccomp:unconfined
|
||||
- apparmor=unconfined
|
||||
command: "--model ${LLM_MODEL_ID} --swap-space 16 --disable-log-requests --dtype float16 --tensor-parallel-size 1 --host 0.0.0.0 --port 8011 --num-scheduler-steps 1 --distributed-executor-backend \"mp\""
|
||||
ipc: host
|
||||
|
||||
audioqna-backend-server:
|
||||
image: ${REGISTRY:-opea}/audioqna:${TAG:-latest}
|
||||
container_name: audioqna-backend-server
|
||||
depends_on:
|
||||
- whisper-service
|
||||
- audioqna-vllm-service
|
||||
- speecht5-service
|
||||
ports:
|
||||
- "${BACKEND_SERVICE_PORT:-3008}:8888"
|
||||
environment:
|
||||
no_proxy: ${no_proxy}
|
||||
https_proxy: ${https_proxy}
|
||||
http_proxy: ${http_proxy}
|
||||
MEGA_SERVICE_HOST_IP: ${MEGA_SERVICE_HOST_IP}
|
||||
WHISPER_SERVER_HOST_IP: ${WHISPER_SERVER_HOST_IP}
|
||||
WHISPER_SERVER_PORT: ${WHISPER_SERVER_PORT}
|
||||
LLM_SERVER_HOST_IP: ${LLM_SERVER_HOST_IP}
|
||||
LLM_SERVER_PORT: ${LLM_SERVER_PORT}
|
||||
LLM_MODEL_ID: ${LLM_MODEL_ID}
|
||||
SPEECHT5_SERVER_HOST_IP: ${SPEECHT5_SERVER_HOST_IP}
|
||||
SPEECHT5_SERVER_PORT: ${SPEECHT5_SERVER_PORT}
|
||||
ipc: host
|
||||
restart: always
|
||||
|
||||
audioqna-ui-server:
|
||||
image: ${REGISTRY:-opea}/audioqna-ui:${TAG:-latest}
|
||||
container_name: audioqna-ui-server
|
||||
depends_on:
|
||||
- audioqna-backend-server
|
||||
ports:
|
||||
- "${FRONTEND_SERVICE_PORT:-5173}:5173"
|
||||
environment:
|
||||
no_proxy: ${no_proxy}
|
||||
https_proxy: ${https_proxy}
|
||||
http_proxy: ${http_proxy}
|
||||
CHAT_URL: ${BACKEND_SERVICE_ENDPOINT}
|
||||
ipc: host
|
||||
restart: always
|
||||
|
||||
networks:
|
||||
default:
|
||||
driver: bridge
|
||||
27
AudioQnA/docker_compose/amd/gpu/rocm/set_env_vllm.sh
Normal file
27
AudioQnA/docker_compose/amd/gpu/rocm/set_env_vllm.sh
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash set_env.sh
|
||||
|
||||
# Copyright (C) 2024 Advanced Micro Devices, Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
|
||||
# export host_ip=<your External Public IP> # export host_ip=$(hostname -I | awk '{print $1}')
|
||||
|
||||
export host_ip=""
|
||||
export external_host_ip=""
|
||||
export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
|
||||
export HF_CACHE_DIR="./data"
|
||||
export LLM_MODEL_ID="Intel/neural-chat-7b-v3-3"
|
||||
export VLLM_SERVICE_PORT="8081"
|
||||
|
||||
export MEGA_SERVICE_HOST_IP=${host_ip}
|
||||
export WHISPER_SERVER_HOST_IP=${host_ip}
|
||||
export SPEECHT5_SERVER_HOST_IP=${host_ip}
|
||||
export LLM_SERVER_HOST_IP=${host_ip}
|
||||
|
||||
export WHISPER_SERVER_PORT=7066
|
||||
export SPEECHT5_SERVER_PORT=7055
|
||||
export LLM_SERVER_PORT=${VLLM_SERVICE_PORT}
|
||||
export BACKEND_SERVICE_PORT=18038
|
||||
export FRONTEND_SERVICE_PORT=18039
|
||||
|
||||
export BACKEND_SERVICE_ENDPOINT=http://${external_host_ip}:${BACKEND_SERVICE_PORT}/v1/audioqna
|
||||
256
AudioQnA/docker_compose/intel/cpu/xeon/README_vllm.md
Normal file
256
AudioQnA/docker_compose/intel/cpu/xeon/README_vllm.md
Normal file
@@ -0,0 +1,256 @@
|
||||
Copyright (C) 2025 Advanced Micro Devices, Inc.
|
||||
|
||||
# Deploy AudioQnA application
|
||||
|
||||
## 1. Clone repo and build Docker images
|
||||
|
||||
### 1.1. Cloning repo
|
||||
|
||||
Create an empty directory in home directory and navigate to it:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/audioqna-test && cd ~/audioqna-test
|
||||
```
|
||||
|
||||
Cloning GenAIExamples repo for build Docker images:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/opea-project/GenAIExamples.git
|
||||
```
|
||||
|
||||
### 1.2. Navigate to repo directory and switching to the desired version of the code:
|
||||
|
||||
If you are using the main branch, then you do not need to make the transition, the main branch is used by default
|
||||
|
||||
```bash
|
||||
cd ~/searchqna-test/GenAIExamples/SearchQnA/docker_image_build
|
||||
git clone https://github.com/opea-project/GenAIComps.git
|
||||
```
|
||||
|
||||
If you are using a specific branch or tag, then we perform git checkout to the desired version.
|
||||
|
||||
```bash
|
||||
### Replace "v1.2" with the code version you need (branch or tag)
|
||||
cd cd ~/searchqna-test/GenAIExamples/SearchQnA/docker_image_build && git checkout v1.2
|
||||
git clone https://github.com/opea-project/GenAIComps.git
|
||||
```
|
||||
|
||||
### 1.3. Build Docker images repo
|
||||
|
||||
#### Build Docker image:
|
||||
|
||||
```bash
|
||||
service_list="audioqna audioqna-ui whisper speecht5 vllm-rocm"
|
||||
docker compose -f build.yaml build --no-cache
|
||||
```
|
||||
|
||||
### 1.4. Checking for the necessary Docker images
|
||||
|
||||
After assembling the images, you can check their presence in the list of available images using the command:
|
||||
|
||||
```bash
|
||||
docker image ls
|
||||
```
|
||||
|
||||
The output of the command should contain images:
|
||||
|
||||
- opea/whisper:latest
|
||||
- opea/speecht5:latest
|
||||
- opea/vllm-rocm:latest
|
||||
- opea/audioqna:latest
|
||||
- opea/audioqna-ui:latest
|
||||
|
||||
## 2. Set deploy environment variables
|
||||
|
||||
### Setting variables in the operating system environment
|
||||
|
||||
#### Set variables:
|
||||
|
||||
```bash
|
||||
### Replace the string 'your_huggingfacehub_token' with your HuggingFacehub repository access token.
|
||||
export HUGGINGFACEHUB_API_TOKEN='your_huggingfacehub_token'
|
||||
```
|
||||
|
||||
### Setting variables in the file set_env_vllm.sh
|
||||
|
||||
```bash
|
||||
cd cd cd ~/searchqna-test/GenAIExamples/SearchQnA/docker_compose/amd/gpu/rocm
|
||||
### The example uses the Nano text editor. You can use any convenient text editor
|
||||
nano set_env_vllm.sh
|
||||
```
|
||||
|
||||
Set the values of the variables:
|
||||
|
||||
- **host_ip, external_host_ip** - These variables are used to configure the name/address of the service in the operating system environment for the application services to interact with each other and with the outside world.
|
||||
|
||||
If your server uses only an internal address and is not accessible from the Internet, then the values for these two variables will be the same and the value will be equal to the server's internal name/address.
|
||||
|
||||
If your server uses only an external, Internet-accessible address, then the values for these two variables will be the same and the value will be equal to the server's external name/address.
|
||||
|
||||
If your server is located on an internal network, has an internal address, but is accessible from the Internet via a proxy/firewall/load balancer, then the host_ip variable will have a value equal to the internal name/address of the server, and the external_host_ip variable will have a value equal to the external name/address of the proxy/firewall/load balancer behind which the server is located.
|
||||
|
||||
We set these values in the file set_env_vllm.sh
|
||||
|
||||
- **Variables with names like "%%%%\_PORT"** - These variables set the IP port numbers for establishing network connections to the application services.
|
||||
The values shown in the file set_env_vllm.sh they are the values used for the development and testing of the application, as well as configured for the environment in which the development is performed. These values must be configured in accordance with the rules of network access to your environment's server, and must not overlap with the IP ports of other applications that are already in use.
|
||||
|
||||
If you are in a proxy environment, also set the proxy-related environment variables:
|
||||
|
||||
```bash
|
||||
export http_proxy="Your_HTTP_Proxy"
|
||||
export https_proxy="Your_HTTPs_Proxy"
|
||||
```
|
||||
|
||||
## 3. Deploy application
|
||||
|
||||
### 3.1. Deploying applications using Docker Compose
|
||||
|
||||
```bash
|
||||
cd cd ~/audioqna-test/GenAIExamples/AudioQnA/docker_compose/amd/gpu/rocm/
|
||||
docker compose -f compose_vllm up -d
|
||||
```
|
||||
|
||||
After starting the containers, you need to view their status with the command:
|
||||
|
||||
```bash
|
||||
docker ps
|
||||
```
|
||||
|
||||
The following containers should be running:
|
||||
|
||||
- whisper-service
|
||||
- speecht5-service
|
||||
- audioqna-vllm-service
|
||||
- audioqna-backend-server
|
||||
- audioqna-ui-server
|
||||
|
||||
Containers should not restart.
|
||||
|
||||
#### 3.1.1. Configuring GPU forwarding
|
||||
|
||||
By default, in the Docker Compose file, compose_vllm.yaml is configured to forward all GPUs to the audioqna-vllm-service container.
|
||||
To use certain GPUs, you need to configure the forwarding of certain devices from the host system to the container.
|
||||
The configuration must be done in:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
#######
|
||||
audioqna-vllm-service:
|
||||
devices:
|
||||
```
|
||||
|
||||
Example for set isolation for 1 GPU
|
||||
|
||||
```
|
||||
- /dev/dri/card0:/dev/dri/card0
|
||||
- /dev/dri/renderD128:/dev/dri/renderD128
|
||||
```
|
||||
|
||||
Example for set isolation for 2 GPUs
|
||||
|
||||
```
|
||||
- /dev/dri/card0:/dev/dri/card0
|
||||
- /dev/dri/renderD128:/dev/dri/renderD128
|
||||
- /dev/dri/card1:/dev/dri/card1
|
||||
- /dev/dri/renderD129:/dev/dri/renderD129
|
||||
```
|
||||
|
||||
### 3.2. Checking the application services
|
||||
|
||||
#### 3.2.1. Checking audioqna-vllm-service
|
||||
|
||||
Verification is performed in two ways:
|
||||
|
||||
- Checking the container logs
|
||||
|
||||
```bash
|
||||
docker logs audioqna-vllm-service
|
||||
```
|
||||
|
||||
A message like this should appear in the logs:
|
||||
|
||||
```textmate
|
||||
INFO: Started server process [1]
|
||||
INFO: Waiting for application startup.
|
||||
INFO: Application startup complete.
|
||||
INFO: Uvicorn running on http://0.0.0.0:8011 (Press CTRL+C to quit)
|
||||
```
|
||||
|
||||
- Сhecking the response from the service
|
||||
```bash
|
||||
### curl request
|
||||
### Replace 18110 with the value set in the startup script in the variable VLLM_SERVICE_PORT
|
||||
curl http://${host_ip}:${VLLM_SERVICE_PORT}/v1/completions \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"model": "Intel/neural-chat-7b-v3-3",
|
||||
"prompt": "What is a Deep Learning?",
|
||||
"max_tokens": 30,
|
||||
"temperature": 0
|
||||
}'
|
||||
```
|
||||
The response from the service must be in the form of JSON:
|
||||
```json
|
||||
{
|
||||
"id": "cmpl-1d7d175d36d0491cba3abaa8b5bd6991",
|
||||
"object": "text_completion",
|
||||
"created": 1740411135,
|
||||
"model": "Intel/neural-chat-7b-v3-3",
|
||||
"choices": [
|
||||
{
|
||||
"index": 0,
|
||||
"text": " Deep learning is a subset of machine learning that involves the use of artificial neural networks to analyze and interpret data. It is called \"deep\" because it",
|
||||
"logprobs": null,
|
||||
"finish_reason": "length",
|
||||
"stop_reason": null,
|
||||
"prompt_logprobs": null
|
||||
}
|
||||
],
|
||||
"usage": { "prompt_tokens": 7, "total_tokens": 37, "completion_tokens": 30, "prompt_tokens_details": null }
|
||||
}
|
||||
```
|
||||
The value of "choice.text" must contain a response from the service that makes sense.
|
||||
If such a response is present, then the search-vllm-service is considered verified.
|
||||
|
||||
#### 3.2.2. Checking whisper-service
|
||||
|
||||
Сhecking the response from the service
|
||||
|
||||
```bash
|
||||
wget https://github.com/intel/intel-extension-for-transformers/raw/main/intel_extension_for_transformers/neural_chat/assets/audio/sample.wav
|
||||
curl http://${host_ip}:${WHISPER_SERVER_PORT}/v1/audio/transcriptions \
|
||||
-H "Content-Type: multipart/form-data" \
|
||||
-F file="@./sample.wav" \
|
||||
-F model="openai/whisper-small"
|
||||
```
|
||||
|
||||
The response from the service must be in the form of JSON:
|
||||
|
||||
```json
|
||||
{ "text": "who is pat gelsinger" }
|
||||
```
|
||||
|
||||
If the value of the text key is "who is pat gelsinger", then we consider the service to be successfully launched.
|
||||
|
||||
#### 3.2.3. Checking speecht5-service
|
||||
|
||||
Сhecking the response from the service
|
||||
|
||||
```bash
|
||||
curl http://${host_ip}:${SPEECHT5_SERVER_PORT}/v1/audio/speech -XPOST -d '{"input": "Who are you?"}' -H 'Content-Type: application/json' --output speech.mp3
|
||||
```
|
||||
|
||||
The result of the request is a speech.mp3 file. If you hear the phrase "Who are you?" while listening to the file, the service is considered successfully launched
|
||||
|
||||
#### 3.2.4. Checking audioqna-backend-server
|
||||
|
||||
Сhecking the response from the service
|
||||
|
||||
```bash
|
||||
curl http://${host_ip}:${BACKEND_SERVICE_PORT}/v1/audioqna \
|
||||
-X POST \
|
||||
-d '{"audio": "UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA", "max_tokens":64, "voice":"default"}' \
|
||||
-H 'Content-Type: application/json' | sed 's/^"//;s/"$//' | base64 -d > output.wav
|
||||
```
|
||||
|
||||
The result of the request is the output.wav file. If, when listening to it, you hear the answer that it is an assistant and a request for a new question, then the service is considered started.
|
||||
Reference in New Issue
Block a user