This library provides means to compile and distribute FAISS library for iOS.
FAISS is a library β developed by Facebook AI β that enables efficient similarity search. So, given a set of vectors, we can index them using Faiss β then using another vector (the query vector), we search for the most similar vectors within the index.
Latest supported version of FAISS is 1.9.0.
- iOS
- iOS Simulator
- tvOS
- tvOS Simulator
- watchOS
- watchOS Simulator
- macOS
- Git LFS
- Xcode (including multiple
platforms
) - LLVM with Clang
- Homebrew
- g++
- CMake
- node
- python
- perl
- ruby (for Cocoapods)
- carthage
- swift
- OpenMP
Modern machine learning tools focus on the server side or desktop solutions, few of them optimise their code bases for mobile, this repository is a structured way to get the FAISS source code compiled and distributed to iOS developers.
Run ./faiss.sh
and it will create dist/faiss.xcframework
that you can use in your Xcode project.
Once the compilation is done, you'll have XCframework created with the files below
tree dist/faiss.xcframework -P '*.a'
dist/faiss.xcframework
βββ ios-arm64_arm64e
β βββ Headers
β β βββ faiss
β β βββ c_api
β β β βββ impl
β β β βββ utils
β β βββ impl
β β β βββ code_distance
β β βββ invlists
β β βββ utils
β β βββ approx_topk
β β βββ approx_topk_hamming
β β βββ distances_fused
β β βββ hamming_distance
β β βββ transpose
β βββ libfaiss.a
βββ ios-arm64_arm64e_x86_64-simulator
β βββ Headers
β β βββ faiss
β β βββ c_api
β β β βββ impl
β β β βββ utils
β β βββ impl
β β β βββ code_distance
β β βββ invlists
β β βββ utils
β β βββ approx_topk
β β βββ approx_topk_hamming
β β βββ distances_fused
β β βββ hamming_distance
β β βββ transpose
β βββ libfaiss.a
βββ macos-arm64_arm64e_x86_64
β βββ Headers
β β βββ faiss
β β βββ c_api
β β β βββ impl
β β β βββ utils
β β βββ impl
β β β βββ code_distance
β β βββ invlists
β β βββ utils
β β βββ approx_topk
β β βββ approx_topk_hamming
β β βββ distances_fused
β β βββ hamming_distance
β β βββ transpose
β βββ libfaiss.a
βββ tvos-arm64
β βββ Headers
β β βββ faiss
β β βββ c_api
β β β βββ impl
β β β βββ utils
β β βββ impl
β β β βββ code_distance
β β βββ invlists
β β βββ utils
β β βββ approx_topk
β β βββ approx_topk_hamming
β β βββ distances_fused
β β βββ hamming_distance
β β βββ transpose
β βββ libfaiss.a
βββ tvos-x86_64-simulator
β βββ Headers
β β βββ faiss
β β βββ c_api
β β β βββ impl
β β β βββ utils
β β βββ impl
β β β βββ code_distance
β β βββ invlists
β β βββ utils
β β βββ approx_topk
β β βββ approx_topk_hamming
β β βββ distances_fused
β β βββ hamming_distance
β β βββ transpose
β βββ libfaiss.a
βββ watchos-arm64_32_armv7k
β βββ Headers
β β βββ faiss
β β βββ c_api
β β β βββ impl
β β β βββ utils
β β βββ impl
β β β βββ code_distance
β β βββ invlists
β β βββ utils
β β βββ approx_topk
β β βββ approx_topk_hamming
β β βββ distances_fused
β β βββ hamming_distance
β β βββ transpose
β βββ libfaiss.a
βββ watchos-i386-simulator
βββ Headers
β βββ faiss
β βββ c_api
β β βββ impl
β β βββ utils
β βββ impl
β β βββ code_distance
β βββ invlists
β βββ utils
β βββ approx_topk
β βββ approx_topk_hamming
β βββ distances_fused
β βββ hamming_distance
β βββ transpose
βββ libfaiss.a
106 directories, 7 files
A C only version, without C++ dependency is inside `faiss_c.xcframework`
dist/faiss_c.xcframework
βββ Info.plist
βββ ios-arm64_arm64e
β βββ Headers
β β βββ AutoTune_c.h
β β βββ Clustering_c.h
β β βββ IndexBinary_c.h
β β βββ IndexFlat_c.h
β β βββ IndexIVFFlat_c.h
β β βββ IndexIVF_c.h
β β βββ IndexLSH_c.h
β β βββ IndexPreTransform_c.h
β β βββ IndexReplicas_c.h
β β βββ IndexScalarQuantizer_c.h
β β βββ IndexShards_c.h
β β βββ Index_c.h
β β βββ MetaIndexes_c.h
β β βββ VectorTransform_c.h
β β βββ clone_index_c.h
β β βββ error_c.h
β β βββ error_impl.h
β β βββ faiss_c.h
β β βββ impl
β β β βββ AuxIndexStructures_c.h
β β βββ index_factory_c.h
β β βββ index_io_c.h
β β βββ macros_impl.h
β β βββ utils
β β βββ distances_c.h
β βββ libfaiss_c.a
βββ ios-arm64_arm64e_x86_64-simulator
β βββ Headers
β β βββ AutoTune_c.h
β β βββ Clustering_c.h
β β βββ IndexBinary_c.h
β β βββ IndexFlat_c.h
β β βββ IndexIVFFlat_c.h
β β βββ IndexIVF_c.h
β β βββ IndexLSH_c.h
β β βββ IndexPreTransform_c.h
β β βββ IndexReplicas_c.h
β β βββ IndexScalarQuantizer_c.h
β β βββ IndexShards_c.h
β β βββ Index_c.h
β β βββ MetaIndexes_c.h
β β βββ VectorTransform_c.h
β β βββ clone_index_c.h
β β βββ error_c.h
β β βββ error_impl.h
β β βββ faiss_c.h
β β βββ impl
β β β βββ AuxIndexStructures_c.h
β β βββ index_factory_c.h
β β βββ index_io_c.h
β β βββ macros_impl.h
β β βββ utils
β β βββ distances_c.h
β βββ libfaiss_c.a
βββ macos-arm64_arm64e_x86_64
β βββ Headers
β β βββ AutoTune_c.h
β β βββ Clustering_c.h
β β βββ IndexBinary_c.h
β β βββ IndexFlat_c.h
β β βββ IndexIVFFlat_c.h
β β βββ IndexIVF_c.h
β β βββ IndexLSH_c.h
β β βββ IndexPreTransform_c.h
β β βββ IndexReplicas_c.h
β β βββ IndexScalarQuantizer_c.h
β β βββ IndexShards_c.h
β β βββ Index_c.h
β β βββ MetaIndexes_c.h
β β βββ VectorTransform_c.h
β β βββ clone_index_c.h
β β βββ error_c.h
β β βββ error_impl.h
β β βββ faiss_c.h
β β βββ impl
β β β βββ AuxIndexStructures_c.h
β β βββ index_factory_c.h
β β βββ index_io_c.h
β β βββ macros_impl.h
β β βββ utils
β β βββ distances_c.h
β βββ libfaiss_c.a
βββ tvos-arm64
β βββ Headers
β β βββ AutoTune_c.h
β β βββ Clustering_c.h
β β βββ IndexBinary_c.h
β β βββ IndexFlat_c.h
β β βββ IndexIVFFlat_c.h
β β βββ IndexIVF_c.h
β β βββ IndexLSH_c.h
β β βββ IndexPreTransform_c.h
β β βββ IndexReplicas_c.h
β β βββ IndexScalarQuantizer_c.h
β β βββ IndexShards_c.h
β β βββ Index_c.h
β β βββ MetaIndexes_c.h
β β βββ VectorTransform_c.h
β β βββ clone_index_c.h
β β βββ error_c.h
β β βββ error_impl.h
β β βββ faiss_c.h
β β βββ impl
β β β βββ AuxIndexStructures_c.h
β β βββ index_factory_c.h
β β βββ index_io_c.h
β β βββ macros_impl.h
β β βββ utils
β β βββ distances_c.h
β βββ libfaiss_c.a
βββ tvos-x86_64-simulator
β βββ Headers
β β βββ AutoTune_c.h
β β βββ Clustering_c.h
β β βββ IndexBinary_c.h
β β βββ IndexFlat_c.h
β β βββ IndexIVFFlat_c.h
β β βββ IndexIVF_c.h
β β βββ IndexLSH_c.h
β β βββ IndexPreTransform_c.h
β β βββ IndexReplicas_c.h
β β βββ IndexScalarQuantizer_c.h
β β βββ IndexShards_c.h
β β βββ Index_c.h
β β βββ MetaIndexes_c.h
β β βββ VectorTransform_c.h
β β βββ clone_index_c.h
β β βββ error_c.h
β β βββ error_impl.h
β β βββ faiss_c.h
β β βββ impl
β β β βββ AuxIndexStructures_c.h
β β βββ index_factory_c.h
β β βββ index_io_c.h
β β βββ macros_impl.h
β β βββ utils
β β βββ distances_c.h
β βββ libfaiss_c.a
βββ watchos-arm64_32_armv7k
β βββ Headers
β β βββ AutoTune_c.h
β β βββ Clustering_c.h
β β βββ IndexBinary_c.h
β β βββ IndexFlat_c.h
β β βββ IndexIVFFlat_c.h
β β βββ IndexIVF_c.h
β β βββ IndexLSH_c.h
β β βββ IndexPreTransform_c.h
β β βββ IndexReplicas_c.h
β β βββ IndexScalarQuantizer_c.h
β β βββ IndexShards_c.h
β β βββ Index_c.h
β β βββ MetaIndexes_c.h
β β βββ VectorTransform_c.h
β β βββ clone_index_c.h
β β βββ error_c.h
β β βββ error_impl.h
β β βββ faiss_c.h
β β βββ impl
β β β βββ AuxIndexStructures_c.h
β β βββ index_factory_c.h
β β βββ index_io_c.h
β β βββ macros_impl.h
β β βββ utils
β β βββ distances_c.h
β βββ libfaiss_c.a
βββ watchos-i386-simulator
βββ Headers
β βββ AutoTune_c.h
β βββ Clustering_c.h
β βββ IndexBinary_c.h
β βββ IndexFlat_c.h
β βββ IndexIVFFlat_c.h
β βββ IndexIVF_c.h
β βββ IndexLSH_c.h
β βββ IndexPreTransform_c.h
β βββ IndexReplicas_c.h
β βββ IndexScalarQuantizer_c.h
β βββ IndexShards_c.h
β βββ Index_c.h
β βββ MetaIndexes_c.h
β βββ VectorTransform_c.h
β βββ clone_index_c.h
β βββ error_c.h
β βββ error_impl.h
β βββ faiss_c.h
β βββ impl
β β βββ AuxIndexStructures_c.h
β βββ index_factory_c.h
β βββ index_io_c.h
β βββ macros_impl.h
β βββ utils
β βββ distances_c.h
βββ libfaiss_c.a
29 directories, 169 files
This package is available using following package managers.
./Pacakage.swift
points to remote release hosted on this GitHub repository.
Use these instructions to add this GitHub repository.
SPM version points to both libraries FAISS
in C++ and its C version FAISS_C
.
./FAISS.podspec
and ./FAISS_C.podspec
include all the specific details about the build.
In your Podfile
you can add this library using this syntax:
pod 'FAISS', :git => 'https://github.com/DeveloperMindset-com/faiss-mobile.git', :tag => 'v1.9.0'
pod 'FAISS_C', :git => 'https://github.com/DeveloperMindset-com/faiss-mobile.git', :tag => 'v1.9.0'
In Cartfile
add following:
binary "https://raw.githubusercontent.com/DeveloperMindset-com/faiss-mobile/master/carthage/faiss-static-xcframework.json" ~> 1.9.0
Slightly different for a C version:
binary "https://raw.githubusercontent.com/DeveloperMindset-com/faiss-mobile/master/carthage/faiss-c-static-xcframework.json" ~> 1.9.0
Release management works using gh.
brew install gh tree
To release a draft:
./faiss.sh release
FAISS-Mac-Objective-C
read more.FAISS-Mac-Objective-C++
read more.FAISS-iOS-Objective-C
read more.
Contributions are welcome, feel free to submit an issue or open a pull request.
Copyright Β© 2023-2024 Eugene Hauptmann
Faiss is MIT-licensed, refer to the LICENSE file in the top level directory.
Copyright Β© Meta Platforms, Inc. See the Terms of Use and Privacy Policy for this project.