tamarott / SinGAN

Official pytorch implementation of the paper: "SinGAN: Learning a Generative Model from a Single Natural Image"
https://tamarott.github.io/SinGAN.htm
Other
3.31k stars 611 forks source link

No such file or directory: 'TrainedModels/balloons/scale_factor=0.793701,alpha=100/Gs.pth' #178

Open jdc4429 opened 1 year ago

jdc4429 commented 1 year ago

I am having an issue trying to run any of the models. I get the error:

FileNotFoundError: [Errno 2] No such file or directory: 'TrainedModels/balloons/scale_factor=0.793701,alpha=100/Gs.pth'

Where do I get the pth (Gs.pth) files from as they are not there...

I can find no information in your documentation regarding how to get the Gs.pth files that are required if you could please explain if I need to run one of the programs in the Downloads folder or something else.

Regards,

Jeff

jdc4429 commented 1 year ago

Some more information..

(base) jeff@jeff-desktop:~/SinGAN$ ./train cows.png Random Seed: 384 GeneratorConcatSkip2CleanAdd( (head): ConvBlock( (conv): Conv2d(3, 32, kernel_size=(3, 3), stride=(1, 1)) (norm): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (LeakyRelu): LeakyReLU(negative_slope=0.2, inplace=True) ) (body): Sequential( (block1): ConvBlock( (conv): Conv2d(32, 32, kernel_size=(3, 3), stride=(1, 1)) (norm): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (LeakyRelu): LeakyReLU(negative_slope=0.2, inplace=True) ) (block2): ConvBlock( (conv): Conv2d(32, 32, kernel_size=(3, 3), stride=(1, 1)) (norm): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (LeakyRelu): LeakyReLU(negative_slope=0.2, inplace=True) ) (block3): ConvBlock( (conv): Conv2d(32, 32, kernel_size=(3, 3), stride=(1, 1)) (norm): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (LeakyRelu): LeakyReLU(negative_slope=0.2, inplace=True) ) ) (tail): Sequential( (0): Conv2d(32, 3, kernel_size=(3, 3), stride=(1, 1)) (1): Tanh() ) ) WDiscriminator( (head): ConvBlock( (conv): Conv2d(3, 32, kernel_size=(3, 3), stride=(1, 1)) (norm): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (LeakyRelu): LeakyReLU(negative_slope=0.2, inplace=True) ) (body): Sequential( (block1): ConvBlock( (conv): Conv2d(32, 32, kernel_size=(3, 3), stride=(1, 1)) (norm): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (LeakyRelu): LeakyReLU(negative_slope=0.2, inplace=True) ) (block2): ConvBlock( (conv): Conv2d(32, 32, kernel_size=(3, 3), stride=(1, 1)) (norm): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (LeakyRelu): LeakyReLU(negative_slope=0.2, inplace=True) ) (block3): ConvBlock( (conv): Conv2d(32, 32, kernel_size=(3, 3), stride=(1, 1)) (norm): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (LeakyRelu): LeakyReLU(negative_slope=0.2, inplace=True) ) ) (tail): Conv2d(32, 1, kernel_size=(3, 3), stride=(1, 1)) ) /home/jeff/anaconda3/lib/python3.10/site-packages/torch/autograd/init.py:173: UserWarning: Error detected in ConvolutionBackward0. Traceback of forward call that caused the error: File "/home/jeff/SinGAN/main_train.py", line 29, in train(opt, Gs, Zs, reals, NoiseAmp) File "/home/jeff/SinGAN/SinGAN/training.py", line 39, in train z_curr,in_s,G_curr = train_single_scale(D_curr,G_curr,reals,Gs,Zs,in_s,NoiseAmp,opt) File "/home/jeff/SinGAN/SinGAN/training.py", line 155, in train_single_scale fake = netG(noise.detach(),prev) File "/home/jeff/anaconda3/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(*input, kwargs) File "/home/jeff/SinGAN/SinGAN/models.py", line 60, in forward x = self.tail(x) File "/home/jeff/anaconda3/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(*input, *kwargs) File "/home/jeff/anaconda3/lib/python3.10/site-packages/torch/nn/modules/container.py", line 141, in forward input = module(input) File "/home/jeff/anaconda3/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(input, kwargs) File "/home/jeff/anaconda3/lib/python3.10/site-packages/torch/nn/modules/conv.py", line 447, in forward return self._conv_forward(input, self.weight, self.bias) File "/home/jeff/anaconda3/lib/python3.10/site-packages/torch/nn/modules/conv.py", line 443, in _conv_forward return F.conv2d(input, weight, bias, self.stride, (Triggered internally at ../torch/csrc/autograd/python_anomaly_mode.cpp:104.) Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass Traceback (most recent call last): File "/home/jeff/SinGAN/main_train.py", line 29, in train(opt, Gs, Zs, reals, NoiseAmp) File "/home/jeff/SinGAN/SinGAN/training.py", line 39, in train z_curr,in_s,G_curr = train_single_scale(D_curr,G_curr,reals,Gs,Zs,in_s,NoiseAmp,opt) File "/home/jeff/SinGAN/SinGAN/training.py", line 178, in train_single_scale errG.backward(retain_graph=True) File "/home/jeff/anaconda3/lib/python3.10/site-packages/torch/_tensor.py", line 363, in backward torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs) File "/home/jeff/anaconda3/lib/python3.10/site-packages/torch/autograd/init.py", line 173, in backward Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass 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: the backtrace further above shows the operation that failed to compute its gradient. The variable in question was changed in there or anywhere later. Good luck!

jdc4429 commented 1 year ago

When I do the training, it crashes after creating some of the files in the TrainedModels folder