fix: address review feedback on CUDA backend swap

- Use YAML block scalar for inline run with colons (build-cuda.yml)
- Explicitly set VOICEBOX_BACKEND_VARIANT=cpu instead of setdefault (server.py)
- Use Path.replace() for atomic move on all platforms (cuda_download.py)
- Log actual exception in checksum fetch warning (cuda_download.py)
This commit is contained in:
James Pine
2026-03-13 00:20:05 -07:00
parent 2867421550
commit a69c216794
3 changed files with 8 additions and 9 deletions
+2 -1
View File
@@ -33,7 +33,8 @@ jobs:
pip install torchaudio --index-url https://download.pytorch.org/whl/cu121
- name: Verify CUDA support in torch
run: python -c "import torch; print(f'CUDA available in build: {torch.cuda.is_available()}'); print(f'CUDA version: {torch.version.cuda}')"
run: |
python -c "import torch; print(f'CUDA available in build: {torch.cuda.is_available()}'); print(f'CUDA version: {torch.version.cuda}')"
- name: Build CUDA server binary
shell: bash
+4 -6
View File
@@ -126,8 +126,8 @@ async def download_cuda_binary(version: Optional[str] = None):
# Format: "sha256hex filename\n"
expected_sha = sha_resp.text.strip().split()[0]
logger.info(f"Expected SHA-256: {expected_sha[:16]}...")
except Exception:
logger.warning("Could not fetch checksum file — skipping verification")
except Exception as e:
logger.warning(f"Could not fetch checksum file — skipping verification: {e}")
# Download and concatenate parts
total_downloaded = 0
@@ -169,10 +169,8 @@ async def download_cuda_binary(version: Optional[str] = None):
)
logger.info(f"Integrity verified: {actual[:16]}...")
# Atomic move into place
if final_path.exists():
final_path.unlink()
temp_path.rename(final_path)
# Atomic move into place (replace handles existing target on all platforms)
temp_path.replace(final_path)
# Make executable on Unix
if sys.platform != "win32":
+2 -2
View File
@@ -84,8 +84,8 @@ if __name__ == "__main__":
os.environ["VOICEBOX_BACKEND_VARIANT"] = "cuda"
logger.info("Backend variant: CUDA")
else:
os.environ.setdefault("VOICEBOX_BACKEND_VARIANT", "cpu")
logger.info(f"Backend variant: {os.environ['VOICEBOX_BACKEND_VARIANT']}")
os.environ["VOICEBOX_BACKEND_VARIANT"] = "cpu"
logger.info("Backend variant: CPU")
logger.info(f"Parsed arguments: host={args.host}, port={args.port}, data_dir={args.data_dir}")