chaofengc/Face-SPARNet

AttributeError: 'SPARNet' object has no attribute 'module'

TuTinh opened this issue · 2 comments

I ran your code and got this error. How to fix this error ??
Traceback (most recent call last): File "test_enhance_single_unalign.py", line 105, in <module> enhance_model = def_models(opt) File "test_enhance_single_unalign.py", line 51, in def_models model.load_pretrain_model() File "/home/tutinh/Desktop/BTL_Hetrithuc/Face-SPARNet/models/sparnethd_model.py", line 56, in load_pretrain_model self.netG.module.load_state_dict(weight) File "/home/tutinh/miniconda3/envs/Face_SPARNet/lib/python3.7/site-packages/torch/nn/modules/module.py", line 594, in __getattr__ type(self).__name__, name)) AttributeError: 'SPARNet' object has no attribute 'module'

You need a GPU for quick test. Otherwise, you need to set the option --gpus to 0, and test the code with CPU. Note that this might be quick slow.

image
python test.py --gpus 0 --model sparnet --name SPARNet_S16_V4_Attn2D --load_size 128 --dataset_name single --dataroot test_dirs/Helen_test_DIC/ LR --pretrain_model_path ./pretrain_models/SPARNet-V16-S4-epoch20.pth --save_as_dir results_helen/SPARNet_S16_V4_Attn2D
I set the option --gpus to 0, but still get the same error as above. How to fix this error?