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

Codes for Figure 3 & 4 and "token_embed_c100.npy" #20

Open
wangpuyi opened this issue Jul 30, 2024 · 7 comments
Open

Codes for Figure 3 & 4 and "token_embed_c100.npy" #20

wangpuyi opened this issue Jul 30, 2024 · 7 comments

Comments

@wangpuyi
Copy link

I wanted to express my admiration for your impressive work! The insights and techniques demonstrated are truly noteworthy.

Additionally, could you kindly share the source code for Figures 3 and 4? Thank you for considering my request.

@d12306
Copy link
Collaborator

d12306 commented Jul 31, 2024

hi, @wangpuyi , it is simply by loading the embeddings and using sklearn PCA to do the dimenionality reduction and plot it.

@wangpuyi
Copy link
Author

wangpuyi commented Aug 9, 2024

@d12306
Get it. Thanks for your reply.

@wangpuyi
Copy link
Author

wangpuyi commented Aug 9, 2024

@d12306
By the way, could you please show the code for getting "token_embed_c100.npy"?
It will be much easier for us when using your project and potentially be beneficial of increasing your paper's influence.
Thank you for your attention.

@wangpuyi wangpuyi changed the title Codes for Figure 3 & 4 Codes for Figure 3 & 4 and "token_embed_c100.npy" Aug 9, 2024
@kxwhiowo
Copy link

@d12306
Thank you for your effort and contribution. I also wonder if it's possible for you to share the code for generating "token_embed_c100.npy".

@d12306
Copy link
Collaborator

d12306 commented Aug 14, 2024

Hi @kxwhiowo @wangpuyi , the token embeddings are directly obtained by indexing the tokens that corresponding to the class names in the token embedding table of the CLIP encoder in Stable Diffusion

@d12306
Copy link
Collaborator

d12306 commented Aug 14, 2024

I also tried get the embeddings by taking the CLIP embeddings of the corresponding class. The generated images are less intepretable. So we decided to directly go with the embeddings in the token embedding table.

@wangpuyi
Copy link
Author

@d12306
Thanks for your thoughtful reply.
But how can we index out the token embedding out of all of the embeddings?
Says after padding, the token embeddings of "a real photo of a cat." have a shape of (1, 77, 768) [bs, tokens_num, features]. How to index out the token embedding corresponds to "cat"? Besides, it's very kind of you if the codes will be shared.
Thank you for your consideration.

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