rastof9 commited on
Commit
5bbcbee
·
verified ·
1 Parent(s): 3b876a0

Update generate.py

Browse files
Files changed (1) hide show
  1. generate.py +16 -3
generate.py CHANGED
@@ -1,7 +1,20 @@
1
  # generate.py
2
- # --- VERSION 10 (with Upscaling) ---
3
-
4
- print("--- RUNNING GENERATE.PY VERSION 10 (with Upscaling) ---")
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  import torch
7
  import cv2
 
1
  # generate.py
2
+ # --- VERSION 11 (with Monkey-Patch) ---
3
+
4
+ print("--- RUNNING GENERATE.PY VERSION 11 (with Monkey-Patch) ---")
5
+
6
+ # --- MONKEY-PATCH FOR OLD TORCHVISION ---
7
+ # This block fixes the "ModuleNotFoundError" by tricking the system.
8
+ # It tells any library looking for the new `functional_tensor` module
9
+ # to use the old `functional` module instead.
10
+ try:
11
+ import sys
12
+ import torchvision.transforms.functional as F
13
+ sys.modules['torchvision.transforms.functional_tensor'] = F
14
+ print("--- Successfully applied torchvision monkey-patch. ---")
15
+ except Exception as e:
16
+ print(f"--- Could not apply torchvision monkey-patch: {e} ---")
17
+ # --- END OF PATCH ---
18
 
19
  import torch
20
  import cv2