Skip to content

I can't generate meaningful results on CIFAR10 #4

Open
@huanranchen

Description

Hi~
Your work inspire me a lot and I'm really appreciate for such meaningful and excellent work. However I fail to generate meaningful images on cifar10.. Could you help me find out what's wrong in my code?

I think it's might be easy to generate images without classifier's gradient, so I first try to generate images only by the gradient from diffusion model. Here is my code:

            x = torch.randn(1, *img_shape, device=self.device)
            x = x * 0.5 + 0.5
            x.requires_grad = True
            optimizer = torch.optim.Adam([x], lr=2e-2)
            for _ in tqdm(range(iter_each_sample)):  # iterate for 1000 times
                optimizer.zero_grad()
                print(self.partial(x, class_id))  # get the gradient of 
                optimizer.step()
            x.grad = None
            x.requires_grad = False
            x = torch.clamp(x, min=0, max=1)

Here, class_id is None, and self.partial is a function that get the gradient of :
image
I use NCSNpp architecture and model weight from Yang Song's official code.

But finally, images generated by this code is like this:
1680924299798

It's not meaningful... Could you help find what's wrong here?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions