Commit 20752c87 authored by jerrrrry's avatar jerrrrry
Browse files

Update .gitlab-ci.yml

parent 936bec94
Pipeline #3300 failed
...@@ -14,11 +14,8 @@ benchmark_wan2.1: ...@@ -14,11 +14,8 @@ benchmark_wan2.1:
- echo "=========================================" - echo "========================================="
- echo "Step 1 Setting up the environment from /workspace/packages/wan2.1" - echo "Step 1 Setting up the environment from /workspace/packages/wan2.1"
- echo "=========================================" - echo "========================================="
# 定义预置文件的根目录
- export PACKAGE_DIR="/workspace/packages/wan2.1" - export PACKAGE_DIR="/workspace/packages/wan2.1"
# 从预置目录解压库文件
- tar -xzf "$PACKAGE_DIR/rocblas-install-0910-bug.tar.gz" - tar -xzf "$PACKAGE_DIR/rocblas-install-0910-bug.tar.gz"
# 设置环境变量,模型路径指向预置目录
- export LD_LIBRARY_PATH="$CI_PROJECT_DIR/rocblas-install/lib/:$LD_LIBRARY_PATH" - export LD_LIBRARY_PATH="$CI_PROJECT_DIR/rocblas-install/lib/:$LD_LIBRARY_PATH"
- pip install -r requirements.txt -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple - pip install -r requirements.txt -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
- ln -s /workspace/packages/wan2.1/Wan_2.1/models/ ./models - ln -s /workspace/packages/wan2.1/Wan_2.1/models/ ./models
...@@ -26,7 +23,6 @@ benchmark_wan2.1: ...@@ -26,7 +23,6 @@ benchmark_wan2.1:
- echo "=========================================" - echo "========================================="
- echo "Step 2 Setting up ComfyUI directories" - echo "Step 2 Setting up ComfyUI directories"
- echo "=========================================" - echo "========================================="
# 创建ComfyUI需要的目录结构
- mkdir -p custom_nodes - mkdir -p custom_nodes
- mkdir -p input - mkdir -p input
- mkdir -p output - mkdir -p output
...@@ -37,187 +33,69 @@ benchmark_wan2.1: ...@@ -37,187 +33,69 @@ benchmark_wan2.1:
- echo "=========================================" - echo "========================================="
- echo "Step 3 Starting ComfyUI server" - echo "Step 3 Starting ComfyUI server"
- echo "=========================================" - echo "========================================="
# 创建日志目录
- mkdir -p logs - mkdir -p logs
# 后台启动ComfyUI服务器并记录日志
- bash run-main.sh > logs/comfyui.log 2>&1 & - bash run-main.sh > logs/comfyui.log 2>&1 &
# 获取ComfyUI进程ID
- export COMFYUI_PID=$! - export COMFYUI_PID=$!
- echo "ComfyUI server started with PID $COMFYUI_PID" - echo "ComfyUI server started with PID $COMFYUI_PID"
- echo "=========================================" - echo "========================================="
- echo "Step 4 Waiting for ComfyUI server to be ready" - echo "Step 4 Waiting for ComfyUI server to be ready"
- echo "=========================================" - echo "========================================="
# 等待服务器启动,最多等待5分钟 - timeout=300
- | - count=0
timeout=300 - while [ $count -lt $timeout ]; do if grep -q "http://127.0.0.1:8188" logs/comfyui.log; then echo "ComfyUI server is ready!"; break; fi; sleep 1; count=$((count+1)); done
count=0 - if [ $count -eq $timeout ]; then echo "Timeout waiting for ComfyUI server to start"; exit 1; fi
while [ $count -lt $timeout ]; do
if grep -q "http://127.0.0.1:8188" logs/comfyui.log; then
echo "ComfyUI server is ready!"
break
fi
sleep 1
count=$((count+1))
done
if [ $count -eq $timeout ]; then
echo "Timeout waiting for ComfyUI server to start"
exit 1
fi
- echo "=========================================" - echo "========================================="
- echo "Step 5 Running benchmark tests with precise seed replacement" - echo "Step 5 Running benchmark tests with precise seed replacement"
- echo "=========================================" - echo "========================================="
# 创建结果目录
- mkdir -p results - mkdir -p results
# 创建性能日志文件
- touch results/performance.log - touch results/performance.log
# 运行第一次测试(seed=2675441231)
- echo "Running first test with seed=2675441231" - echo "Running first test with seed=2675441231"
- | - cp wan_t2v_14B_1_gpu.py temp_test1.py
# 创建第一个测试文件 - sed -i 's/"seed": [0-9]\+,/"seed": 2675441231,/' temp_test1.py
cp wan_t2v_14B_1_gpu.py temp_test1.py - echo "=== Verifying temp_test1.py seed modification ==="
- if grep -q '"seed": 2675441231,' temp_test1.py; then echo "SUCCESS: Seed 2675441231 set"; grep -n '"seed": 2675441231,' temp_test1.py; else echo "ERROR: Failed to set seed 2675441231"; grep -n "seed" temp_test1.py; exit 1; fi
# 精确替换JSON中的seed值 - start_time=$(date +%s)
sed -i 's/"seed": [0-9]\+,/"seed": 2675441231,/' temp_test1.py - python temp_test1.py > results/test1_output.log 2>&1 &
- export TEST1_PID=$!
# 验证修改是否成功 - echo "Waiting for first webp file..."
echo "=== Verifying temp_test1.py seed modification ===" - timeout=600
if grep -q '"seed": 2675441231,' temp_test1.py; then - count=0
echo "✓ Seed 2675441231 successfully set in temp_test1.py" - while [ $count -lt $timeout ]; do webp_count=$(find output -name "*.webp" -type f | wc -l); if [ $webp_count -gt 0 ]; then echo "First webp detected! Count: $webp_count"; break; fi; sleep 2; count=$((count+2)); echo "Waiting... ${count}s elapsed, webp count: $webp_count"; done
grep -n '"seed": 2675441231,' temp_test1.py - if [ $count -eq $timeout ]; then echo "Timeout waiting for first webp file"; exit 1; fi
else - end_time=$(date +%s)
echo "✗ Failed to set seed 2675441231 in temp_test1.py" - duration=$((end_time - start_time))
echo "Current seed lines:" - echo "Test 1 execution time: $duration seconds" >> results/performance.log
grep -n "seed" temp_test1.py - echo "Test 1 completed in $duration seconds"
exit 1
fi
# 记录开始时间
start_time=$(date +%s)
# 运行测试
python temp_test1.py > results/test1_output.log 2>&1 &
export TEST1_PID=$!
echo "Waiting for first webp file to be generated..."
# 等待第一个webp文件生成,最多等待10分钟
timeout=600
count=0
while [ $count -lt $timeout ]; do
webp_count=$(find output -name "*.webp" -type f | wc -l)
if [ $webp_count -gt 0 ]; then
echo "First webp file detected! Count: $webp_count"
break
fi
sleep 2
count=$((count+2))
echo "Waiting... ${count}s elapsed, webp count: $webp_count"
done
if [ $count -eq $timeout ]; then
echo "Timeout waiting for first webp file"
exit 1
fi
# 记录结束时间和计算执行时间
end_time=$(date +%s)
duration=$((end_time - start_time))
echo "Test 1 execution time $duration seconds" >> results/performance.log
echo "Test 1 completed in $duration seconds"
# 运行第二次测试(seed=1234567890)
- echo "Running second test with seed=1234567890" - echo "Running second test with seed=1234567890"
- | - cp wan_t2v_14B_1_gpu.py temp_test2.py
# 创建第二个测试文件 - sed -i 's/"seed": [0-9]\+,/"seed": 1234567890,/' temp_test2.py
cp wan_t2v_14B_1_gpu.py temp_test2.py - echo "=== Verifying temp_test2.py seed modification ==="
- if grep -q '"seed": 1234567890,' temp_test2.py; then echo "SUCCESS: Seed 1234567890 set"; grep -n '"seed": 1234567890,' temp_test2.py; else echo "ERROR: Failed to set seed 1234567890"; echo "Using Python fallback method"; python3 -c "import re; content=open('temp_test2.py').read(); content=re.sub(r'(\\\"seed\\\":\\s*)\\d+', r'\\g<1>1234567890', content); open('temp_test2.py','w').write(content)"; if grep -q '"seed": 1234567890,' temp_test2.py; then echo "SUCCESS: Seed set using Python method"; grep -n '"seed": 1234567890,' temp_test2.py; else echo "ERROR: All methods failed"; cat temp_test2.py; exit 1; fi; fi
# 精确替换JSON中的seed值 - start_time=$(date +%s)
sed -i 's/"seed": [0-9]\+,/"seed": 1234567890,/' temp_test2.py - python temp_test2.py > results/test2_output.log 2>&1 &
- export TEST2_PID=$!
# 验证修改是否成功 - echo "Waiting for second webp file..."
echo "=== Verifying temp_test2.py seed modification ===" - timeout=600
if grep -q '"seed": 1234567890,' temp_test2.py; then - count=0
echo "✓ Seed 1234567890 successfully set in temp_test2.py" - while [ $count -lt $timeout ]; do webp_count=$(find output -name "*.webp" -type f | wc -l); if [ $webp_count -gt 1 ]; then echo "Second webp detected! Total count: $webp_count"; break; fi; sleep 2; count=$((count+2)); echo "Waiting... ${count}s elapsed, webp count: $webp_count"; done
grep -n '"seed": 1234567890,' temp_test2.py - if [ $count -eq $timeout ]; then echo "Timeout waiting for second webp file"; exit 1; fi
else - end_time=$(date +%s)
echo "✗ Failed to set seed 1234567890 in temp_test2.py" - duration=$((end_time - start_time))
echo "Current seed lines:" - echo "Test 2 execution time: $duration seconds" >> results/performance.log
grep -n "seed" temp_test2.py - echo "Test 2 completed in $duration seconds"
echo "Attempting alternative replacement method..."
# 备用方法:使用Python直接修改
python3 -c "
import re
with open('temp_test2.py', 'r') as f:
content = f.read()
# 使用正则表达式替换seed值
content = re.sub(r'(\"seed\":\s*)\d+', r'\g<1>1234567890', content)
with open('temp_test2.py', 'w') as f:
f.write(content)
"
# 再次验证
if grep -q '"seed": 1234567890,' temp_test2.py; then
echo "✓ Seed 1234567890 successfully set using Python method"
grep -n '"seed": 1234567890,' temp_test2.py
else
echo "✗ All methods failed to set seed 1234567890"
echo "Full file content for debugging:"
cat temp_test2.py
exit 1
fi
fi
# 记录开始时间
start_time=$(date +%s)
# 运行测试
python temp_test2.py > results/test2_output.log 2>&1 &
export TEST2_PID=$!
echo "Waiting for second webp file to be generated..."
# 等待第二个webp文件生成,最多等待10分钟
timeout=600
count=0
while [ $count -lt $timeout ]; do
webp_count=$(find output -name "*.webp" -type f | wc -l)
if [ $webp_count -gt 1 ]; then
echo "Second webp file detected! Total count: $webp_count"
break
fi
sleep 2
count=$((count+2))
echo "Waiting... ${count}s elapsed, webp count: $webp_count"
done
if [ $count -eq $timeout ]; then
echo "Timeout waiting for second webp file"
exit 1
fi
# 记录结束时间和计算执行时间
end_time=$(date +%s)
duration=$((end_time - start_time))
echo "Test 2 execution time $duration seconds" >> results/performance.log
echo "Test 2 completed in $duration seconds"
- echo "=========================================" - echo "========================================="
- echo "Step 6 Verifying and collecting results" - echo "Step 6 Verifying and collecting results"
- echo "=========================================" - echo "========================================="
# 验证两个webp文件都已生成
- webp_count=$(find output -name "*.webp" -type f | wc -l) - webp_count=$(find output -name "*.webp" -type f | wc -l)
- echo "Total webp files found: $webp_count" - echo "Total webp files found: $webp_count"
- if [ $webp_count -lt 2 ]; then echo "ERROR: Expected 2 webp files, but found $webp_count"; find output -name "*.webp" -type f -ls; exit 1; fi - if [ $webp_count -lt 2 ]; then echo "ERROR: Expected 2 webp files, but found $webp_count"; find output -name "*.webp" -type f -ls; exit 1; fi
# 查找并复制最新的两个webp文件
- find output -name "*.webp" -type f -exec ls -lt {} + | head -n 2 > results/latest_files.txt - find output -name "*.webp" -type f -exec ls -lt {} + | head -n 2 > results/latest_files.txt
# 复制文件到结果目录
- cat results/latest_files.txt | awk '{print $NF}' | while read filepath; do cp "$filepath" results/ && echo "Copied: $filepath"; done - cat results/latest_files.txt | awk '{print $NF}' | while read filepath; do cp "$filepath" results/ && echo "Copied: $filepath"; done
# 创建结果摘要
- echo "=== Test Results Summary ===" > results/summary.txt - echo "=== Test Results Summary ===" > results/summary.txt
- echo "Test 1 (seed=2675441231):" >> results/summary.txt - echo "Test 1 (seed=2675441231):" >> results/summary.txt
- grep "Prompt executed in" results/test1_output.log >> results/summary.txt || echo "No execution time found in test1" >> results/summary.txt - grep "Prompt executed in" results/test1_output.log >> results/summary.txt || echo "No execution time found in test1" >> results/summary.txt
...@@ -232,13 +110,10 @@ benchmark_wan2.1: ...@@ -232,13 +110,10 @@ benchmark_wan2.1:
- echo "=========================================" - echo "========================================="
- echo "Step 7 Cleaning up" - echo "Step 7 Cleaning up"
- echo "=========================================" - echo "========================================="
# 停止ComfyUI服务器
- kill $COMFYUI_PID || true - kill $COMFYUI_PID || true
# 清理临时文件
- rm -f temp_test1.py temp_test2.py - rm -f temp_test1.py temp_test2.py
- echo "Cleanup completed" - echo "Cleanup completed"
# 定义产物,保留测试生成的文件
artifacts: artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME" name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME"
paths: paths:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment