fix: lock PyTorch CUDA builds for transcription

This commit is contained in:
2026-07-14 15:30:53 +08:00
parent 790c775eac
commit 23e0529461
4 changed files with 98 additions and 18 deletions
+24
View File
@@ -36,6 +36,30 @@ Get-Content $Log -Tail 160
From WSL, wrap this in `powershell.exe -NoProfile -ExecutionPolicy Bypass -Command '...'`.
## PyTorch CUDA build pitfall
If `funasr-nano` logs `on cpu` on a Windows NVIDIA machine, check PyTorch:
```powershell
$TransDir = "$env:USERPROFILE\video-edit-planner-skill\scripts\transcription"
Set-Location $TransDir
uv run python -c "import torch; print(torch.__version__); print(torch.version.cuda); print(torch.cuda.is_available()); print(torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'no cuda')"
```
If this prints `+cpu`, `None`, and `False`, the environment has CPU-only PyTorch. Do **not** fix this with a one-off `uv pip install --torch-backend=auto` unless the project lock/config is also updated: `uv run` will sync from `uv.lock` and may immediately uninstall the CUDA build and reinstall the CPU build.
This project configures `torch` and `torchaudio` to use the PyTorch `cu130` index on Linux/Windows via `[tool.uv.sources]`. After pulling a version that includes that configuration, rebuild the environment with:
```powershell
$TransDir = "$env:USERPROFILE\video-edit-planner-skill\scripts\transcription"
Set-Location $TransDir
git pull
uv sync --reinstall
uv run python -c "import torch; print(torch.__version__); print(torch.version.cuda); print(torch.cuda.is_available()); print(torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'no cuda')"
```
Expected on an NVIDIA Windows host: `torch` version contains `+cu130`, `torch.version.cuda` is not `None`, and `torch.cuda.is_available()` is `True`.
## `editdistance` / Python version pitfall
Observed failure: