Skip to content

Instantly share code, notes, and snippets.

@davidmezzetti
Created November 28, 2025 20:50
Show Gist options
  • Select an option

  • Save davidmezzetti/ca31dff155d2450ea1b51634a814d37f to your computer and use it in GitHub Desktop.

Select an option

Save davidmezzetti/ca31dff155d2450ea1b51634a814d37f to your computer and use it in GitHub Desktop.
import numpy as np
from txtai.ann import ANNFactory
# Index 10M vectors using llama.cpp style quants
ann = None
for _ in range(1000):
# Generate batch of vectors
batch = np.random.rand(10000, 768).astype(np.float32)
if not ann:
ann = ANNFactory.create({
"backend": "ggml",
"ggml": {
"quantize": "MXFP4"
}
})
ann.index(batch)
else:
ann.append(batch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment