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

Add text embeddings #46

Merged
merged 9 commits into from
Mar 20, 2024
Merged

Add text embeddings #46

merged 9 commits into from
Mar 20, 2024

Conversation

eloy-encord
Copy link
Contributor

Now text embeddings generation is supported on every available model.
It's a working v1, as the text template for building the class sentences is currently hardcoded in the dataset class.

Also, I eliminated the SiglipModel class as it is a Hugging Face model, so the code was a 99% duplicate. For supporting the required tokenizer for the text embeddings in all HF models, I used AutoModel, AutoTokenizer and AutoProcessor in the ClosedCLIPModel class, so we don't have to explicitly state the tokenizer that correspond to each model type (as the repo contains several model variations already).

Went ahead with some standardisation of tensor shapes in the output of methods that appear in the model classes and when to convert the tensors from GPU to CPU, and vice versa.

Also, added a basic and fixed version of text queries in datasets. We need to enable a way to modify text queries in specific datasets.
For some reason, `open-clip-torch` package loads models with legacy titles, but the tokenizer doesn't, so we have to update the model title to work with the addition of text queries.
@eloy-encord eloy-encord merged commit d554ece into main Mar 20, 2024
1 check passed
@eloy-encord eloy-encord deleted the eloy/add-text-embeddings branch March 20, 2024 15:24
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

Successfully merging this pull request may close these issues.

2 participants