faiss-index
copied
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Readme
Files and versions
Updated 3 years ago
ann-search
Operator: ANN Search: Faiss
author: shiyu
Desription
Search embedding in Faiss, please make sure you have inserted data to Faiss before search.
Code Example
- Insert data into Faiss first
import numpy as np
import towhee
vec = np.random.random((10, 100)).astype('float32')
ids = list(i for i in range(10))
x = towhee.dc['id'](ids) \
.runas_op['id', 'vec'](func=lambda x: vec[x]) \
.to_faiss['id', 'vec'](findex='index.bin')
- Example
Write the pipeline in simplified style:
query = vec[0:2]
towhee.dc(query) \
.ann_search.faiss(findex='index.bin')
Write a same pipeline with explicit inputs/outputs name specifications:
query = vec[0:2]
towhee.dc['vec'](query) \
.ann_search.faiss['vec', 'results'](findex='index.bin') \
.show()

Factory Constructor
Create the operator via the following factory method:
ann-search.faiss(findex)
Parameters:
findex: str or faiss.INDEX
The path to faiss index file or faiss index.
Interface
Parameters:
query: list
Query embeddings in Faiss
Returns: Entity
Return the results in Faiss with key
and score
.
| 2 Commits | ||
---|---|---|---|
|
1.1 KiB
|
3 years ago | |
|
1.3 KiB
|
3 years ago | |
|
87 B
|
3 years ago | |
|
2.0 KiB
|
3 years ago | |
|
22 B
|
3 years ago | |
|
56 KiB
|
3 years ago |