Skip to content

Commit 4ad2475

Browse files
committed
add openEuler support for llm-docsum
Signed-off-by: zhihang <[email protected]>
1 parent 117feba commit 4ad2475

File tree

3 files changed

+86
-15
lines changed

3 files changed

+86
-15
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright (C) 2025 Huawei Technologies Co., Ltd.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
FROM openeuler/python:3.11.13-oe2403lts
5+
6+
ARG ARCH="cpu"
7+
8+
RUN yum update -y && yum install -y \
9+
jemalloc-devel && \
10+
yum clean all && \
11+
rm -rf /var/cache/yum
12+
13+
RUN useradd -m -s /bin/bash user && \
14+
mkdir -p /home/user && \
15+
chown -R user /home/user/
16+
17+
COPY comps /home/user/comps
18+
19+
ARG uvpip='uv pip install --system --no-cache-dir'
20+
RUN pip install --no-cache-dir --upgrade pip setuptools uv && \
21+
if [ ${ARCH} = "cpu" ]; then \
22+
$uvpip torch torchvision --index-url https://download.pytorch.org/whl/cpu; \
23+
$uvpip -r /home/user/comps/llms/src/doc-summarization/requirements-cpu.txt; \
24+
else \
25+
$uvpip -r /home/user/comps/llms/src/doc-summarization/requirements-gpu.txt; \
26+
fi
27+
28+
ENV PYTHONPATH=$PYTHONPATH:/home/user
29+
30+
# air gapped support: set model cache dir
31+
RUN mkdir -p /data && chown -R user /data
32+
ENV HF_HUB_CACHE=/data
33+
# air gapped support: pre-download tiktoken bpe files
34+
RUN mkdir -p /opt/tiktoken_cache
35+
ENV TIKTOKEN_CACHE_DIR=/opt/tiktoken_cache
36+
RUN python -c 'import tiktoken; tiktoken.get_encoding("cl100k_base");tiktoken.get_encoding("o200k_base");tiktoken.get_encoding("gpt2");tiktoken.get_encoding("r50k_base");tiktoken.get_encoding("p50k_base");tiktoken.get_encoding("p50k_edit");'
37+
RUN chown -R user /opt/tiktoken_cache
38+
39+
USER user
40+
41+
WORKDIR /home/user/comps/llms/src/doc-summarization
42+
43+
ENTRYPOINT ["python", "opea_docsum_microservice.py"]

tests/llms/test_llms_doc-summarization_tgi.sh

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ service_name="docsum-tgi"
2121

2222
function build_docker_images() {
2323
cd $WORKPATH
24-
docker build --no-cache -t ${REGISTRY:-opea}/llm-docsum:${TAG:-latest} --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/llms/src/doc-summarization/Dockerfile .
24+
dockerfile_name="comps/llms/src/doc-summarization/$1"
25+
docker build --no-cache -t ${REGISTRY:-opea}/llm-docsum:${TAG:-latest} --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f "$dockerfile_name" .
2526
if [ $? -ne 0 ]; then
2627
echo "opea/llm-docsum built fail"
2728
exit 1
@@ -155,25 +156,38 @@ function stop_docker() {
155156

156157
function main() {
157158

158-
stop_docker
159+
stop_service
159160

160-
build_docker_images
161+
build_docker_images "Dockerfile"
161162

162-
trap stop_docker EXIT
163+
trap stop_service EXIT
163164

164165
echo "Test normal env ..."
165166
start_service
166167
validate_microservices
167-
stop_docker
168+
stop_service
168169

169170
if [[ -n "${DATA_PATH}" ]]; then
170171
echo "Test air gapped env ..."
171172
start_service true
172173
validate_microservices
173-
stop_docker
174+
stop_service
174175
fi
175176

176-
echo y | docker system prune
177+
echo "Test with openEuler OS ..."
178+
build_docker_images "Dockerfile.openEuler"
179+
start_service
180+
validate_microservices
181+
stop_service
182+
183+
if [[ -n "${DATA_PATH}" ]]; then
184+
echo "Test air gapped env ..."
185+
start_service true
186+
validate_microservices
187+
stop_service
188+
fi
189+
190+
docker system prune -f
177191

178192
}
179193

tests/llms/test_llms_doc-summarization_vllm.sh

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ function build_docker_images() {
3232
fi
3333

3434
cd $WORKPATH
35-
docker build --no-cache -t ${REGISTRY:-opea}/llm-docsum:${TAG:-latest} --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/llms/src/doc-summarization/Dockerfile .
35+
dockerfile_name="comps/llms/src/doc-summarization/$1"
36+
docker build --no-cache -t ${REGISTRY:-opea}/llm-docsum:${TAG:-latest} --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f "$dockerfile_name" .
3637
if [ $? -ne 0 ]; then
3738
echo "opea/llm-docsum built fail"
3839
exit 1
@@ -159,32 +160,45 @@ function validate_microservices() {
159160
'{"messages":"Text Embeddings Inference (TEI) is a toolkit for deploying and serving open source text embeddings and sequence classification models. TEI enables high-performance extraction for the most popular models, including FlagEmbedding, Ember, GTE and E5.", "max_tokens":32, "language":"en", "summary_type": "refine", "chunk_size": 2000, "timeout":200}'
160161
}
161162

162-
function stop_docker() {
163+
function stop_service() {
163164
cd $WORKPATH/comps/llms/deployment/docker_compose
164165
docker compose -f compose_doc-summarization.yaml down --remove-orphans
165166
}
166167

167168
function main() {
168169

169-
stop_docker
170+
stop_service
170171

171-
build_docker_images
172+
build_docker_images "Dockerfile"
172173

173-
trap stop_docker EXIT
174+
trap stop_service EXIT
174175

175176
echo "Test normal env ..."
176177
start_service
177178
validate_microservices
178-
stop_docker
179+
stop_service
179180

180181
if [[ -n "${DATA_PATH}" ]]; then
181182
echo "Test air gapped env ..."
182183
start_service true
183184
validate_microservices
184-
stop_docker
185+
stop_service
185186
fi
186-
echo y | docker system prune
187187

188+
echo "Test with openEuler OS ..."
189+
build_docker_images "Dockerfile.openEuler"
190+
start_service
191+
validate_microservices
192+
stop_service
193+
194+
if [[ -n "${DATA_PATH}" ]]; then
195+
echo "Test air gapped env ..."
196+
start_service true
197+
validate_microservices
198+
stop_service
199+
fi
200+
201+
docker system prune -f
188202
}
189203

190204
main

0 commit comments

Comments
 (0)