update
Browse files- RealESRGANv030/interface.py +19 -0
- requirements.txt +2 -2
RealESRGANv030/interface.py
CHANGED
@@ -3,6 +3,25 @@ import numpy as np
|
|
3 |
from PIL import Image
|
4 |
import glob
|
5 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
from basicsr.archs.rrdbnet_arch import RRDBNet
|
7 |
from basicsr.utils.download_util import load_file_from_url
|
8 |
|
|
|
3 |
from PIL import Image
|
4 |
import glob
|
5 |
import os
|
6 |
+
import sys
|
7 |
+
import types
|
8 |
+
|
9 |
+
# Compatibility shim for older basicsr expecting torchvision.transforms.functional_tensor
|
10 |
+
# Newer torchvision versions removed the functional_tensor module. If it's missing,
|
11 |
+
# create a minimal shim exposing rgb_to_grayscale that basicsr imports.
|
12 |
+
try:
|
13 |
+
# If this import works, no action is needed
|
14 |
+
from torchvision.transforms.functional_tensor import rgb_to_grayscale as _tv_rgb_to_grayscale # noqa: F401
|
15 |
+
except Exception:
|
16 |
+
try:
|
17 |
+
from torchvision.transforms import functional as _tv_functional
|
18 |
+
_shim = types.ModuleType('torchvision.transforms.functional_tensor')
|
19 |
+
_shim.rgb_to_grayscale = _tv_functional.rgb_to_grayscale
|
20 |
+
sys.modules['torchvision.transforms.functional_tensor'] = _shim
|
21 |
+
except Exception:
|
22 |
+
# If even this fails, let downstream imports raise as before
|
23 |
+
pass
|
24 |
+
|
25 |
from basicsr.archs.rrdbnet_arch import RRDBNet
|
26 |
from basicsr.utils.download_util import load_file_from_url
|
27 |
|
requirements.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
--extra-index-url https://download.pytorch.org/whl/
|
2 |
-
torch
|
3 |
torchvision
|
4 |
autocuda
|
5 |
findfile
|
|
|
1 |
+
--extra-index-url https://download.pytorch.org/whl/cu126
|
2 |
+
torch
|
3 |
torchvision
|
4 |
autocuda
|
5 |
findfile
|