linjx-ustc1106 / TuiGAN-PyTorch

PyTorch Implementation of ECCV 2020 Spotlight "TuiGAN: Learning Versatile Image-to-Image Translation with Two Unpaired Images"
186 stars 15 forks source link

when run train.py.I encounter a problem.I cannot know why? Thanks #4

Open hankhaohao opened 3 years ago

hankhaohao commented 3 years ago

Traceback (most recent call last): File "train.py", line 30, in train(opt, Gs, Zs, reals, NoiseAmp, Gs2, Zs2, reals2, NoiseAmp2) File "/export2/home/xavier.xu/project/TuiGAN-PyTorch/models/TuiGAN.py", line 72, in train z_curr,in_s,G_curr, z_curr2,in_s2,G_curr2 = train_single_scale(D_curr,G_curr, reals,Gs,Zs,in_s,NoiseAmp, D_curr2,G_curr2, reals2,Gs2,Zs2,in_s2,NoiseAmp2, opt,scale_num) File "/export2/home/xavier.xu/project/TuiGAN-PyTorch/models/TuiGAN.py", line 225, in train_single_scale errG.backward(retain_graph=True) File "/export2/home/xavier.xu/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/tensor.py", line 198, in backward torch.autograd.backward(self, gradient, retain_graph, create_graph) File "/export2/home/xavier.xu/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/autograd/init.py", line 100, in backward allow_unreachable=True) # allow_unreachable flag RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [3, 32, 3, 3]] is at version 2; expected version 1 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).

linjx-ustc1106 commented 3 years ago

Do you have the correct pytorch version, i.e., 1.0.0, since it says ``[torch.cuda.FloatTensor [3, 32, 3, 3]] is at version 2; expected version 1 instead''?

hankhaohao commented 3 years ago

Thank you! When I use the version of pytorch is 1.0.0, I can run the train.py successfully.

But, I also want to know. When I get the trained model by train.py , how do I test the test set.Thanks.

linjx-ustc1106 commented 3 years ago

The trained models are saved at fold "/Checkpoints/current_I2I/". Since we tackle I2I with two unpaired images, we do not provide the testing code.

hankhaohao commented 3 years ago

So,when I want to use the trained model by train.py to test the test set, I need to write the test code myself, right?

hankhaohao commented 3 years ago

@linjx-ustc1106 Hi,Is the meaning of the sentence that I say above correct? please

hankhaohao commented 3 years ago

@linjx-ustc1106 hi?

hankhaohao commented 3 years ago

@linjx-ustc1106 @erjanmx Please teach me, thanks

Turlan commented 3 years ago

It's a one-to-one mapping, for new image, you need to retrain the model. There is no sense to have test set.

hankhaohao commented 3 years ago

oh,If this is the case, I feel that the applicability of this model is not great

stillstream commented 3 years ago

@xuhaohao86 Now you konw how to test it on your dataset?

hankhaohao commented 3 years ago

@stillstream No,It's a one-to-one mapping, for new image, you need to retrain the model.