-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use sqlite-vec extension instead of chromadb for embeddings #14163
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ Deploy Preview for frigate-docs canceled.
|
NickM-27
approved these changes
Oct 7, 2024
9 tasks
working good and seems more snappy :) Embedded 25608 thumbnails and 18740 descriptions in 5481.727172374725 seconds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed change
The initial implementation of semantic search used Chroma for its database. Rather than using a separate database and engine for saving vectors/embeddings, this PR refactors the embeddings manager and semantic search feature to use the
sqlite-vec
extension to sqlite3 to store embeddings directy in Frigate's database.Queries are still made through Peewee's
SqliteQueueDatabase
queue manager class.This reduces resource usage on the host machine and theoretically will make semantic search faster.
sqlite-vec
is a new package still undergoing rapid development. Once it supports metadata filtering and distance sorting (desc), further improvements can be made.This PR also:
SqliteVecQueueDatabase
, which loads thesqlite-vec
extension when semantic search is enableduvicorn
dep (needed for fastapi but was no longer installed after removing Chroma)Type of change
Users running the dev builds will have to set
reindex: True
in their config to regenerate their embeddings and store them in the Frigate database. Additionally, the chroma database folder at/config/chroma
can be manually removed by users as it's no longer used.Checklist
ruff format frigate
)