-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Edge only inference with cloud training (#101)
[[COM-1567](https://positronixcorp.atlassian.net/browse/COM-1567)] This PR adds an `edge_only_inference` mode which allows the model to escalate to the cloud for future training, while still always returning the edge inference answer for fast results. Tested with 3 binary detectors with 1. `edge_only` enabled -- nothing escalated to cloud 2. `edge_only_inference` enabled -- low confidence IQs escalated to cloud, edge answer returned 3. Neither `edge_only` nor `edge_only_inference` enabled -- low confidence edge IQs escalated to cloud and cloud answer returned. 4. `edge_only` and `edge_only_inference` enabled -- pods do not launch, logs show the config validation error Currently not adding many unit tests as they aren't set up to test `post_image_query`, and we want to get this change out quickly (discussed with Tyler). This is a first step -- in the future we may want to add: 1. A task queueing system, instead of using FastAPI background tasks 2. Rate limiting for IQs sent to the cloud (either add an element of randomness for whether a query is sent to the cloud, or limit escalation to a certain number of queries over a period of time) --------- Co-authored-by: f-wright <[email protected]> Co-authored-by: Auto-format Bot <[email protected]>
- Loading branch information
1 parent
af20f53
commit 3755ba4
Showing
6 changed files
with
74 additions
and
8 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import pytest | ||
|
||
from app.core.configs import DetectorConfig | ||
|
||
|
||
def test_detector_config_both_edge_modes(): | ||
with pytest.raises(ValueError): | ||
DetectorConfig( | ||
detector_id="det_xyz", | ||
local_inference_template="default", | ||
motion_detection_template="default", | ||
edge_only=True, | ||
edge_only_inference=True, | ||
) |