Skip to content

Commit c74b6c7

Browse files
cwlacewexiguiw
authored andcommitted
Fix VideoQnA
Signed-off-by: Lacewell, Chaunte W <chaunte.w.lacewell@intel.com>
1 parent cee24a0 commit c74b6c7

6 files changed

Lines changed: 306 additions & 132 deletions

File tree

VideoQnA/docker_compose/intel/cpu/xeon/README.md

Lines changed: 71 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Port 8001 - Open to 0.0.0.0/0
1717
1818
embedding
1919
=========
20-
Port 6000 - Open to 0.0.0.0/0
20+
Port 6990 - Open to 0.0.0.0/0
2121
2222
retriever
2323
=========
@@ -33,13 +33,13 @@ Port 9009 - Open to 0.0.0.0/0
3333
3434
lvm
3535
===
36-
Port 9000 - Open to 0.0.0.0/0
36+
Port 9399 - Open to 0.0.0.0/0
3737
38-
chaqna-xeon-backend-server
38+
videona-xeon-backend-server
3939
==========================
4040
Port 8888 - Open to 0.0.0.0/0
4141
42-
chaqna-xeon-ui-server
42+
videona-xeon-ui-server
4343
=====================
4444
Port 5173 - Open to 0.0.0.0/0
4545
```
@@ -106,17 +106,14 @@ docker build -t opea/videoqna-ui:latest --build-arg https_proxy=$https_proxy --b
106106

107107
Then run the command `docker images`, you will have the following 8 Docker Images:
108108

109+
1. `opea/embedding-multimodal-clip:latest`
110+
1. `opea/retriever:latest`
111+
1. `opea/reranking:latest`
112+
1. `opea/lvm-video-llama:latest`
113+
1. `opea/lvm:latest`
109114
1. `opea/dataprep:latest`
110-
2. `opea/embedding-multimodal-clip:latest`
111-
3. `opea/retriever:latest`
112-
4. `opea/reranking:latest`
113-
5. `opea/video-llama-lvm-server:latest`
114-
6. # `opea/lvm-video-llama:latest`
115-
7. `opea/reranking-tei:latest`
116-
8. `opea/lvm-video-llama:latest`
117-
9. `opea/lvm:latest`
118-
10. `opea/videoqna:latest`
119-
11. `opea/videoqna-ui:latest`
115+
1. `opea/videoqna:latest`
116+
1. `opea/videoqna-ui:latest`
120117

121118
## 🚀 Start Microservices
122119

@@ -132,18 +129,18 @@ Since the `compose.yaml` will consume some environment variables, you need to se
132129
export host_ip="External_Public_IP"
133130
```
134131

135-
**Export the value of your Huggingface API token to the `your_hf_api_token` environment variable**
132+
**Export the value of your Huggingface API token to the `HF_TOKEN` environment variable**
136133

137134
> Change the `Your_Huggingface_API_Token` below with your actual Huggingface API Token value
138135
139136
```
140-
export your_hf_api_token="Your_Huggingface_API_Token"
137+
export HF_TOKEN="Your_Huggingface_API_Token"
141138
```
142139

143140
**Append the value of the public IP address to the no_proxy list**
144141

145142
```
146-
export your_no_proxy="${your_no_proxy},${host_ip}"
143+
export no_proxy="${your_no_proxy},${host_ip}"
147144
```
148145

149146
Then you can run below commands or `source set_env.sh` to set all the variables
@@ -152,29 +149,54 @@ Then you can run below commands or `source set_env.sh` to set all the variables
152149
export no_proxy=${your_no_proxy}
153150
export http_proxy=${your_http_proxy}
154151
export https_proxy=${your_http_proxy}
155-
export MEGA_SERVICE_HOST_IP=${host_ip}
156-
export EMBEDDING_SERVICE_HOST_IP=${host_ip}
157-
export RETRIEVER_SERVICE_HOST_IP=${host_ip}
158-
export RERANK_SERVICE_HOST_IP=${host_ip}
159-
export LVM_SERVICE_HOST_IP=${host_ip}
160152

161-
export LVM_ENDPOINT="http://${host_ip}:9009"
162-
export BACKEND_SERVICE_ENDPOINT="http://${host_ip}:8888/v1/videoqna"
163-
export BACKEND_HEALTH_CHECK_ENDPOINT="http://${host_ip}:8888/v1/health_check"
164-
export DATAPREP_SERVICE_ENDPOINT="http://${host_ip}:6007/v1/dataprep/ingest"
165-
export DATAPREP_GET_FILE_ENDPOINT="http://${host_ip}:6007/v1/dataprep/get"
166-
export DATAPREP_GET_VIDEO_LIST_ENDPOINT="http://${host_ip}:6007/v1/dataprep/get_videos"
153+
export CACHE_DIR=/home/$USER/.cache/
154+
export HF_TOKEN=${HF_TOKEN}
155+
export HUGGINGFACEHUB_API_TOKEN=${HF_TOKEN}
167156

168-
export VDMS_HOST=${host_ip}
169-
export VDMS_PORT=8001
170157
export INDEX_NAME="mega-videoqna"
171-
export LLM_DOWNLOAD="True"
158+
export LLM_DOWNLOAD="True" # Set to "False" before redeploy LVM server to avoid model download
159+
export RERANK_COMPONENT_NAME="OPEA_VIDEO_RERANKING"
160+
export LVM_COMPONENT_NAME="OPEA_VIDEO_LLAMA_LVM"
161+
export EMBEDDING_COMPONENT_NAME="OPEA_CLIP_EMBEDDING"
172162
export USECLIP=1
163+
export LOGFLAG=True
173164

174-
export HUGGINGFACEHUB_API_TOKEN=${your_hf_api_token}
165+
export EMBEDDING_SERVICE_HOST_IP=${host_ip}
166+
export LVM_SERVICE_HOST_IP=${host_ip}
167+
export MEGA_SERVICE_HOST_IP=${host_ip}
168+
export RERANK_SERVICE_HOST_IP=${host_ip}
169+
export RETRIEVER_SERVICE_HOST_IP=${host_ip}
170+
export VDMS_HOST=${host_ip}
171+
172+
export BACKEND_PORT=8888
173+
export DATAPREP_PORT=6007
174+
export EMBEDDER_PORT=6990
175+
export LVM_PORT=9399
176+
export RERANKING_PORT=8000
177+
export RETRIEVER_PORT=7000
178+
export UI_PORT=5173
179+
export VDMS_PORT=8001
180+
export VIDEO_LLAMA_PORT=9009
181+
182+
export BACKEND_HEALTH_CHECK_ENDPOINT="http://${host_ip}:${BACKEND_PORT}/v1/health_check"
183+
export BACKEND_SERVICE_ENDPOINT="http://${host_ip}:${BACKEND_PORT}/v1/videoqna"
184+
export DATAPREP_GET_FILE_ENDPOINT="http://${host_ip}:${DATAPREP_PORT}/v1/dataprep/get"
185+
export DATAPREP_GET_VIDEO_LIST_ENDPOINT="http://${host_ip}:${DATAPREP_PORT}/v1/dataprep/get_videos"
186+
export DATAPREP_INGEST_SERVICE_ENDPOINT="http://${host_ip}:${DATAPREP_PORT}/v1/dataprep/ingest"
187+
export EMBEDDING_ENDPOINT="http://${host_ip}:${EMBEDDER_PORT}/v1/embeddings"
188+
export FRONTEND_ENDPOINT="http://${host_ip}:${UI_PORT}/_stcore/health"
189+
export LVM_ENDPOINT="http://${host_ip}:${VIDEO_LLAMA_PORT}"
190+
export LVM_VIDEO_ENDPOINT="http://${host_ip}:${VIDEO_LLAMA_PORT}/generate"
191+
export RERANKING_ENDPOINT="http://${host_ip}:${RERANKING_PORT}/v1/reranking"
192+
export RETRIEVER_ENDPOINT="http://${host_ip}:${RETRIEVER_PORT}/v1/retrieval"
193+
export TEI_RERANKING_ENDPOINT="http://${host_ip}:${TEI_RERANKING_PORT}"
194+
export UI_ENDPOINT="http://${host_ip}:${UI_PORT}/_stcore/health"
195+
196+
export no_proxy="${NO_PROXY},${host_ip},vdms-vector-db,dataprep-vdms-server,clip-embedding-server,multimodal-clip-embedding,reranking-tei-server,retriever-vdms-server,lvm-video-llama,lvm,videoqna-xeon-backend-server,videoqna-xeon-ui-server"
175197
```
176198

177-
Note: Replace with `host_ip` with you external IP address, do not use localhost.
199+
Note: Replace with `host_ip` with you external IP address, do not use localhost. You can also modify `CACHE_DIR` if needed.
178200

179201
### Start all the services with Docker Containers
180202

@@ -192,10 +214,10 @@ cd GenAIExamples/VideoQnA/docker_compose/intel/cpu/xeon/
192214

193215
docker volume create video-llama-model
194216
docker compose up vdms-vector-db dataprep -d
195-
sleep 1m # wait for the services ready
217+
sleep 30s
196218

197219
# Insert some sample data to the DB
198-
curl -X POST http://${host_ip}:6007/v1/dataprep/ingest \
220+
curl -X POST ${DATAPREP_INGEST_SERVICE_ENDPOINT} \
199221
-H "Content-Type: multipart/form-data" \
200222
-F "files=@./data/op_1_0320241830.mp4"
201223

@@ -212,11 +234,12 @@ docker compose up -d
212234

213235
```bash
214236
# Single file upload
215-
curl -X POST ${DATAPREP_SERVICE_ENDPOINT} \
237+
curl -X POST ${DATAPREP_INGEST_SERVICE_ENDPOINT} \
216238
-H "Content-Type: multipart/form-data" \
217239
-F "files=@./file1.mp4"
240+
218241
# Multiple file upload
219-
curl -X POST ${DATAPREP_SERVICE_ENDPOINT} \
242+
curl -X POST ${DATAPREP_INGEST_SERVICE_ENDPOINT} \
220243
-H "Content-Type: multipart/form-data" \
221244
-F "files=@./file1.mp4" \
222245
-F "files=@./file2.mp4" \
@@ -228,16 +251,17 @@ docker compose up -d
228251
```bash
229252
# List available videos
230253
curl -X 'GET' ${DATAPREP_GET_VIDEO_LIST_ENDPOINT} -H 'accept: application/json'
254+
231255
# Download available video
232256
curl -X 'GET' ${DATAPREP_GET_FILE_ENDPOINT}/video_name.mp4 -H 'accept: application/json'
233257
```
234258

235259
2. Embedding Microservice
236260

237261
```bash
238-
curl http://${host_ip}:6000/v1/embeddings \
262+
curl ${EMBEDDING_ENDPOINT} \
239263
-X POST \
240-
-d '{"text":"Sample text"}' \
264+
-d '{"input":"What is the man doing?"}' \
241265
-H 'Content-Type: application/json'
242266
```
243267

@@ -251,16 +275,16 @@ docker compose up -d
251275

252276
```bash
253277
export your_embedding=$(python3 -c "import random; embedding = [random.uniform(-1, 1) for _ in range(512)]; print(embedding)")
254-
curl http://${host_ip}:7000/v1/retrieval \
278+
curl ${RETRIEVER_ENDPOINT} \
255279
-X POST \
256-
-d "{\"text\":\"test\",\"embedding\":${your_embedding}}" \
280+
-d "{\"text\":\"What is the man doing?\",\"embedding\":${your_embedding},\"search_type\":\"mmr\", \"k\":4}" \
257281
-H 'Content-Type: application/json'
258282
```
259283

260284
4. Reranking Microservice
261285

262286
```bash
263-
curl http://${host_ip}:8000/v1/reranking \
287+
curl ${RERANKING_ENDPOINT} \
264288
-X 'POST' \
265289
-H 'accept: application/json' \
266290
-H 'Content-Type: application/json' \
@@ -282,7 +306,7 @@ docker compose up -d
282306

283307
```bash
284308
curl -X POST \
285-
"http://${host_ip}:9009/generate?video_url=silence_girl.mp4&start=0.0&duration=9&prompt=What%20is%20the%20person%20doing%3F&max_new_tokens=150" \
309+
"${LVM_VIDEO_ENDPOINT}?video_url=silence_girl.mp4&start=0.0&duration=9&prompt=What%20is%20the%20person%20doing%3F&max_new_tokens=150" \
286310
-H "accept: */*" \
287311
-d ''
288312
```
@@ -294,9 +318,10 @@ docker compose up -d
294318
This service depends on above LLM backend service startup. It will be ready after long time, to wait for them being ready in first startup.
295319

296320
```bash
297-
curl http://${host_ip}:9000/v1/lvm\
321+
curl http://${host_ip}:${LVM_PORT}/v1/lvm\
298322
-X POST \
299-
-d '{"video_url":"https://github.com/DAMO-NLP-SG/Video-LLaMA/raw/main/examples/silence_girl.mp4","chunk_start": 0,"chunk_duration": 7,"prompt":"What is the person doing?","max_new_tokens": 50}' \
323+
-d '{"video_url":"https://github.com/DAMO-NLP-SG/Video-LLaMA/raw/main/examples/silence_girl.mp4","chunk_start": 0,"chunk_duration": 7,"prompt":"What is the man doing?","max_new_tokens": 50}'
324+
\
300325
-H 'Content-Type: application/json'
301326
```
302327

@@ -305,7 +330,7 @@ docker compose up -d
305330
7. MegaService
306331

307332
```bash
308-
curl http://${host_ip}:8888/v1/videoqna -H "Content-Type: application/json" -d '{
333+
curl ${BACKEND_SERVICE_ENDPOINT} -H "Content-Type: application/json" -d '{
309334
"messages": "What is the man doing?",
310335
"stream": "True"
311336
}'

0 commit comments

Comments
 (0)