Projetos
Ver no GitHub
wilsonzlin/CoreNN
Sobre
Embeddable library or single binary for indexing and searching 1B vectors
Ferramentas de desenvolvimentoCrescimento medido de estrelas
- em 24 h
- 0
- em 7 dias
- 0
- em 15 dias
- 0
- em 1 mês
- Coletando histórico
Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.
README.md
OriginalCoreNN
Database for querying billions of vectors and embeddings in sublinear time on commodity machines.
Read the accompanying blog post for details and an accessible deep dive and in-depth technical report.
Getting started
Rust
fn main() {
let db = CoreNN::create("/path/to/db", Cfg {
// Specify the dimensionality of your vectors.
dim: 3,
// All other config options are optional.
...Default::default()
});
let key = "my_entry".to_string();
let vec: Vec<f32> = vec![0.3, 0.6, 0.9];
db.insert(&key, &vec);
// For per-vector quantized int8: `db.insert_qi8(&key, &qvec_i8, scale, zero_point)`.
// Later...
let db = CoreNN::open("/path/to/db");
let query: Vec<f32> = vec![1.0, 1.3, 1.7];
// Returns Vec of (key, distance) pairs.
let k100 = db.query(&query, 100);
assert_eq!(k100[0].0.as_str(), "my_entry");
}
Python
from corenn_py import CoreNN
db = CoreNN.create("/path/to/db", {
# Specify the dimensionality of your vectors.
"dim": 3,
# All other config options are optional.
})
keys = [
"my_entry_1",
"my_entry_2",
]
vectors = np.array([
[0.3, 0.6, 0.9],
[0.4, 1.1, 0.0],
])
# Or insert_bf16, insert_f16
# Or insert_i8 (per-vector quantized int8 + scale/zero_point arrays)
db.insert_f32(keys, vectors)
# Later...
db = CoreNN.open("/path/to/db")
queries = np.array([
[1.0, 1.3, 1.7],
[7.3, 2.5, 0.0],
])
# Returns a list of (key, distance) tuples
# for each query vector
# (so returns a list of lists).
k100 = db.query_f32(queries, 100)
Node.js
import { CoreNN } from "@corenn/node";
const db = CoreNN.create("/path/to/db", {
// Specify the dimensionality of your vectors.
dim: 3,
// All other config options are optional.
});
db.insert([
{
key: "my_entry_1",
vector: new Float32Array([0.5, 4.1, 2.2]),
// Or per-vector quantized int8:
// vector: { data: new Int8Array([..]), scale: 0.01, zeroPoint: 0 },
},
{
key: "my_entry_2",
vector: new Float32Array([3.1, 7.7, 6.4]),
},
]);
// Later...
const db = CoreNN.open("/path/to/db");
// Array of { key, distance } objects.
const results = db.query(
new Float32Array([0.0, 1.1, 2.2]),
100,
);
Explore projetos relacionados
Carregando…