mirror of
https://github.com/guillaumemeyer/watermarks-remover.git
synced 2026-08-22 13:11:57 +02:00
fix: Windows setup_ctrlregen.ps1 torch install (probe published indices, keep CUDA torch) (#124)
Three independent failure modes from #117: - $ErrorActionPreference 'Stop' + 2>$null on a native command aborts the script on torch's harmless stderr warnings (e.g. "Failed to initialize NumPy" when torch is installed before numpy). Run the probes through a new Invoke-NativeQuiet helper that lowers EAP to 'Continue' for the block and restores it afterwards. - The wheel index tag was derived from the driver's CUDA version, e.g. cu131 for a 13.1 driver, which does not exist (HTTP 403) and silently fell back to the default index, i.e. the CPU build on Windows. Probe the published indices and pick the highest one <= driver that answers HTTP 200; cu126 is still forced below compute capability 7.5. - Installing torch alone let requirements-ctrlregen.txt resolve torchvision from PyPI, and torchvision pins an exact torch, so pip replaced the +cu build with a +cpu one while the script still exited 0. Install torch AND torchvision together from the chosen index, and verify after the requirements install that torch.cuda.is_available() is true - if a GPU was detected but torch ends up CPU-only, warn loudly and exit non-zero. Also add a CI step (windows-latest, pwsh) that parses the setup .ps1 scripts and asserts the post-install CUDA verification survives. Fixes #117
This commit is contained in:
parent
b3de4c0085
commit
d4dd4735e9
@@ -330,12 +330,16 @@ NOAI_WATERMARK_DIR=~/noai-watermark \
|
||||
|
||||
On Windows use `setup_ctrlregen.ps1` (same flags as `-Dir`, `-Ref`, `-Python`);
|
||||
the venv lands in `.venv\Scripts\`, which `clean_image.py` already resolves.
|
||||
It picks the torch wheel index from the GPU's **compute capability** rather
|
||||
than the CUDA version `nvidia-smi` prints — that number is the maximum the
|
||||
*driver* supports, and drivers are backward compatible, so deriving the wheel
|
||||
tag from it installs `cu130` on a Pascal card whose kernels were dropped in
|
||||
`cu128`. The script forces `cu126` below compute capability 7.5 and then
|
||||
verifies the result with `torch.cuda.get_arch_list()`.
|
||||
It probes the published PyTorch wheel indices and picks the highest one at or
|
||||
below the CUDA version `nvidia-smi` prints that actually exists — that number
|
||||
is the maximum the *driver* supports, and drivers are backward compatible, so a
|
||||
driver reporting 13.1 (no published `cu131`) installs `cu130`. Below compute
|
||||
capability 7.5 it forces `cu126`, the last index whose wheels still carry
|
||||
Maxwell/Pascal/Volta kernels. It installs `torch` **and** `torchvision`
|
||||
together from that index so the dependency install cannot swap them for CPU
|
||||
builds from PyPI, then verifies after install that `torch.cuda.is_available()`
|
||||
is true — if a GPU was detected but torch ends up CPU-only, the script warns
|
||||
loudly and exits non-zero instead of pretending the setup succeeded.
|
||||
|
||||
### From `clean_image.py`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user