Add optional flag in the text model config to return embeddings for all tokens in sequence instead of just the EOS embedding. #456
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 a small QOL PR that implements an optional parameter.
Currently, there is no way to have the CLIP text model return the entirety of its
(batch x seq_length x embed_dim)-shaped output tensor, something that's quite useful if you want to use your model as part of, say, a Stable Diffusion training run.I've added an optional parameter,
return_all_embeddings, that can be included in thetext_cfgsection of a model config. It defaults toFalse, so this pull request won't change any default behavior. If it's set toTrue, the model will return the output vectors for all tokens in its input, not just the one for the EOS token.