mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-29 02:52:55 +08:00
Some checks failed
CE Compile Job / ce_job_pre_check (push) Has been cancelled
Deploy GitHub Pages / deploy (push) Has been cancelled
CE Compile Job / print_ce_job_pre_check_outputs (push) Has been cancelled
CE Compile Job / FD-Clone-Linux (push) Has been cancelled
CE Compile Job / Show Code Archive Output (push) Has been cancelled
CE Compile Job / BUILD_SM8090 (push) Has been cancelled
CE Compile Job / BUILD_SM8689 (push) Has been cancelled
CE Compile Job / CE_UPLOAD (push) Has been cancelled
Publish Job / publish_pre_check (push) Has been cancelled
Publish Job / print_publish_pre_check_outputs (push) Has been cancelled
Publish Job / FD-Clone-Linux (push) Has been cancelled
Publish Job / Show Code Archive Output (push) Has been cancelled
Publish Job / BUILD_SM8090 (push) Has been cancelled
Publish Job / BUILD_SM8689 (push) Has been cancelled
Publish Job / PADDLE_PYPI_UPLOAD_8090 (push) Has been cancelled
Publish Job / PADDLE_PYPI_UPLOAD_8689 (push) Has been cancelled
Publish Job / Run FastDeploy Unit Tests and Coverage (push) Has been cancelled
Publish Job / Run FastDeploy LogProb Tests (push) Has been cancelled
Publish Job / Extracted partial CE model tasks to run in CI. (push) Has been cancelled
Publish Job / Run Base Tests (push) Has been cancelled
Publish Job / Run Accuracy Tests (push) Has been cancelled
Publish Job / Run Stable Tests (push) Has been cancelled
CI Images Build / FD-Clone-Linux (push) Has been cancelled
CI Images Build / Show Code Archive Output (push) Has been cancelled
CI Images Build / CI Images Build (push) Has been cancelled
CI Images Build / BUILD_SM8090 (push) Has been cancelled
CI Images Build / Run FastDeploy Unit Tests and Coverage (push) Has been cancelled
CI Images Build / Run FastDeploy LogProb Tests (push) Has been cancelled
CI Images Build / Extracted partial CE model tasks to run in CI. (push) Has been cancelled
CI Images Build / Run Base Tests (push) Has been cancelled
CI Images Build / Run Accuracy Tests (push) Has been cancelled
CI Images Build / Run Stable Tests (push) Has been cancelled
CI Images Build / Publish Docker Images Pre Check (push) Has been cancelled
* add cache queue port * add cache queue port * add cache queue port
185 lines
7.5 KiB
YAML
185 lines
7.5 KiB
YAML
name: Run FastDeploy LogProb Tests
|
|
description: "Run FastDeploy LogProb Tests"
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
DOCKER_IMAGE:
|
|
description: "Build Images"
|
|
required: true
|
|
type: string
|
|
default: "ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddleqa:cuda126-py310"
|
|
PADDLETEST_ARCHIVE_URL:
|
|
description: "URL of the compressed FastDeploy code archive."
|
|
required: true
|
|
type: string
|
|
default: "https://xly-devops.bj.bcebos.com/PaddleTest/PaddleTest.tar.gz"
|
|
FASTDEPLOY_WHEEL_URL:
|
|
description: "URL of the FastDeploy Wheel."
|
|
required: true
|
|
type: string
|
|
CACHE_DIR:
|
|
description: "Cache Dir Use"
|
|
required: false
|
|
type: string
|
|
default: ""
|
|
MODEL_CACHE_DIR:
|
|
description: "Cache Dir Use"
|
|
required: false
|
|
type: string
|
|
default: ""
|
|
|
|
jobs:
|
|
run_tests_logprob:
|
|
runs-on: [self-hosted, GPU-h20-1Cards]
|
|
steps:
|
|
- name: Code Prepare
|
|
shell: bash
|
|
env:
|
|
docker_image: ${{ inputs.DOCKER_IMAGE }}
|
|
paddletest_archive_url: ${{ inputs.PADDLETEST_ARCHIVE_URL }}
|
|
run: |
|
|
docker pull ${docker_image}
|
|
# Clean the repository directory before starting
|
|
docker run --rm --net=host -v $(pwd):/workspace -w /workspace \
|
|
-e "REPO_NAME=${REPO_NAME}" \
|
|
-e "BASE_BRANCH=${BASE_BRANCH}" \
|
|
${docker_image} /bin/bash -c '
|
|
rm -rf /workspace/*
|
|
'
|
|
wget -q ${paddletest_archive_url}
|
|
tar -xf PaddleTest.tar.gz
|
|
rm -rf PaddleTest.tar.gz
|
|
cd PaddleTest
|
|
git config --global user.name "FastDeployCI"
|
|
git config --global user.email "fastdeploy_ci@example.com"
|
|
git log -n 3 --oneline
|
|
- name: logprob test
|
|
shell: bash
|
|
env:
|
|
docker_image: ${{ inputs.DOCKER_IMAGE }}
|
|
fastdeploy_wheel_url: ${{ inputs.FASTDEPLOY_WHEEL_URL }}
|
|
CACHE_DIR: ${{ inputs.CACHE_DIR }}
|
|
MODEL_CACHE_DIR: ${{ inputs.MODEL_CACHE_DIR }}
|
|
run: |
|
|
runner_name="${{ runner.name }}"
|
|
CARD_ID=$(echo "${runner_name}" | awk -F'-' '{print $NF}')
|
|
DEVICES=$(echo "$CARD_ID" | fold -w1 | paste -sd,)
|
|
DEVICE_PORT=$(echo "$DEVICES" | cut -d',' -f1)
|
|
|
|
FLASK_PORT=$((42068 + DEVICE_PORT * 100))
|
|
FD_API_PORT=$((42088 + DEVICE_PORT * 100))
|
|
FD_ENGINE_QUEUE_PORT=$((42058 + DEVICE_PORT * 100))
|
|
FD_METRICS_PORT=$((42078 + DEVICE_PORT * 100))
|
|
FD_CACHE_QUEUE_PORT=$((42098 + DEVICE_PORT * 100))
|
|
echo "Test ENV Parameter:"
|
|
echo "========================================================="
|
|
echo "FLASK_PORT=${FLASK_PORT}"
|
|
echo "FD_API_PORT=${FD_API_PORT}"
|
|
echo "FD_ENGINE_QUEUE_PORT=${FD_ENGINE_QUEUE_PORT}"
|
|
echo "FD_METRICS_PORT=${FD_METRICS_PORT}"
|
|
echo "FD_CACHE_QUEUE_PORT=${FD_CACHE_QUEUE_PORT}"
|
|
echo "DEVICES=${DEVICES}"
|
|
echo "========================================================="
|
|
|
|
CACHE_DIR="${CACHE_DIR:-$(dirname "$(dirname "${{ github.workspace }}")")}"
|
|
echo "CACHE_DIR is set to ${CACHE_DIR}"
|
|
if [ ! -f "${CACHE_DIR}/gitconfig" ]; then
|
|
touch "${CACHE_DIR}/gitconfig"
|
|
fi
|
|
if [ ! -d "${MODEL_CACHE_DIR}" ]; then
|
|
echo "Error: MODEL_CACHE_DIR '${MODEL_CACHE_DIR}' does not exist."
|
|
exit 1
|
|
fi
|
|
|
|
PORTS=($FLASK_PORT $FD_API_PORT $FD_ENGINE_QUEUE_PORT $FD_METRICS_PORT $FD_CACHE_QUEUE_PORT)
|
|
LOG_FILE="./port_cleanup_$(date +%Y%m%d_%H%M%S).log"
|
|
echo "==== LOG_FILE is ${LOG_FILE} ===="
|
|
|
|
echo "==== PORT CLEAN BEFORE TASK RUN ====" | tee -a $LOG_FILE
|
|
|
|
for port in "${PORTS[@]}"; do
|
|
PIDS=$(lsof -t -i :$port || true)
|
|
if [ -n "$PIDS" ]; then
|
|
echo "Port $port is occupied by PID(s): $PIDS" | tee -a $LOG_FILE
|
|
echo "$PIDS" | xargs -r kill -9
|
|
echo "Port $port cleared" | tee -a $LOG_FILE
|
|
else
|
|
echo "Port $port is free" | tee -a $LOG_FILE
|
|
fi
|
|
done
|
|
|
|
echo "==== PORT CLEAN COMPLETE ====" | tee -a $LOG_FILE
|
|
|
|
echo "========================================================="
|
|
echo "Ensuring no stale container named ${runner_name} ..."
|
|
if [ "$(docker ps -a -q -f name=${runner_name})" ]; then
|
|
echo "Removing stale container: ${runner_name}"
|
|
docker rm -f ${runner_name} || true
|
|
fi
|
|
docker run --rm --ipc=host --pid=host --net=host \
|
|
--name ${runner_name} \
|
|
-v $(pwd):/workspace \
|
|
-w /workspace \
|
|
-e fastdeploy_wheel_url=${fastdeploy_wheel_url} \
|
|
-e "FD_API_PORT=${FD_API_PORT}" \
|
|
-e "FD_ENGINE_QUEUE_PORT=${FD_ENGINE_QUEUE_PORT}" \
|
|
-e "FD_METRICS_PORT=${FD_METRICS_PORT}" \
|
|
-e "FD_CACHE_QUEUE_PORT=${FD_CACHE_QUEUE_PORT}" \
|
|
-e "FLASK_PORT=${FLASK_PORT}" \
|
|
-v "${MODEL_CACHE_DIR}:/MODELDATA" \
|
|
-v "${CACHE_DIR}/gitconfig:/etc/gitconfig:ro" \
|
|
-v "${CACHE_DIR}/.cache:/root/.cache" \
|
|
-v "${CACHE_DIR}/ConfigDir:/root/.config" \
|
|
-e TZ="Asia/Shanghai" \
|
|
--gpus '"device='"${DEVICES}"'"' ${docker_image} /bin/bash -xc '
|
|
python -m pip install --pre paddlepaddle-gpu -i https://www.paddlepaddle.org.cn/packages/nightly/cu126/
|
|
|
|
pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
|
|
|
|
python -m pip install ${fastdeploy_wheel_url}
|
|
|
|
wget https://paddle-qa.bj.bcebos.com/zhengtianyu/tools/llm-deploy-linux-amd64
|
|
chmod +x ./llm-deploy-linux-amd64
|
|
./llm-deploy-linux-amd64 -python python3.10 \
|
|
-model_name ERNIE-4.5-0.3B-Paddle \
|
|
-model_path /MODELDATA \
|
|
--skip install
|
|
|
|
cd PaddleTest/framework/ServeTest
|
|
python3.10 deploy.py > dd.log 2>&1 &
|
|
sleep 3
|
|
curl -X POST http://0.0.0.0:${FLASK_PORT}/start \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"--model\": \"/MODELDATA/ERNIE-4.5-0.3B-Paddle\"}"
|
|
|
|
curl -X POST http://localhost:${FLASK_PORT}/wait_for_infer?timeout=90
|
|
curl -s -o /dev/null -w "%{http_code}" -m 2 "http://0.0.0.0:${FD_API_PORT}/health"
|
|
curl -X POST "http://0.0.0.0:${FD_API_PORT}/v1/chat/completions" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"messages\": [{\"role\": \"user\", \"content\": \"1+1=?\"}], \"logprobs\": true}"
|
|
set +e
|
|
rm -rf ./baseline_output
|
|
cp -r baseline/ERNIE-4.5-0.3B-Paddle ./baseline_output
|
|
LOGPROB_EXIT_CODE=0
|
|
python3.10 lanucher.py --request_template TOKEN_LOGPROB --url http://localhost:${FD_API_PORT}/v1/chat/completions --case ./cases/demo.yaml --concurrency 1 --name demo --exe logprob || LOGPROB_EXIT_CODE=$?
|
|
echo "LOGPROB_EXIT_CODE=${LOGPROB_EXIT_CODE}" > /workspace/exit_code.env
|
|
curl -X POST http://localhost:${FLASK_PORT}/stop
|
|
sleep 10s
|
|
cat *result.log
|
|
exit 0
|
|
'
|
|
if [ $? -ne 0 ];then
|
|
exit 1
|
|
fi
|
|
|
|
if [ -f exit_code.env ]; then
|
|
cat exit_code.env >> $GITHUB_ENV
|
|
fi
|
|
- name: logprob test result
|
|
if: ${{ env.LOGPROB_EXIT_CODE != 0 }}
|
|
shell: bash
|
|
run: |
|
|
echo "logprob test failed with exit code ${{ env.LOGPROB_EXIT_CODE }}"
|
|
exit 8
|