windows error NameError: name 'fused_act_ext' is not defined #187

Open
opened 2026-01-29 21:45:28 +00:00 by claunia · 1 comment
Owner

Originally created by @lj350201364 on GitHub (May 11, 2022).

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

Originally created by @lj350201364 on GitHub (May 11, 2022). 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 <module> 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
Author
Owner

@FlowDownTheRiver commented on GitHub (May 20, 2022):

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 commented on GitHub (May 20, 2022): 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](https://github.com/TencentARC/GFPGAN/files/8734749/0_Run_GfpGan_v1_2x.zip) Have fun ;)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TencentARC/GFPGAN#187