Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions .github/workflows/docker/compose/llms-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ services:
build:
dockerfile: comps/llms/src/doc-summarization/Dockerfile
image: ${REGISTRY:-opea}/llm-docsum:${TAG:-latest}
llm-docsum-openeuler:
build:
dockerfile: comps/llms/src/doc-summarization/Dockerfile.openEuler
image: ${REGISTRY:-opea}/llm-docsum:${TAG:-latest}-openeuler
llm-faqgen:
build:
dockerfile: comps/llms/src/faq-generation/Dockerfile
Expand Down
44 changes: 44 additions & 0 deletions comps/llms/src/doc-summarization/Dockerfile.openEuler
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright (C) 2025 Huawei Technologies Co., Ltd.
# SPDX-License-Identifier: Apache-2.0

FROM openeuler/python:3.11.13-oe2403lts

ARG ARCH="cpu"

RUN yum update -y && yum install -y \
shadow \
jemalloc-devel && \
yum clean all && \
rm -rf /var/cache/yum

RUN useradd -m -s /bin/bash user && \
mkdir -p /home/user && \
chown -R user /home/user/

COPY comps /home/user/comps

ARG uvpip='uv pip install --system --no-cache-dir'
RUN pip install --no-cache-dir --upgrade pip setuptools uv && \
if [ ${ARCH} = "cpu" ]; then \
$uvpip torch torchvision --index-url https://download.pytorch.org/whl/cpu; \
$uvpip -r /home/user/comps/llms/src/doc-summarization/requirements-cpu.txt; \
else \
$uvpip -r /home/user/comps/llms/src/doc-summarization/requirements-gpu.txt; \
fi

ENV PYTHONPATH=$PYTHONPATH:/home/user

# air gapped support: set model cache dir
RUN mkdir -p /data && chown -R user /data
ENV HF_HUB_CACHE=/data
# air gapped support: pre-download tiktoken bpe files
RUN mkdir -p /opt/tiktoken_cache
ENV TIKTOKEN_CACHE_DIR=/opt/tiktoken_cache
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");'
RUN chown -R user /opt/tiktoken_cache

USER user

WORKDIR /home/user/comps/llms/src/doc-summarization

ENTRYPOINT ["python", "opea_docsum_microservice.py"]
30 changes: 22 additions & 8 deletions tests/llms/test_llms_doc-summarization_tgi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ service_name="docsum-tgi"

function build_docker_images() {
cd $WORKPATH
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 .
dockerfile_name="comps/llms/src/doc-summarization/$1"
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" .
if [ $? -ne 0 ]; then
echo "opea/llm-docsum built fail"
exit 1
Expand Down Expand Up @@ -148,32 +149,45 @@ function validate_microservices() {
'{"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}'
}

function stop_docker() {
function stop_service() {
cd $WORKPATH/comps/llms/deployment/docker_compose
docker compose -f compose_doc-summarization.yaml down --remove-orphans
}

function main() {

stop_docker
stop_service

build_docker_images
build_docker_images "Dockerfile"

trap stop_docker EXIT
trap stop_service EXIT

echo "Test normal env ..."
start_service
validate_microservices
stop_docker
stop_service

if [[ -n "${DATA_PATH}" ]]; then
echo "Test air gapped env ..."
start_service true
validate_microservices
stop_docker
stop_service
fi

echo y | docker system prune
echo "Test with openEuler OS ..."
build_docker_images "Dockerfile.openEuler"
start_service
validate_microservices
stop_service

if [[ -n "${DATA_PATH}" ]]; then
echo "Test air gapped env ..."
start_service true
validate_microservices
stop_service
fi

docker system prune -f

}

Expand Down
51 changes: 35 additions & 16 deletions tests/llms/test_llms_doc-summarization_vllm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,26 @@ host_ip=$(hostname -I | awk '{print $1}')
LOG_PATH="$WORKPATH/tests"
service_name="docsum-vllm"


function build_docker_images() {
cd $WORKPATH
source $(git rev-parse --show-toplevel)/.github/env/_vllm_versions.sh
git clone --depth 1 -b ${VLLM_VER} --single-branch https://github.com/vllm-project/vllm.git && cd vllm
docker build --no-cache -f docker/Dockerfile.cpu -t ${REGISTRY:-opea}/vllm:${TAG:-latest} --shm-size=128g .
if [ $? -ne 0 ]; then
echo "opea/vllm built fail"
exit 1
if [[ -z "$(docker images -q ${REGISTRY:-opea}/vllm:${TAG:-latest})" ]]; then
source $(git rev-parse --show-toplevel)/.github/env/_vllm_versions.sh
git clone --depth 1 -b ${VLLM_VER} --single-branch https://github.com/vllm-project/vllm.git && cd vllm
docker build --no-cache -f docker/Dockerfile.cpu -t ${REGISTRY:-opea}/vllm:${TAG:-latest} --shm-size=128g .
if [ $? -ne 0 ]; then
echo "opea/vllm built fail"
exit 1
else
echo "opea/vllm built successful"
fi
else
echo "opea/vllm built successful"
echo "opea/vllm:${TAG:-latest} already exists, skip building."
fi

cd $WORKPATH
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 .

dockerfile_name="comps/llms/src/doc-summarization/$1"
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" .
if [ $? -ne 0 ]; then
echo "opea/llm-docsum built fail"
exit 1
Expand Down Expand Up @@ -159,32 +165,45 @@ function validate_microservices() {
'{"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}'
}

function stop_docker() {
function stop_service() {
cd $WORKPATH/comps/llms/deployment/docker_compose
docker compose -f compose_doc-summarization.yaml down --remove-orphans
}

function main() {

stop_docker
stop_service

build_docker_images
build_docker_images "Dockerfile"

trap stop_docker EXIT
trap stop_service EXIT

echo "Test normal env ..."
start_service
validate_microservices
stop_docker
stop_service

if [[ -n "${DATA_PATH}" ]]; then
echo "Test air gapped env ..."
start_service true
validate_microservices
stop_service
fi

echo "Test with openEuler OS ..."
build_docker_images "Dockerfile.openEuler"
start_service
validate_microservices
stop_service

if [[ -n "${DATA_PATH}" ]]; then
echo "Test air gapped env ..."
start_service true
validate_microservices
stop_docker
stop_service
fi
echo y | docker system prune

docker system prune -f
}

main
Loading