Files
LocalAI/backend/python/fish-speech/prepare-source_test.sh
T
localai-org-maint-botandlocalai-org-maint-bot 411fdf10c3 fix(fish-speech): preserve ROCm PyTorch (#11568)
The upstream editable install pins generic PyTorch packages. It
replaces the HIP wheels with CUDA wheels in ROCm images.

Remove those pins only for hipBLAS builds before the editable install.
Keep the existing CPU and CUDA dependency behavior unchanged.

Assisted-by: Codex:gpt-5

Co-authored-by: localai-org-maint-bot <306269227+localai-org-maint-bot@users.noreply.github.com>
2026-08-18 08:58:38 +02:00

67 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
SCRIPT_DIR=$(dirname "$(realpath "$0")")
WORK_DIR=$(mktemp -d)
trap 'rm -rf "$WORK_DIR"' EXIT
write_fixture() {
cat > "$1" <<'EOF'
[project]
dependencies = [
"numpy",
"torch==2.8.0",
"torchaudio==2.8.0",
"pyaudio",
]
[project.optional-dependencies]
stable = [
"torch==2.8.0",
"torchaudio",
]
EOF
}
write_fixture "$WORK_DIR/rocm.toml"
write_fixture "$WORK_DIR/cuda.toml"
write_fixture "$WORK_DIR/cpu.toml"
bash "$SCRIPT_DIR/prepare-source.sh" hipblas "$WORK_DIR/rocm.toml"
bash "$SCRIPT_DIR/prepare-source.sh" cublas "$WORK_DIR/cuda.toml"
bash "$SCRIPT_DIR/prepare-source.sh" "" "$WORK_DIR/cpu.toml"
cat > "$WORK_DIR/expected-rocm.toml" <<'EOF'
[project]
dependencies = [
"numpy",
]
[project.optional-dependencies]
stable = [
"torch==2.8.0",
"torchaudio",
]
EOF
cat > "$WORK_DIR/expected-default.toml" <<'EOF'
[project]
dependencies = [
"numpy",
"torch==2.8.0",
"torchaudio==2.8.0",
]
[project.optional-dependencies]
stable = [
"torch==2.8.0",
"torchaudio",
]
EOF
diff -u "$WORK_DIR/expected-rocm.toml" "$WORK_DIR/rocm.toml"
diff -u "$WORK_DIR/expected-default.toml" "$WORK_DIR/cuda.toml"
diff -u "$WORK_DIR/expected-default.toml" "$WORK_DIR/cpu.toml"
echo "PASS: source preparation preserves each platform's PyTorch dependencies"