1. HuggingFace vectorizer
HuggingFace vectorizer uses the HuggingFace API to vectorize data. Vectorizing from transformers models is CPU intensive, often requires GPUs, and can be very ineffective without proper optimisations. This is the purpose of this module, which calls your selected transformer model on HuggingFace servers with their inference endpoints API.
Create a docker compose file from Weaviate wizzard : select the Text transformers vectorizer, with a specific transformer model among the list. Then start the docker container.
- (1) Select the “Text” vectorizer type
- (2) Select the “HuggingFace” vectorizer
- (3) Leave it. The API key will be set later, in WPSOLR’s settings.
Download and execute the docker-compose file generated by the wizard (docker-compose up -d):
Let’s setup our model on HuggingFace dashboard:
(Please check the HuggingFace endpoints pricing first)
a) Login: https://huggingface.co/login (signup first if necessary)
b) Select the Inference Endpoints menu
c) Create a protected endpoint
- (1) Select a sentence transformer model among Sentence Similarity models
- (2) Select a hosting
- (3) Select a datacenter
- (4) Select a VM sizing (CPUs, GPUs …)
- (5) Set advanced VM settings, like autoloading
- (6) Use protected, or private if you own a VPC
- (7) Create the endpoint
- (8) Wait a few minutes for your Endpoint creation and initialisation
- (1) Copy your Endpoint URL for later during your WPSOLR index configuration
Retrieve your HuggingFace API keys:
- (2) Copy your HuggingFace API key for later during your WPSOLR index configuration
Now, let’s create our index in WPSOLR:
- (1) Select the text2vec-huggingface vectorizer module
- (2) Copy your HuggingFace API access token described earlier
- (3) Set a name for you index, visible in WPSOLR admin
- (4) Set a name for your Weaviate class (index)
- (5) Set the url of your Weaviate docker container
- (6) Copy your endpoint URL
- (5) Create the index. Done!
Connect to the Weaviate GraphQL console at https://console.semi.technology/console with url https://localhost:8080, to check our new index (class):
2 Select your data
- (1) (2) (3) select the index you just created
- (4) Choose a filter: “Near Text” to perform a vector search (search on concepts), or “Where” to perform a keywords search (classic search that works with words)
- (5) Set a similarity for your “Near Text” search. The closer to “1”, the more precise is the vector search.
3 Index your data