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

Training is fine, but i can not load the trained model #43

Open
zhrli opened this issue Jan 15, 2023 · 0 comments
Open

Training is fine, but i can not load the trained model #43

zhrli opened this issue Jan 15, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@zhrli
Copy link

zhrli commented Jan 15, 2023

Describe the bug
As I run this code, errors reported:
import torch
from dgmr import DGMR, Sampler, Generator, Discriminator, LatentConditioningStack, ContextConditioningStack

model = DGMR(
forecast_steps=20, #20
input_channels=1,
output_shape=256,
latent_channels=384,
context_channels=192,
num_samples=3,
)

model.sampler = Sampler.from_pretrained("openclimatefix/dgmr-sampler")
model.sampler.forecast_steps = 20
model.sampler.output_shape = 256
model.discriminator = Discriminator.from_pretrained("openclimatefix/dgmr-discriminator")
model.latent_stack = LatentConditioningStack.from_pretrained("openclimatefix/dgmr-latent-conditioning-stack")
model.context_stack = ContextConditioningStack.from_pretrained("openclimatefix/dgmr-context-conditioning-stack")
model.generator = Generator(conditioning_stack=model.context_stack, latent_stack=model.latent_stack, sampler=model.sampler)
model=DGMR.load_from_checkpoint(checkpoint_path='best-v3.ckpt', strict=False)
print(model.config)

To Reproduce
Steps to reproduce the behavior:
RuntimeError: Error(s) in loading state_dict for DGMR:
size mismatch for latent_stack.l_block1.conv_1x1.weight: copying a param with shape torch.Size([16, 8, 1, 1]) from checkpoint, the shape in current model is torch.Size([4, 8, 1, 1]).
...
...
...
Process finished with exit code 1

Expected behavior
Training is fine . but I don't know why i can not load the trained model.

Additional context
Add any other context about the problem here.

@zhrli zhrli added the bug Something isn't working label Jan 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant