Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error training with pretrained models. #15

Open
Abul22 opened this issue Apr 4, 2019 · 4 comments
Open

Error training with pretrained models. #15

Abul22 opened this issue Apr 4, 2019 · 4 comments

Comments

@Abul22
Copy link

Abul22 commented Apr 4, 2019

After running
./scripts/train_StackGAN.sh ft37_1

RuntimeError: The size of tensor a (26) must match the size of tensor b (64) at non-singleton dimension 0

... I hackily fixed that changing train.staqckGAN.sh
FINESIZE=64
LOADSIZE=64
to
FINESIZE=26
LOADSIZE=26

...
Then the next error was it couldn't find the files in /A/train/ and /b/train/
(it was looking for .ft6_14.png when they were all named ft6_14.png etc (without the ' . ' prepended.
So I uploaded them because I couldn't find how that path was being set.

Now I get a similar error to the start..

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

I've given up trying to do this. As it's taken my whole day with no results :(

Here's where I've stopped
https://colab.research.google.com/gist/Abul22/cf9a67e393118a1c30add68c38ac65c9/untitled0.ipynb

If anyone else more capable than I could make a working colab (or help me find where I've gone wrong) -- That would be so amazingly great.

Cheers

@wxqTS
Copy link

wxqTS commented Jul 7, 2019

I have faced with same problem. Firstly you shouldn't change the FINESIZE=64 and LOADSIZE=64.
It maybe caused by the torchvision, I just changed
t_normal_stack = transforms.Compose([ transforms.Normalize(mean,std), ]) to t_normal_stack = transforms.Compose([
transforms.Normalize((0.5,), (0.5,)),
])
in data_loader.py line#36 and solved the problem.

Hope it will help you!

Abul22 added a commit to Abul22/MC-GAN that referenced this issue Jul 10, 2019
from comment :
azadis#15

 t_normal_stack = transforms.Compose([
transforms.Normalize((0.5,), (0.5,)),
])
@Abul22
Copy link
Author

Abul22 commented Jul 11, 2019

Thanks so much for the info and reply.... I tried that and it worked!...but then after a few more hours hammering at it... I'm in too deep again..

Seemingly when self.fake_B0_init.detach() changes..because it loops over a fwe times okay..

weights * self.fake_B0_init.detach()

Traceback (most recent call last): File "train_Stack.py", line 52, in <module> model.optimize_parameters_Stacked(epoch) File "/content/FontTransfer/MC-GAN/models/StackGAN_model.py", line 564, in optimize_parameters_Stacked self.backward_G(fake_B0_grad, iter) File "/content/FontTransfer/MC-GAN/models/StackGAN_model.py", line 421, in backward_G print(weights * self.fake_B0_init.detach()) RuntimeError: The size of tensor a (2) must match the size of tensor b (7) at non-singleton dimension 0

Did you get it running on a colab? Or your own machine...Perhaps that the issue... I had to change some deviceid=gpu[0] etc areas ..but yeh....

Any other insights? Thanks so much for your earlier reply :)

https://github.com/Abul22/MC-GAN

https://colab.research.google.com/drive/19eGY_1J_zwCeRVD_AdfgPvA7UHSmrc-b

@wxqTS
Copy link

wxqTS commented Jul 18, 2019

I didn't meet this problem, perhaps it still the the torchvision problem。。。

@RamNewton
Copy link

@Abul22 It's been over a year since this issue popped up. But anyway..

About this issue that you faced

(it was looking for .ft6_14.png when they were all named ft6_14.png etc (without the ' . ' prepended.
So I uploaded them because I couldn't find how that path was being set.

The problem here is that all the folders in the public_web_fonts folder have hidden files in them for some reason. So, for all the .png files, there is a corresponding hidden file too. os.walk ends up listing these files too.
You have to either manually remove these hidden files or write a hackety solution to avoid reading files that have a '.' prefix in their names

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants