mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-03 06:04:53 +00:00
math/py-faiss: New port: Library for efficient similarity search & clustering of dense vectors
This commit is contained in:
parent
bd61878319
commit
01c541ffec
@ -827,6 +827,7 @@
|
||||
SUBDIR += py-deap
|
||||
SUBDIR += py-ducc0
|
||||
SUBDIR += py-ecos
|
||||
SUBDIR += py-faiss
|
||||
SUBDIR += py-fastcluster
|
||||
SUBDIR += py-fastdtw
|
||||
SUBDIR += py-flax
|
||||
|
42
math/py-faiss/Makefile
Normal file
42
math/py-faiss/Makefile
Normal file
@ -0,0 +1,42 @@
|
||||
PORTNAME= faiss
|
||||
DISTVERSIONPREFIX= v
|
||||
DISTVERSION= 1.7.2
|
||||
CATEGORIES= math
|
||||
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
|
||||
|
||||
MAINTAINER= yuri@FreeBSD.org
|
||||
COMMENT= Library for efficient similarity search & clustering of dense vectors
|
||||
|
||||
LICENSE= MIT
|
||||
LICENSE_FILE= ${WRKSRC}/../../LICENSE
|
||||
|
||||
PY_DEPENDS= ${PYNUMPY}
|
||||
BUILD_DEPENDS= swig:devel/swig \
|
||||
${PY_DEPENDS}
|
||||
LIB_DEPENDS= libfaiss.so:math/faiss
|
||||
RUN_DEPENDS= ${PY_DEPENDS}
|
||||
|
||||
USES= cmake compiler:c++11-lang localbase python
|
||||
|
||||
USE_GITHUB= yes
|
||||
GH_ACCOUNT= facebookresearch
|
||||
|
||||
WRKSRC_SUBDIR= faiss/python
|
||||
|
||||
PLIST_FILES= \
|
||||
${PYTHON_SITELIBDIR}/${PORTNAME}/_swigfaiss.so \
|
||||
${PYTHON_SITELIBDIR}/${PORTNAME}/__init__.py \
|
||||
${PYTHON_SITELIBDIR}/${PORTNAME}/loader.py \
|
||||
${PYTHON_SITELIBDIR}/${PORTNAME}/swigfaiss.py
|
||||
|
||||
do-install: # see https://github.com/facebookresearch/faiss/issues/2194
|
||||
${MKDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}/${PORTNAME}
|
||||
${INSTALL_LIB} ${BUILD_WRKSRC}/_swigfaiss.so ${STAGEDIR}${PYTHON_SITELIBDIR}/${PORTNAME}
|
||||
.for f in __init__.py loader.py swigfaiss.py
|
||||
${INSTALL_DATA} ${BUILD_WRKSRC}/${f} ${STAGEDIR}${PYTHON_SITELIBDIR}/${PORTNAME}
|
||||
.endfor
|
||||
|
||||
do-test: install
|
||||
@${PYTHON_CMD} ${FILESDIR}/test.py
|
||||
|
||||
.include <bsd.port.mk>
|
3
math/py-faiss/distinfo
Normal file
3
math/py-faiss/distinfo
Normal file
@ -0,0 +1,3 @@
|
||||
TIMESTAMP = 1642235176
|
||||
SHA256 (facebookresearch-faiss-v1.7.2_GH0.tar.gz) = d49b4afd6a7a5b64f260a236ee9b2efb760edb08c33d5ea5610c2f078a5995ec
|
||||
SIZE (facebookresearch-faiss-v1.7.2_GH0.tar.gz) = 740431
|
16
math/py-faiss/files/test.py
Normal file
16
math/py-faiss/files/test.py
Normal file
@ -0,0 +1,16 @@
|
||||
import numpy as np
|
||||
d = 64 # dimension
|
||||
nb = 100000 # database size
|
||||
nq = 10000 # nb of queries
|
||||
np.random.seed(1234) # make reproducible
|
||||
xb = np.random.random((nb, d)).astype('float32')
|
||||
xb[:, 0] += np.arange(nb) / 1000.
|
||||
xq = np.random.random((nq, d)).astype('float32')
|
||||
xq[:, 0] += np.arange(nq) / 1000.
|
||||
|
||||
|
||||
import faiss # make faiss available
|
||||
index = faiss.IndexFlatL2(d) # build the index
|
||||
print(index.is_trained)
|
||||
index.add(xb) # add vectors to the index
|
||||
print(index.ntotal)
|
8
math/py-faiss/pkg-descr
Normal file
8
math/py-faiss/pkg-descr
Normal file
@ -0,0 +1,8 @@
|
||||
Python binding for Faiss.
|
||||
|
||||
Faiss is a library for efficient similarity search and clustering of dense
|
||||
vectors. It contains algorithms that search in sets of vectors of any size,
|
||||
up to ones that possibly do not fit in RAM. It also contains supporting code
|
||||
for evaluation and parameter tuning.
|
||||
|
||||
WWW: https://github.com/facebookresearch/faiss
|
Loading…
Reference in New Issue
Block a user