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

Conditional Unet using dataset with one scalar label #29

Open
HangilY opened this issue May 3, 2023 · 4 comments
Open

Conditional Unet using dataset with one scalar label #29

HangilY opened this issue May 3, 2023 · 4 comments

Comments

@HangilY
Copy link

HangilY commented May 3, 2023

Hello,

I am PhD candidate at SNU.

Your repo helped me really good understanding DDPM.

And i want to change this code to train a image labeled by 1 scalar value.

Is there any respository or your comment that i can reference?

thank you very much.

@dome272
Copy link
Owner

dome272 commented May 4, 2023

Hey you. By a scalar you mean a continuous value within a certain range? That's an interesting question. One thing you could try is normalizing your scalar between 0 and 1 and learn an one dimensional embedding which you multiply the scalar with. Maybe even learning 2 embeddings and linearly interpolating between these two. Or you could think of discretizing your scalar and then learning an embedding for each discrete representation.
All of these should be quite easy to implement in the current codebase.
Does that help?

@HangilY
Copy link
Author

HangilY commented May 4, 2023

Thanks!

  1. Yes continuous value within a certain range.
  2. Thank you, actually i was trying to embed a one dimensional tenser with value 'c'. And the got the error "RuntimeError: Expected tensor for argument Big Refactor #1 'indices' to have one of the following scalar types: Long, Int; but got torch.cuda.DoubleTensor instead (while checking arguments for embedding)"
    Maybe the data type is not compatible i guess.
    I am still working on it :D. Thanks.
  3. discretizing is also a good idea and i have tried it on GAN generative model and it was good.

Thank you it helped me :D

@HangilY
Copy link
Author

HangilY commented May 6, 2023

Thanks Dome.

I have change the code and it's doing good so far.

I have to validate data after training but the training process is working now.

These are things that i have changed:

  1. CustomDataset Loader
  2. Image size
  3. Embedding of Label. ( I have made a tensor dimension of t, "t = self.pos_encoding(t, self.time_dim)" and filled with a scalar label value

thanks
image

@awais00012
Copy link

Thanks Dome.

I have change the code and it's doing good so far.

I have to validate data after training but the training process is working now.

These are things that i have changed:

  1. CustomDataset Loader
  2. Image size
  3. Embedding of Label. ( I have made a tensor dimension of t, "t = self.pos_encoding(t, self.time_dim)" and filled with a scalar label value

thanks image

hi bro< could you pleses share it with me how you did this. i am facing this problem
image

although i change the prerequisits but still stuck here it would be initiative if you help out me

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