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

How to use InfoNCE for prototypes with shape [b, num_cls, num_tokens, dim]? #19

Open
zzzyzh opened this issue Sep 12, 2024 · 1 comment

Comments

@zzzyzh
Copy link

zzzyzh commented Sep 12, 2024

Hi, I’m working with a set of prototypes that have the shape [b, num_cls, num_tokens, dim]. My goal is to use InfoNCE loss to maximize inter-class differences.

I have the following questions:

How should I apply InfoNCE to my prototypes in order to increase the distance between different classes?
Should I treat each num_tokens as separate samples for contrastive learning, or is there a better way to structure the loss computation?
Any guidance on how to set up the loss function properly for this scenario would be greatly appreciated!

@zzzyzh
Copy link
Author

zzzyzh commented Sep 12, 2024

Why is the required shape[0] equal to bs (batch size)?

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

1 participant