GFPGAN icon indicating copy to clipboard operation
GFPGAN copied to clipboard

windows error NameError: name 'fused_act_ext' is not defined

Open lj350201364 opened this issue 2 years ago • 1 comments

E:\AIDeepLearn\旧照片修复\GFPGAN>python inference_gfpgan.py -i inputs/whole_imgs -o results -v 1 -s 2 Processing 2.png ... Traceback (most recent call last): File "inference_gfpgan.py", line 155, in main() File "inference_gfpgan.py", line 119, in main cropped_faces, restored_faces, restored_img = restorer.enhance( File "e:\Anaconda3\lib\site-packages\torch\autograd\grad_mode.py", line 26, in decorate_context return func(*args, **kwargs) File "E:\AIDeepLearn\旧照片修复\GFPGAN\gfpgan\utils.py", line 120, in enhance output = self.gfpgan(cropped_face_t, return_rgb=False)[0] File "e:\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "E:\AIDeepLearn\旧照片修复\GFPGAN\gfpgan\archs\gfpganv1_arch.py", line 367, in forward feat = self.conv_body_first(x) File "e:\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "e:\Anaconda3\lib\site-packages\torch\nn\modules\container.py", line 117, in forward input = module(input) File "e:\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "e:\Anaconda3\lib\site-packages\basicsr\ops\fused_act\fused_act.py", line 92, in forward return fused_leaky_relu(input, self.bias, self.negative_slope, self.scale) File "e:\Anaconda3\lib\site-packages\basicsr\ops\fused_act\fused_act.py", line 96, in fused_leaky_relu return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale) File "e:\Anaconda3\lib\site-packages\basicsr\ops\fused_act\fused_act.py", line 65, in forward if fused_act_ext: NameError: name 'fused_act_ext' is not defined

lj350201364 avatar May 11 '22 03:05 lj350201364

If you wanna use the paper model which is version 1 with colorization,you open cmd, "conda activate > your gfpgan environment<" , "pip install ninja" . Then make a bat file like this put it in your gfpgan directory.In the bat file after calling your environment , write : set BASICSR_JIT=True . This will set basicsr to just in time mode which means it will compile it real time which also means it will take some time to initialize each time you wanna run version 1 model.Otherwise model version 1 is giving error with precompiled settings.It comes with a price but this way it works

Example bat file : change environment,input and output folders 0_Run_GfpGan_v1_2x.zip

Have fun ;)

FlowDownTheRiver avatar May 19 '22 23:05 FlowDownTheRiver