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

When should the model be saved, and how should it be implemented? #283

Open
ZH-UCAS opened this issue Jan 19, 2024 · 0 comments
Open

When should the model be saved, and how should it be implemented? #283

ZH-UCAS opened this issue Jan 19, 2024 · 0 comments

Comments

@ZH-UCAS
Copy link

ZH-UCAS commented Jan 19, 2024

When should the model be saved, and how should it be implemented? I use torch.save(self.unet.state_dict(), f"{self.savepath}unet_checkpoint_{timestamp}epoch{epoch}.pth") and torch.save(self.diffusion.state_dict(), f"{self.savepath}diffusion_checkpoint_{timestamp}epoch{epoch}.pth") to separately store the weights of the unet and diffusion models. I save them after the backward pass and optimizer adjustments. However, when loading the unet, some parameters seem to be missing, and the generated samples after loading do not match the quality during the training phase. As a beginner, please advise on when and how I should save and load the model.

@ZH-UCAS ZH-UCAS changed the title When should the model be saved, and how should it be written? When should the model be saved, and how should it be implemented? Jan 19, 2024
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