* Add service manager infrastructure
The changes are (This will be a bit long):
- A ServiceManager class that spawns a background thread and deals with
service lifecycle management. The idea is that service lifecycle code
will run in async functions, so a single thread is enough to manage
any (reasonable) amount of services.
- A Service class, that offers start(), stop() and restart() methods
that simply notify the service manager to... well. Start, stop or
restart a service.
(!) Warning: Note that this differs from mp.Process.start/stop in that
the service commands are sent asynchronously and will complete
"eventually". This is good because it means that business logic is
fast when booting up and shutting down, but we need to make sure
that code does not rely on start() and stop() being instant
(Mainly pid assignments).
Subclasses of the Service class should use the on_start and on_stop
methods to monitor for service events. These will be run by the
service manager thread, so we need to be careful not to block
execution here. Standard async stuff.
(!) Note on service names: Service names should be unique within a
ServiceManager. Make sure that you pass the name you want to
super().__init__(name="...") if you plan to spawn multiple instances
of a service.
- A ServiceProcess class: A Service that wraps a multiprocessing.Process
into a Service. It offers a run() method subclasses can override and
can support in-place restarting using the service manager.
And finally, I lied a bit about this whole thing using a single thread.
I can't find any way to run python multiprocessing in async, so there is
a MultiprocessingWaiter thread that waits for multiprocessing events and
notifies any pending futures. This was uhhh... fun? No, not really.
But it works. Using this part of the code just involves calling the
provided wait method. See the implementation of ServiceProcess for more
details.
Mirror util.Process hooks onto service process
Remove Service.__name attribute
Do not serialize process object on ServiceProcess start.
asd
* Update frigate dictionary
* Convert AudioProcessor to service process
* only save a fixed number of thumbnails if genai is enabled
* disable cpu_mem_arena to save on memory until its actually needed
* fix search settings pane so it actually saves to the config
* Fix access
* Reorganize tracked object for imports
* Separate out rockchip build
* Formatting
* Use original ffmpeg build
* Fix build
* Update default search type value
* backend score filtering and sorting
* score filter frontend
* use input for score filtering
* use correct score on search thumbnail
* add popover to explain top_score
* revert sublabel score calc
* update filters logic
* fix rounding on score
* wait until default view is loaded
* don't turn button to selected style for similarity searches
* clarify language
* fix alert dialog buttons to use correct destructive variant
* use root level top_score for very old events
* better arrangement of thumbnail footer items on smaller screens
* Handle Frigate+ submitted case
* Add search settings and rename general to ui settings
* Add platform aware sheet component
* use two columns on mobile view
* Add cameras page to more filters
* clean up search settings view
* Add time range to side filter
* better match with ui settings
* fix icon size
* use two columns on mobile view
* clean up search settings view
* Add zones and saving logic
* Add all filters to side panel
* better match with ui settings
* fix icon size
* Fix mobile fitler page
* Fix embeddings access
* Cleanup
* Fix scroll
* fix double scrollbars and add separators on mobile too
* two columns on mobile
* italics for emphasis
---------
Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
* Publish model state and embeddings reindex in dispatcher onConnect
* remove unneeded from explore
* add embeddings reindex progress to statusbar
* don't allow right click or show similar button if semantic search is disabled
* fix status bar
* Convert peewee model to dict before formatting for genai description
* add embeddings reindex progress to statusbar
* fix status bar
* Convert peewee model to dict before formatting for genai description
* Publish model state and embeddings reindex in dispatcher onConnect
* remove unneeded from explore
* add embeddings reindex progress to statusbar
* don't allow right click or show similar button if semantic search is disabled
* fix status bar
* Remove device config and use model size to configure device used
* Don't show Frigate+ submission when in progress
* Add docs link for bounding box colors
* Use cosine distance metric for vec tables
* Only apply normalization to multi modal searches
* Catch possible edge case in stddev calc
* Use sigmoid function for normalization for multi modal searches only
* Ensure we get model state on initial page load
* Only save stats for multi modal searches and only use cosine similarity for image -> image search
* Add config option to select fp16 or quantized jina vision model
* requires_fp16 for text and large models only
* fix model type check
* fix cpu
* pass model size
* refactor dispatcher
* add reindex to dictionary
* add circular progress bar component
* Add progress to UI when embeddings are reindexing
* readd comments to dispatcher for clarity
* Only report progress every 10 events so we don't spam the logs and websocket
* clean up
* add generic onnx model class and use jina ai clip models for all embeddings
* fix merge confligt
* add generic onnx model class and use jina ai clip models for all embeddings
* fix merge confligt
* preferred providers
* fix paths
* disable download progress bar
* remove logging of path
* drop and recreate tables on reindex
* use cache paths
* fix model name
* use trust remote code per transformers docs
* ensure tokenizer and feature extractor are correctly loaded
* revert
* manually download and cache feature extractor config
* remove unneeded
* remove old clip and minilm code
* docs update
* :Add support for nvidia driver info
* Don't show temperature if detector isn't called coral
* Add encoder and decoder info for Nvidia GPUs
* Fix device info
* Implement GPU info for nvidia GPU
* Update web/src/views/system/GeneralMetrics.tsx
Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
* Update web/src/views/system/GeneralMetrics.tsx
Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
---------
Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
* swap sqlite_vec for chroma in requirements
* load sqlite_vec in embeddings manager
* remove chroma and revamp Embeddings class for sqlite_vec
* manual minilm onnx inference
* remove chroma in clip model
* migrate api from chroma to sqlite_vec
* migrate event cleanup from chroma to sqlite_vec
* migrate embedding maintainer from chroma to sqlite_vec
* genai description for sqlite_vec
* load sqlite_vec in main thread db
* extend the SqliteQueueDatabase class and use peewee db.execute_sql
* search with Event type for similarity
* fix similarity search
* install and add comment about transformers
* fix normalization
* add id filter
* clean up
* clean up
* fully remove chroma and add transformers env var
* readd uvicorn for fastapi
* readd tokenizer parallelism env var
* remove chroma from docs
* remove chroma from UI
* try removing custom pysqlite3 build
* hard code limit
* optimize queries
* revert explore query
* fix query
* keep building pysqlite3
* single pass fetch and process
* remove unnecessary re-embed
* update deps
* move SqliteVecQueueDatabase to db directory
* make search thumbnail take up full size of results box
* improve typing
* improve model downloading and add status screen
* daemon downloading thread
* catch case when semantic search is disabled
* fix typing
* build sqlite_vec from source
* resolve conflict
* file permissions
* try build deps
* remove sources
* sources
* fix thread start
* include git in build
* reorder embeddings after detectors are started
* build with sqlite amalgamation
* non-platform specific
* use wget instead of curl
* remove unzip -d
* remove sqlite_vec from requirements and load the compiled version
* fix build
* avoid race in db connection
* add scale_factor and bias to description zscore normalization