Recently, we’ve begun exploring Weaviate, and I need clarification on the embeddings generated by the text2vec-transformers module. In my setup, I’ve enabled the text2vec-transformers module by setting “enable” to true and “tag” to sentence-transformers-all-MiniLM-L12-v2. However, after indexing is complete, I noticed differences between the embeddings generated by the transformers module and those from the same HF model used in standalone setup.
Here’s my input sentence:
input = “Combining text and image embeddings allows powerful systems for tasks like image search, classification, and description.”
Embeddings generated in the standalone setup by the HF model,
> [0.020367290824651718, -0.06027209013700485, 0.08994261175394058, 0.021357210353016853, 0.01984591782093048, 0.05606047809123993, -0.02014531008899212, 0.006495875306427479, 0.031136102974414825, 0.024565359577536583, 0.08532216399908066, ... ]
>Embeddings generated by Weaviate,
[0.07658111,-0.24428493,0.36238655,0.08147758,0.10421621,0.28499788,-0.057393536,-0.027201267,0.18786895,0.11688445,0.34956443,-0.113155164,0.34250045,0.14217529,-0.31033084,-0.19569416,0.14555733,0.3528335,-0.07058265,0.032889266,0.115612...]
Weaviate version : 1.23.9
The vector generated by Weaviate differs from the vectors generated in the standalone setup with the same HF model. Could you please advise on what I might be missing here?
Now, you can request a vector, directly to the model, like this
import requests
json_data = {
'text': 'test text combining text and image embeddings allows powerful systems for tasks like image search, classification, and description.',
}
response = requests.post('http://localhost:9000/vectors', json=json_data)
and finally, validate that the vectors are the same:
Ps: in order to get the text that was vectorized, I entered the container, and added a print(item) here:
We had some discussions last week where modules would log in DEBUG level the payload to be vectorized. That “feature” will help this kind of situation.