fix: pin torch cu126 for GPU compatibility and fix cross-platform bugs

- Pin torch==2.6.0+cu126 and torchvision==0.21.0+cu126 in feature
  manifest to prevent NCCL symbol mismatch on CUDA 12.6 base images
- Move lpips after torch in install order to prevent wrong version
  resolution from PyPI
- Add einops to upscale-enhance common deps (required by SCUNet)
- Update cpu_fallback_packages to handle multi-package CUDA torch
  entries on amd64 without GPU
- Fix gpu.py ONNX CUDA detection: replace hardcoded .so path with
  cross-platform session smoke-test
- Fix os.dup(1) crashes on Windows in upscale, enhance_faces, and
  noise_removal by wrapping in try/except with sys.stderr fallback
- Guard top-level numpy/cv2 imports in colorize.py and restore.py
  with helpful error messages
- Add weights_only=False fallback for torch.load in noise_removal
- Fix integration tests to accept 501 for uninstalled AI features
  and 422 for missing system tools (exiftool, libheif)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ashim
2026-04-20 15:17:08 +08:00
co-authored by Claude Opus 4.6
parent ac5fdfb841
commit 01d30cfb61
10 changed files with 209 additions and 195 deletions
+12 -6
View File
@@ -130,9 +130,13 @@
"description": "AI upscaling, face enhancement, and noise removal",
"estimatedSize": "4-5 GB",
"packages": {
"common": ["codeformer-pip==0.0.4", "lpips", "huggingface-hub"],
"amd64": ["realesrgan==0.3.0 --extra-index-url https://download.pytorch.org/whl/cu126"],
"arm64": ["realesrgan==0.3.0"]
"common": ["codeformer-pip==0.0.4", "huggingface-hub", "einops"],
"amd64": [
"torch==2.6.0+cu126 torchvision==0.21.0+cu126 --index-url https://download.pytorch.org/whl/cu126",
"lpips",
"realesrgan==0.3.0"
],
"arm64": ["lpips", "realesrgan==0.3.0"]
},
"pipFlags": {
"codeformer-pip==0.0.4": "--no-deps"
@@ -199,13 +203,15 @@
"description": "Restore old or damaged photos",
"estimatedSize": "800 MB - 1 GB",
"packages": {
"common": ["codeformer-pip==0.0.4", "lpips", "huggingface-hub"],
"common": ["codeformer-pip==0.0.4", "huggingface-hub"],
"amd64": [
"onnxruntime-gpu==1.20.1",
"mediapipe==0.10.21",
"realesrgan==0.3.0 --extra-index-url https://download.pytorch.org/whl/cu126"
"torch==2.6.0+cu126 torchvision==0.21.0+cu126 --index-url https://download.pytorch.org/whl/cu126",
"lpips",
"realesrgan==0.3.0"
],
"arm64": ["onnxruntime==1.20.1", "mediapipe==0.10.18", "realesrgan==0.3.0"]
"arm64": ["onnxruntime==1.20.1", "mediapipe==0.10.18", "lpips", "realesrgan==0.3.0"]
},
"pipFlags": {
"codeformer-pip==0.0.4": "--no-deps"