-
Notifications
You must be signed in to change notification settings - Fork 46
query not returning any result hugging face #244
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
Comments
@justin-cechmanek this might be a small regression in our docs (though I am suspicious since we test those with our CI). Can you look into this today? |
Looks like a similar issue #219 . I have converted the storage_type to json then it works, byte it doesn't work. |
@mickyarun thanks for bringing this up. Can you tell me the hugging face model you're using, as well as the full json schema and code example that is working for you? |
@justin-cechmanek All models working when stored in json format , I am attaching the code which is working in json but samething doesn't work if stored in bytes create a vectorizerchoose your model from the huggingface websitehf = HFTextVectorizer(model="sentence-transformers/all-mpnet-base-v2") embed a sentencetest = hf.embed("This is a test sentence.") You can also create many embeddings at oncesentences = [ from redisvl.index import SearchIndex construct a search index from the schemaindex = SearchIndex.from_yaml("./schema.yaml") connect to local redis instanceindex.connect("redis://localhost:6379") create the index (no data yet)index.create(overwrite=True) index.load(data) use the HuggingFace vectorizer again to create a query embeddingquery_embedding = hf.embed("That is a happy cat") query = VectorQuery( results = index.query(query) index: fields: Same code if you change from json to bytes it will not return any result |
In testing your script we can get results for both hash and json index types, which require byte or floating point vector encodings, respectively. You may be running into issues with your two indices overlapping if you use the same
|
I have used notebook from example vectorizers_04.ipynb
Step 1:
Use Hugging face to embedd data using the following code snippet
sentences = [ "That is a happy dog", "That is a happy person", "Today is a sunny day" ] embeddings = hf.embed_many(sentences, as_buffer=True, dtype="float32")
Step 2:
schema.yml changed length of encoding to 3072
Step3:
Loaded data
`from redisvl.index import SearchIndex
construct a search index from the schema
index = SearchIndex.from_yaml("./schema.yaml")
connect to local redis instance
index.connect("redis://localhost:6379")
create the index (no data yet)
index.create(overwrite=True)`
`data = [{"text": t,
"embedding": v}
for t, v in zip(sentences, embeddings)]
index.load(data)`
Step 4:

when running .query no output, tried with all the approaches, search is not working
The text was updated successfully, but these errors were encountered: