CoCa: Condition captioning loss on the CLIP similarity #469
+21
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an attempt at a step in the direction of models determining which samples are relevant for themselves. We can use the CLIP similarities to re-weigh the loss of the captioner. It's kind of like finer filtering.
Some notes:
prior(gs) = 1.0
evidence(gs) = clip similarity over local batch
posterior = ???
currently I just do posterior = evidence but this isn't smart, there is some clever way I just need to think about it more. It's not great during the beginning of training when your CLIP model still sucks because then evidence is just 1/bs always so you effectively just divide your learning rate by batch size. There's some clever thing to do here like the closer you are to the beginning distribution the less you pay attention to CLIP and the more the distribution becomes interesting the more you pay attention to it. Or you can just put it on a schedule like the learning rate.
Wandb: https://wandb.ai/iejmac/open-clip/reports/CLIP-conditioned-caption-loss--VmlldzozODExMzUy