33set -e
44
55# NOTE(alpin): These are the default values for my own machine.
6- MAX_JOBS=96
7- NVCC_THREADS=96
6+ MAX_JOBS=28
7+ NVCC_THREADS=28
8+ CUDA_VERSION=12.4.1
9+ TORCH_CUDA_ARCH_LIST=" 6.0 6.1 7.0 7.5 8.0 8.6 8.9 9.0+PTX"
810
911while [[ " $# " -gt 0 ]]; do
1012 case $1 in
1113 --max_jobs) MAX_JOBS=" $2 " ; shift ;;
1214 --nvcc_threads) NVCC_THREADS=" $2 " ; shift ;;
15+ --cuda_version) CUDA_VERSION=" $2 " ; shift ;;
1316 * ) echo " Unknown parameter passed: $1 " ; exit 1 ;;
1417 esac
1518 shift
1619done
1720
21+ # Step 1: Build the wheel
22+ DOCKER_BUILDKIT=1 docker build . --target build --tag alpindale/aphrodite-build \
23+ --build-arg CUDA_VERSION=$CUDA_VERSION \
24+ --build-arg max_jobs=$MAX_JOBS \
25+ --build-arg nvcc_threads=$NVCC_THREADS
26+
27+ # Create a temporary container to extract the wheel
28+ docker run -d --name aphrodite-build-container alpindale/aphrodite-build tail -f /dev/null
29+ # Create dist directory if it doesn't exist
30+ mkdir -p dist
31+ # Copy the wheel to the dist directory
32+ docker cp aphrodite-build-container:/workspace/dist .
33+ docker stop aphrodite-build-container && docker rm aphrodite-build-container
34+
35+ # Step 2: Build the final Docker image using the wheel
1836DOCKER_BUILDKIT=1 docker build -f Dockerfile . --target aphrodite-openai --tag alpindale/aphrodite-openai \
19- --build-arg max_jobs=${MAX_JOBS} --build-arg nvcc_threads=${NVCC_THREADS}
37+ --build-arg CUDA_VERSION=$CUDA_VERSION \
38+ --build-arg max_jobs=$MAX_JOBS \
39+ --build-arg nvcc_threads=$NVCC_THREADS
2040
41+ # Step 3: Tag and push the Docker image
2142commit=$( git rev-parse --short HEAD)
2243docker tag alpindale/aphrodite-openai alpindale/aphrodite-openai:${commit}
2344docker push alpindale/aphrodite-openai:${commit}
2445docker tag alpindale/aphrodite-openai alpindale/aphrodite-openai:latest
25- docker push alpindale/aphrodite-openai:latest
46+ docker push alpindale/aphrodite-openai:latest
47+
48+ echo " Build and upload completed successfully!"
0 commit comments