clovaai / stargan-v2

StarGAN v2 - Official PyTorch Implementation (CVPR 2020)
Other
3.51k stars 659 forks source link

eval bug #134

Open 1170300814 opened 2 years ago

1170300814 commented 2 years ago

`Traceback (most recent call last): File "/opt/data/private/starganv2/stargan-v2-master/metrics/eval.py", line 76, in calculate_metrics x_ref = next(iter_ref).to(device) UnboundLocalError: local variable 'iter_ref' referenced before assignment

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "main.py", line 182, in main(args) File "main.py", line 59, in main solver.train(loaders) File "/opt/data/private/starganv2/stargan-v2-master/core/solver.py", line 171, in train calculate_metrics(nets_ema, args, i+1, mode='reference') File "/root/anaconda3/envs/stargan-v2/lib/python3.6/site-packages/torch/autograd/grad_mode.py", line 49, in decorate_no_grad return func(*args, **kwargs) File "/opt/data/private/starganv2/stargan-v2-master/metrics/eval.py", line 79, in calculate_metrics x_ref = next(iter_ref).to(device) File "/root/anaconda3/envs/stargan-v2/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 345, in next data = self._next_data() File "/root/anaconda3/envs/stargan-v2/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 831, in _next_data raise StopIteration StopIteration ` this error has happened .i use the lattest version of eval.py.

the command is "nohup python main.py --mode train --num_domains 4 --w_hpf 1 --lambda_reg 1 --lambda_sty 1 --lambda_ds 1 --lambda_cyc 1 --train_img_dir data/Chinese-Landscape-Painting-Dataset-main/train --val_img_dir data/Chinese-Landscape-Painting-Dataset-main/val --num_workers 0 --batch_size 4 > /opt/data/private/starganv2/mylog 2>&1 &"

1170300814 commented 2 years ago

I give up to handle it

calgaryyc commented 2 years ago

same question

aliwaqas333 commented 2 years ago

setting --val_batch_size=1 solves the issue.