scann-core-torch
The native backend of scann-core's
scann.torch: C++ PyTorch ops (torch.ops.scann.search,
torch.ops.scann.search_batched) that search a ScaNN index held in a
module's buffers.
pip install scann-core-torch # installs the matching scann-core, and torch>=2.10
With it installed, scann.torch.Searcher keeps the index in its buffers
and searches with these ops, with the same API and results as without it.
What it adds:
torch.exportand AOTInductor programs of a model that searches carry the index and run in other processes;state_dict()contains the index (andload_state_dict()restores it);- a model holding a
Searchercan be pickled (torch.save(model)).
import torch
import scann.torch as scann_torch
searcher = scann_torch.builder(embeddings, 10, "dot_product").score_ah(2).reorder(100).build()
assert scann_torch.backend() == "native"
ep = torch.export.export(model_that_searches, (features,))
torch.export.save(ep, "retriever.pt2") # the index is inside
The ops are built against LibTorch's stable ABI only, so the one wheel per
architecture (py3-none-manylinux_2_34_x86_64 / _aarch64) works with
any torch >= 2.10 (CPU, CUDA and ROCm builds) and any Python >= 3.10.
Searches run on the CPU; queries on a GPU are copied to host memory and
the results back.
Documentation: docs/integrations.md. Derived from Google's ScaNN; not an official Google product. Apache-2.0.
Metadata
Release files for scann-core-torch 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| scann_core_torch-0.2.1-py3-none-manylinux_2_34_x86_64.whl | Python 3 | none | Linux glibc 2.34+ x86-64 | Details |
| scann_core_torch-0.2.1-py3-none-manylinux_2_34_aarch64.whl | Python 3 | none | Linux glibc 2.34+ ARM64 | Details |
Total release size: 12.4 MB
Release files / scann_core_torch-0.2.1-py3-none-manylinux_2_34_x86_64.whl
| Download URL | scann_core_torch-0.2.1-py3-none-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 7.1 MB |
| Tags | Linux glibc 2.34+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
d001100c541bdc6c0ec5bdffdc4e0b8cf5bf62f6e0aadea304ff582819d3fcf5
|
|
BLAKE2b-256 checksum How to use checksums |
d473d238bb05c67bdf85e81ad34516a75bb3b64ff10d305cff8bde1ccf83bbe8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / scann_core_torch-0.2.1-py3-none-manylinux_2_34_aarch64.whl
| Download URL | scann_core_torch-0.2.1-py3-none-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 5.3 MB |
| Tags | Linux glibc 2.34+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
4ac1a67cce2019f797c6ceccc294c672f59fe2094d7ef2d732a36e2c45f76b11
|
|
BLAKE2b-256 checksum How to use checksums |
e9f280fdce4c3967c13ca1602d7f5c22a9022f559d3f88948c6613e73b8a6eac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|