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

Swagan support for sample generation, latent space projection, closed form factorization #339

Open
JadAssaf opened this issue Jan 9, 2023 · 0 comments

Comments

@JadAssaf
Copy link

JadAssaf commented Jan 9, 2023

If you've trained your model using swagan, you might face issues with model weights incompatibilities:

RuntimeError: Error(s) in loading state_dict for Generator:
size mismatch for to_rgb1.bias: copying a param with shape torch.Size([1, 12, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 3, 1, 1]).
size mismatch for to_rgb1.conv.weight: copying a param with shape torch.Size([1, 12, 512, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 3, 512, 1, 1]).
size mismatch for to_rgbs.0.bias: copying a param with shape torch.Size([1, 12, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 3, 1, 1]).
size mismatch for to_rgbs.0.conv.weight: copying a param with shape torch.Size([1, 12, 512, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 3, 512, 1, 1]).
size mismatch for to_rgbs.1.bias: copying a param with shape torch.Size([1, 12, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 3, 1, 1]).
size mismatch for to_rgbs.1.conv.weight: copying a param with shape torch.Size([1, 12, 512, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 3, 512, 1, 1]).
size mismatch for to_rgbs.2.bias: copying a param with shape torch.Size([1, 12, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 3, 1, 1]).
size mismatch for to_rgbs.2.conv.weight: copying a param with shape torch.Size([1, 12, 512, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 3, 512, 1, 1]).
size mismatch for to_rgbs.3.bias: copying a param with shape torch.Size([1, 12, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 3, 1, 1]).
size mismatch for to_rgbs.3.conv.weight: copying a param with shape torch.Size([1, 12, 512, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 3, 512, 1, 1]).
size mismatch for to_rgbs.4.bias: copying a param with shape torch.Size([1, 12, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 3, 1, 1]).
size mismatch for to_rgbs.4.conv.weight: copying a param with shape torch.Size([1, 12, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 3, 256, 1, 1]).

To fix this, in generator.py, change "from model import Generator" to "from swagan import Generator".
Same applies for other scripts.

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

1 participant