mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2025-12-16 09:16:59 +08:00
This commit migrates the project from using NVIDIA CUDA to Intel XPU for GPU acceleration, based on the PyTorch 2.9 release. Key changes include: - Replaced `torch.cuda` with `torch.xpu` for device checks, memory management, and distributed training. - Updated device strings from "cuda" to "xpu" across the codebase. - Switched the distributed training backend from "nccl" to "ccl" for Intel GPUs. - Disabled custom CUDA kernels in the `BigVGAN` module by setting `use_cuda_kernel=False`. - Updated `requirements.txt` to include `torch==2.9` and `intel-extension-for-pytorch`. - Modified CI/CD pipelines and build scripts to remove CUDA dependencies and build for an XPU target.
62 lines
1.2 KiB
Bash
62 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
|
|
|
|
cd "$SCRIPT_DIR" || exit 1
|
|
|
|
set -e
|
|
|
|
if ! command -v docker &>/dev/null; then
|
|
echo "Docker Not Found"
|
|
exit 1
|
|
fi
|
|
|
|
trap 'echo "Error Occured at \"$BASH_COMMAND\" with exit code $?"; exit 1' ERR
|
|
|
|
LITE=false
|
|
|
|
print_help() {
|
|
echo "Usage: bash docker_build.sh [OPTIONS]"
|
|
echo ""
|
|
echo "Options:"
|
|
echo " --lite Build a Lite Image"
|
|
echo " -h, --help Show this help message and exit"
|
|
echo ""
|
|
echo "Examples:"
|
|
echo " bash docker_build.sh --lite"
|
|
}
|
|
|
|
# Parse arguments
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--lite)
|
|
LITE=true
|
|
shift
|
|
;;
|
|
-h|--help)
|
|
print_help
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo "Unknown Argument: $1"
|
|
echo "Use -h or --help to see available options."
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
TARGETPLATFORM=$(uname -m | grep -q 'x86' && echo "linux/amd64" || echo "linux/arm64")
|
|
|
|
if [ $LITE = true ]; then
|
|
TORCH_BASE="lite"
|
|
else
|
|
TORCH_BASE="full"
|
|
fi
|
|
|
|
docker build \
|
|
--build-arg LITE=$LITE \
|
|
--build-arg TARGETPLATFORM="$TARGETPLATFORM" \
|
|
--build-arg TORCH_BASE=$TORCH_BASE \
|
|
-t "${USER}/gpt-sovits:local" \
|
|
.
|