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

fix prior saving / add load method #44

Closed
rom1504 opened this issue May 1, 2022 · 3 comments
Closed

fix prior saving / add load method #44

rom1504 opened this issue May 1, 2022 · 3 comments

Comments

@rom1504
Copy link
Collaborator

rom1504 commented May 1, 2022

No description provided.

@TheoCoombes
Copy link

The following code worked to load the Prior from Huggingface, just using the stock default hparams:

from dalle2_pytorch import DiffusionPrior, DiffusionPriorNetwork
import torch

device = "cuda:0"
state_dict = torch.load("model.pth")

prior_network = DiffusionPriorNetwork( 
    dim=768,
    depth=6, 
    dim_head=64, 
    heads=8
).to(device)

diffusion_prior = DiffusionPrior( 
    net=prior_network,
    clip=None, 
    image_embed_dim=768, 
    timesteps=100,
    cond_drop_prob=0.2, 
    loss_type="l2", 
    condition_on_text_encodings=False
).to(device)

diffusion_prior.load_state_dict(state_dict)

@lucidrains
Copy link
Owner

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