@@ -385,41 +385,100 @@ jobs:
385385 - name : Strip unnecessary files to reduce size
386386 run : |
387387 cd /opt/vllm
388- echo "Size before cleanup: "
388+ echo "=== Size before cleanup === "
389389 du -sh .
390-
391- # Remove __pycache__ directories
390+ echo "Top consumers:"
391+ du -sh lib/python3.11/site-packages/torch/ 2>/dev/null || true
392+ du -sh lib/rocblas/ 2>/dev/null || true
393+ du -sh lib/hipblaslt/ 2>/dev/null || true
394+ du -sh lib/libLLVM* 2>/dev/null || true
395+ du -sh lib/libclang* 2>/dev/null || true
396+
397+ # --- PyTorch cleanup (biggest win, ~2-3 GB savings) ---
398+ SP="lib/python3.11/site-packages"
399+
400+ # Remove PyTorch test/benchmark/docs data
401+ rm -rf $SP/torch/test $SP/torch/testing $SP/torch/benchmarks 2>/dev/null || true
402+ rm -rf $SP/torch/_inductor/autoheuristic/datasets 2>/dev/null || true
403+ rm -rf $SP/torch/share 2>/dev/null || true
404+
405+ # Remove unused PyTorch backends (we only need ROCm/HIP)
406+ rm -rf $SP/torch/lib/libtorch_cuda.so 2>/dev/null || true
407+ rm -rf $SP/torch/lib/libcudnn*.so* 2>/dev/null || true
408+ rm -rf $SP/torch/lib/libnvrtc*.so* 2>/dev/null || true
409+ rm -rf $SP/torch/lib/libcublas*.so* 2>/dev/null || true
410+ rm -rf $SP/torch/lib/libcusparse*.so* 2>/dev/null || true
411+ rm -rf $SP/torch/lib/libcusolver*.so* 2>/dev/null || true
412+ rm -rf $SP/torch/lib/libcufft*.so* 2>/dev/null || true
413+ rm -rf $SP/torch/lib/libnccl*.so* 2>/dev/null || true
414+ rm -rf $SP/torch/lib/libnvfuser*.so* 2>/dev/null || true
415+ rm -rf $SP/torch/lib/libcaffe2_nvrtc.so 2>/dev/null || true
416+
417+ # Remove triton backends we don't need
418+ rm -rf $SP/triton/backends/nvidia 2>/dev/null || true
419+
420+ # Remove torchvision unnecessary data
421+ rm -rf $SP/torchvision/datasets 2>/dev/null || true
422+ rm -rf $SP/torchvision/models/_api.py 2>/dev/null || true
423+
424+ # --- General Python cleanup ---
392425 find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
393-
394- # Remove .pyc files
395426 find . -name "*.pyc" -delete 2>/dev/null || true
427+ find . -name "*.pyi" -delete 2>/dev/null || true
428+
429+ # Remove pip/setuptools/wheel (not needed at runtime)
430+ rm -rf $SP/pip* $SP/setuptools* $SP/wheel* $SP/pkg_resources* 2>/dev/null || true
431+ rm -rf $SP/_distutils_hack 2>/dev/null || true
432+
433+ # Remove .dist-info metadata (saves ~100MB)
434+ find $SP -type d -name "*.dist-info" -exec rm -rf {} + 2>/dev/null || true
435+
436+ # Remove test/benchmark dirs from all packages
437+ find $SP -maxdepth 2 -type d -name "tests" -exec rm -rf {} + 2>/dev/null || true
438+ find $SP -maxdepth 2 -type d -name "test" -exec rm -rf {} + 2>/dev/null || true
439+ find $SP -maxdepth 2 -type d -name "benchmarks" -exec rm -rf {} + 2>/dev/null || true
440+
441+ # Remove Python stdlib modules we don't need
442+ rm -rf lib/python3.11/test 2>/dev/null || true
443+ rm -rf lib/python3.11/unittest 2>/dev/null || true
444+ rm -rf lib/python3.11/tkinter 2>/dev/null || true
445+ rm -rf lib/python3.11/idlelib 2>/dev/null || true
446+ rm -rf lib/python3.11/turtledemo 2>/dev/null || true
447+ rm -rf lib/python3.11/ensurepip 2>/dev/null || true
448+
449+ # Remove include/ directory (headers not needed at runtime)
450+ rm -rf include/ 2>/dev/null || true
451+
452+ # --- Strip debug symbols from ALL .so files (~1-2 GB savings) ---
453+ echo "Stripping debug symbols from shared libraries..."
454+ find . -name '*.so' -o -name '*.so.*' | while read -r f; do
455+ [ -f "$f" ] && [ ! -L "$f" ] && strip --strip-debug "$f" 2>/dev/null || true
456+ done
396457
397- # Remove pip/setuptools caches
398- rm -rf lib/python3.11/site-packages/pip* 2>/dev/null || true
399- rm -rf lib/python3.11/site-packages/setuptools* 2>/dev/null || true
400- rm -rf lib/python3.11/site-packages/wheel* 2>/dev/null || true
401-
402- # Remove test directories from packages
403- find lib/python3.11/site-packages/ -type d -name "tests" -exec rm -rf {} + 2>/dev/null || true
404- find lib/python3.11/site-packages/ -type d -name "test" -exec rm -rf {} + 2>/dev/null || true
458+ # Strip the python binary too
459+ strip --strip-debug bin/python3.11 2>/dev/null || true
405460
406- echo "Size after cleanup: "
461+ echo "=== Size after cleanup === "
407462 du -sh .
463+ echo "Remaining top consumers:"
464+ du -sh lib/python3.11/site-packages/torch/ 2>/dev/null || true
465+ du -sh lib/rocblas/ 2>/dev/null || true
466+ du -sh lib/hipblaslt/ 2>/dev/null || true
467+ du -sh lib/libLLVM* 2>/dev/null || true
408468
409469 - name : List artifact contents
410470 run : |
411- echo "=== Artifact structure ==="
412- echo "Top-level:"
413- ls -la /opt/vllm/
471+ echo "=== Final artifact ==="
472+ du -sh /opt/vllm/
414473 echo ""
415- echo "bin/ contents :"
416- ls -la /opt/vllm/bin/vllm-server /opt/vllm/bin/python3* 2>/dev/null
474+ echo "Size breakdown by top-level dir :"
475+ du -sh /opt/vllm/*/ 2>/dev/null
417476 echo ""
418- echo "Key .so files in lib/:"
419- ls -la /opt/vllm/lib/lib*.so* 2>/dev/null | head -30
477+ echo "Largest items in lib/:"
478+ du -sh /opt/vllm/lib/* 2>/dev/null | sort -rh | head -15
420479 echo ""
421- echo "Total size :"
422- du -sh /opt/vllm/
480+ echo "bin/ entry points :"
481+ ls -la /opt/vllm/bin/vllm-server /opt/vllm/bin/python3* 2>/dev/null
423482
424483 - name : Upload build artifacts
425484 uses : actions/upload-artifact@v4
0 commit comments