azadis / MC-GAN

Multi-Content GAN for Few-Shot Font Style Transfer at CVPR 2018
http://bair.berkeley.edu/blog/2018/03/13/mcgan/
Other
446 stars 126 forks source link

RuntimeError: The size of tensor a (3) must match the size of tensor b (7) at non-singleton dimension 0 #2

Closed LiberiFatali closed 6 years ago

LiberiFatali commented 6 years ago

I get this error when running ./scripts/train_StackGAN.sh ${DATA}

model [StackGANModel] was created
create web directory ./checkpoints/BRAVE_MCGAN_train/web...
saving the model at the end of epoch 0, iters 0
Traceback (most recent call last):
  File "train_Stack.py", line 49, in <module>
    model.optimize_parameters_Stacked(epoch)
  File "/home/abc/FontTransfer/MC-GAN/models/StackGAN_model.py", line 538, in optimize_parameters_Stacked
    self.backward_G(fake_B0_grad, iter)
  File "/home/abc/FontTransfer/MC-GAN/models/StackGAN_model.py", line 408, in backward_G
    self.loss_G_L1 = self.criterionL1(weights * self.fake_B0, weights * self.fake_B0_init.detach()) * self.opt.lambda_C
RuntimeError: The size of tensor a (3) must match the size of tensor b (7) at non-singleton dimension 0

Which version of pytorch and torchvision that this repo based on? My torch is 0.3.1 and torchvision 0.2.0

azadis commented 6 years ago

How many image shots do you have in your "${DATASET}/A/train" path? and what is your batchsize? Batchsize should be >= number of observed images. https://github.com/azadis/MC-GAN/blob/master/scripts/train_StackGAN.sh#L37

azadis commented 6 years ago

My torchvision version is 0.1.9 and torch is 0.2.0_4 if needed!

LiberiFatali commented 6 years ago

This error caused by ._ and .DS_Store files. I remove those files and it starts training now. Thanks!