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

[Feature Request][Community] Ability to pass text_embeddings/uncond_embeddings as arguments in pipe call #955

Closed
hadaev8 opened this issue Oct 23, 2022 · 15 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@hadaev8
Copy link
Contributor

hadaev8 commented Oct 23, 2022

Is your feature request related to a problem? Please describe.
Im experimenting with aesthetic gradients and need to overwrite pip call to pass text_embeddings/uncond_embeddings.
Also it might save a bit of time with making a lot of images with same promt.

Describe the solution you'd like
Ability to pass text_embeddings/uncond_embeddings to pipe call.

Describe alternatives you've considered
Idk. Maybe split everything to separate functions and make it less cluttered.

@patrickvonplaten
Copy link
Contributor

Hey @hadaev8,

Do you think we could use a community pipeline for this?
If there is a big use case, it'd also be ok for me to add it to the native stable diffusion pipelines (wdyt @patil-suraj @anton-l @pcuenca ?)

@patrickvonplaten
Copy link
Contributor

Also see: #958 -> in general ok for me this request - curious to hear other opinions though!

@hadaev8
Copy link
Contributor Author

hadaev8 commented Oct 26, 2022

Since aesthetic gradients modify text encoder output it works with every pipe. Didnt tested with new inpainting, but why not.
So i think separate pipe is not a good way.

Also, if it is acceptable in this repo, i would like to contribute example notebook or something showing how it work with all default pipes.

@dblunk88
Copy link
Contributor

@hadaev8
I'd be interested to see that, do you have a colab available?

@patil-suraj
Copy link
Contributor

Hey @hadaev8 ! Could you point us to an example of aesthetic gradients ? Hearing it for the first time :)

If it's a really big use case I would also be in favor of it. For now I see two things which could benifit from this

  • imagic Add imagic to community pipelines #958 -> I'm not sure if we can modify the pipeline for this, as the trained checkpoints are not really re-usable and are specific to the prompt and image being edited.
  • and stable diffusion videos where we interpolate text embeddings -> but this requires lots of additional stuff and already has a repo and custom pipeline

so unless we have a really big use case, I would like to keep the pipelines simple :)

@dblunk88
Copy link
Contributor

Hey @hadaev8 ! Could you point us to an example of aesthetic gradients ? Hearing it for the first time :)

If it's a really big use case I would also be in favor of it. For now I see two things which could benifit from this

  • imagic Add imagic to community pipelines #958 -> I'm not sure if we can modify the pipeline for this, as the trained checkpoints are not really re-usable and are specific to the prompt and image being edited.
  • and stable diffusion videos where we interpolate text embeddings -> but this requires lots of additional stuff and already has a repo and custom pipeline

so unless we have a really big use case, I would like to keep the pipelines simple :)

I've seen the results of it, definitely worth taking a look. The end results are amazing

@hadaev8
Copy link
Contributor Author

hadaev8 commented Oct 26, 2022

@patil-suraj
This repo
https://github.com/vicgalle/stable-diffusion-aesthetic-gradients

Basically it change weights of text encoder to match clip image representations.

Almost all possible to do outside of pipe, but because of such tuning catastrophic forgetting kicks in, so i think (and author do it too) its better to pass unchanged uncond embeddings from original text model.

In my notebooks i just copypasted whole pipe function for very minor change.
Ofc its my problem, but flexibility is always good.

@hadaev8
Copy link
Contributor Author

hadaev8 commented Oct 26, 2022

@dblunk88
https://colab.research.google.com/drive/1RXolb8ozC4qSCZfnfO-PdVSC25Aj1dTZ?usp=sharing
Have fun

@patil-suraj
Copy link
Contributor

Awesome, thanks @hadaev8 !

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@github-actions github-actions bot added the stale Issues that haven't received updates label Nov 23, 2022
@hadaev8
Copy link
Contributor Author

hadaev8 commented Nov 25, 2022

This still would be nice to have

@patrickvonplaten
Copy link
Contributor

Actually fine for to add this ! Would someone be interested in opening a PR for this? I won't find time anytime soon, but I'll keep this issue on my radar in case more people ask for it

@patrickvonplaten patrickvonplaten changed the title Ability to pass text_embeddings/uncond_embeddings as arguments in pipe call [Feature Request][Community] Ability to pass text_embeddings/uncond_embeddings as arguments in pipe call Nov 30, 2022
@patrickvonplaten patrickvonplaten added good first issue Good for newcomers and removed stale Issues that haven't received updates labels Nov 30, 2022
@hadaev8
Copy link
Contributor Author

hadaev8 commented Dec 22, 2022

@patrickvonplaten
I want to do it. How do you think should I use prompt and negative prompt variables and put checks if it already tensors? Like image arg already does.

@patrickvonplaten
Copy link
Contributor

Hey @hadaev8,

I think we should just add new variables just like we've done for UnCLIP here: #1858

Happy to help with a PR :-)

@patrickvonplaten
Copy link
Contributor

Mostly solved by #2071

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

6 participants