Skip to content

Errors in Learning-based Method #2

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

Closed
zijinY opened this issue Apr 2, 2024 · 3 comments
Closed

Errors in Learning-based Method #2

zijinY opened this issue Apr 2, 2024 · 3 comments

Comments

@zijinY
Copy link
Contributor

zijinY commented Apr 2, 2024

Thanks for your excellent work! But when I run the Learning-based Method, I met following errors:

[2024-04-02 16:40:02,359][__main__][INFO] - Starting optimization...
Optimizing:   0%|                                                                                                                                                                                              | 0/1000 [02:46<?, ?it/s]
Error executing job with overrides: ['device=cuda:0', 'model=sd15', 'prompts=people/age']
Traceback (most recent call last):
  File "/home/yinzijin/attribute-control/learn_delta.py", line 81, in main
    eps_p = model.predict_eps(prompts_embedded['prompt_positive'], x_t, t_relative).unsqueeze(0)
  File "/home/yinzijin/attribute-control/attribute_control/model/model.py", line 223, in predict_eps
    return self._get_eps_pred(t, start_sample, self.pipe.unet(start_sample, t, encoder_hidden_states=self._get_pipe_kwargs(embs, embs_neg=None, start_sample=None)['prompt_embeds']).sample)
  File "/home/yinzijin/attribute-control/attribute_control/model/model.py", line 164, in _get_eps_pred
    return (sample - beta_prod_t ** (0.5) * model_output) / alpha_prod_t ** (0.5)
RuntimeError: The size of tensor a (2) must match the size of tensor b (64) at non-singleton dimension 3

I have tried sdxl and sd15, but the error remains. My environment is:

torch                     2.2.0+cu121
torchvision               0.17.0+cu121
diffusers                 0.27.2
accelerate                0.28.0

Do you have any ideas on how to fix this ?

@stefan-baumann
Copy link
Member

Hey, sorry for that and thanks for the feedback! This is probably related to some diffusers API changes between 0.26 and 0.27 that I tried to account for but apparently didn't do completely correctly. I will look into this asap.

@zijinY
Copy link
Contributor Author

zijinY commented Apr 2, 2024

Appriciate your quick response, older diffusers version seems not helpful.

@stefan-baumann
Copy link
Member

Fixed this now, took me longer than expected to get around to looking into it. I validated the fix for both learning methods and both notebooks on diffusers==0.27.0 and diffusers==0.27.2 (latest, like you used) on an Nvidia A100 and it works for me. Could you please verify that it also works for you now?

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

2 participants