mirror of
https://github.com/infiniteCable2/openpilot.git
synced 2026-09-04 07:13:41 +08:00
86dfd0d24a1833bbe4e33b11effe82cdca3bfc9c
47 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b32c6dafee |
modeld: add laneline helper for plan indices calculation (#1240)
* modeld: add laneline_helper for plan X indices calculation * spacing * keep type hints * openpilot * sunnypilot/models/helpers add modeld helpers to helpers * Send it from each fill message --------- Co-authored-by: Jason Wen <haibin.wen3@gmail.com> |
||
|
|
ec8f036850 |
Merge branch 'upstream/openpilot/master' into sync-20250908
# Conflicts: # .github/workflows/selfdrive_tests.yaml # README.md # docs/CARS.md # opendbc_repo # panda # selfdrive/car/tests/test_car_interfaces.py # selfdrive/modeld/modeld.py # selfdrive/selfdrived/selfdrived.py # selfdrive/ui/translations/main_ar.ts # selfdrive/ui/translations/main_de.ts # selfdrive/ui/translations/main_es.ts # selfdrive/ui/translations/main_fr.ts # selfdrive/ui/translations/main_ja.ts # selfdrive/ui/translations/main_ko.ts # selfdrive/ui/translations/main_pt-BR.ts # selfdrive/ui/translations/main_th.ts # selfdrive/ui/translations/main_tr.ts # selfdrive/ui/translations/main_zh-CHS.ts # selfdrive/ui/translations/main_zh-CHT.ts # system/hardware/hardwared.py # system/updated/updated.py # tinygrad_repo # uv.lock |
||
|
|
7d4df73ea5 | hotfix: model fetcher warning instead of exception when fetching fail | ||
|
|
29fe152bd3 |
modeld_v2: desire rename and add many parts from thneed modeld (#1197)
* Add model metadata lookup and update desire handling * Bump selector version to 10 * meh * Refactor shape mode parameters for desire handling in test buffer logic * loop more models * Refactor buffer handling for temporal inputs and streamline desire updates * Refactor lateral control input handling and remove unused code |
||
|
|
0593667601 |
bugfix: improve error handling in model fetching process (SUN-87) (#1205)
* bugfix: improve error handling in model fetching process * cleanup * bugfix: refine error handling in model fetching process |
||
|
|
45ee58b1f6 |
ui: Favorite Models ⭐ (#1168)
* init model favorites * fix fav buttons * fix blank favs * switch to ref * new favs at top * remove debug prints & add some comments * button style * fix current selection * !@%#$%(@^%$#(@!%#^ * add last update date to folders |
||
|
|
7c6d887187 |
modeld_v2: infer model shapes from inputs (#1162)
* modeld_v2: dynamify temporal buffer management. * skip redundant reshaping and flattening. * simplify MHP checks for lead and plan * modeld_v2: add unit tests for buffer logic and refactor index mapping * Let’s possibly fail a test :) * Update test_buffer_logic_inspect.py * Update test_buffer_logic_inspect.py * modeld_v2: better temporal mapping for non-split * Bump to 10 I guess * Downgrade CURRENT_SELECTOR_VERSION to 9 * red diff ya know? * add dynamic buffer update tests and compare against legacy logic. Cover modelState.init and modelState.run * send * Revert "send" This reverts commit 9e6c95fbfde134eeba952da6eef012baa0396fa0. * format --------- Co-authored-by: Jason Wen <haibin.wen3@gmail.com> |
||
|
|
798e9071d8 |
Merge branch 'upstream/openpilot/master' into sync-20250823
# Conflicts: # .github/workflows/release.yaml # README.md # RELEASES.md # common/params_keys.h # docs/CARS.md # opendbc_repo # panda # release/build_stripped.sh # selfdrive/controls/lib/longitudinal_planner.py # selfdrive/modeld/modeld.py # selfdrive/ui/feedback/feedbackd.py # selfdrive/ui/translations/main_ar.ts # selfdrive/ui/translations/main_de.ts # selfdrive/ui/translations/main_es.ts # selfdrive/ui/translations/main_fr.ts # selfdrive/ui/translations/main_ja.ts # selfdrive/ui/translations/main_ko.ts # selfdrive/ui/translations/main_pt-BR.ts # selfdrive/ui/translations/main_th.ts # selfdrive/ui/translations/main_tr.ts # selfdrive/ui/translations/main_zh-CHS.ts # selfdrive/ui/translations/main_zh-CHT.ts # system/version.py # uv.lock |
||
|
|
6c4c0c00b4 |
Merge branch 'upstream/openpilot/master' into sync-20250812
# Conflicts: # opendbc_repo # selfdrive/controls/controlsd.py # selfdrive/controls/lib/latcontrol_angle.py # selfdrive/controls/lib/latcontrol_pid.py # selfdrive/controls/lib/latcontrol_torque.py |
||
|
|
68625222b6 |
chore: sync tinygrad (#1151)
* commence the sync! * !cancelled * Thats it folks |
||
|
|
2f60026c22 |
ci: crosscheck tinygrad ref during tests (#1106)
* Add tinygrad ref testing * BaseDir and give a fake ref id to test * one more before the real thing * Add the correct ref * test * Update test_tinygrad_ref.py * Update tinygrad_ref * Update test_tinygrad_ref.py * Update tinygrad_ref * This SHOULD FAIL * Revert "This SHOULD FAIL" This reverts commit 58862f8a730c34c1407386f729067b0c564e910b. * bit of red * Move ref to models so compiled branches can read it * step one * step 2 * Update build-all-tinygrad-models.yaml * Update build-all-tinygrad-models.yaml * Update build-all-tinygrad-models.yaml * Update build-all-tinygrad-models.yaml * Update build-all-tinygrad-models.yaml * Update build-all-tinygrad-models.yaml * Update tinygrad_ref.py * Update build-all-tinygrad-models.yaml * bump to fail test * Revert "bump to fail test" This reverts commit 4f58991f32036ac55564470f1fdaa50492578f15. * pytest should take care of it * lint --------- Co-authored-by: Jason Wen <haibin.wen3@gmail.com> |
||
|
|
567c5459db |
params: fix auto type cast (#1127)
* params: fix auto type cast on put * literally * lint * pls comma why dis a string but actually json |
||
|
|
d6474aa0a9 |
Merge branch 'upstream/openpilot/master' into sync-20250731
# Conflicts: # .github/workflows/selfdrive_tests.yaml # common/params.h # common/params_keys.h # common/params_pyx.pyx # docs/CARS.md # opendbc_repo # panda # selfdrive/car/tests/test_models.py # selfdrive/pandad/pandad.cc # selfdrive/pandad/pandad.h # selfdrive/selfdrived/selfdrived.py # selfdrive/ui/translations/main_ar.ts # selfdrive/ui/translations/main_de.ts # selfdrive/ui/translations/main_es.ts # selfdrive/ui/translations/main_fr.ts # selfdrive/ui/translations/main_ja.ts # selfdrive/ui/translations/main_ko.ts # selfdrive/ui/translations/main_pt-BR.ts # selfdrive/ui/translations/main_th.ts # selfdrive/ui/translations/main_tr.ts # selfdrive/ui/translations/main_zh-CHS.ts # selfdrive/ui/translations/main_zh-CHT.ts # system/athena/athenad.py # system/athena/manage_athenad.py # system/manager/manager.py # system/sentry.py # uv.lock Sync: `commaai/opendbc:master` into `sunnypilot/opendbc:master` Sync: `commaai/panda:master` into `sunnypilot/panda:master` |
||
|
|
40f298f033 |
sunnypilot modeld: Raise Min Selector Version (#1103)
Bump to Min 8 to prevent loading conflicts |
||
|
|
c47aadee19 |
sunnypilot modeld: Sync Tinygrad (#1081)
* Tinygrad bump from sync-20250627
* bump tinygrad_repo
* Reformat metadata generator to match driving_models.json
* bump tinygrad
* Revert "bump tinygrad"
This reverts commit f479dfd5021266e22b34deca06cc3c4d531fb7e8.
* revert me after SP model compiled
* Model recompiled successfully, initiate "revert me after SP model compiled"
This reverts commit 95706eb688c9f5522903bee21892b8871ff8f957.
* The "FillMe" placeholder caused an extra 10 seconds of work
* bump to 22Jul2025
* Update build-all-tinygrad-models.yaml
* Update build-all-tinygrad-models.yaml
* Update build-all-tinygrad-models.yaml
* Update build-all-tinygrad-models.yaml
* Update build-all-tinygrad-models.yaml
* Update build-all-tinygrad-models.yaml
* Update build-all-tinygrad-models.yaml
* Allow more dynamic short names
This should hopefully be future-proof for now.. It's robust enough to return the correct word-digit format (see example on how it generates from given display name below):
'Last Horizon V2 (November 22, 2024)' -> LHV2
'Alabama (November 25, 2024)' -> ALABAMA
'PlayStation (December 03, 2024)' -> PLAYSTAT
'Postal Service (December 09, 2024)' -> PS
'Null Pointer (December 13, 2024)' -> NP
'North America (December 16, 2024)' -> NA
'National Public Radio (December 18, 2024)' -> NPR
'Filet o Fish (March 7, 2025)' -> FOF
'Tomb Raider 2 (April 18, 2025)' -> TR2
'Tomb Raider 3 (April 22, 2025)' -> TR3
'Tomb Raider 4 (April 25, 2025)' -> TR4
'Tomb Raider 5 (April 25, 2025)' -> TR5
'Tomb Raider 6 (April 30, 2025)' -> TR6
'Tomb Raider 7 (May 07, 2025)' -> TR7
'Down to Ride (Revision: May 10, 2025)' -> DTR
'SP Vikander Model (May 16, 2025)' -> SPVM
'VFF Driving (May 15, 2025)' -> VFFD
'Secret Good Openpilot (May 16, 2025)' -> SGO
'Vegetarian Filet o Fish (May 29, 2025)' -> VFOF
'Down To Ride (Revision: May 30, 2025)' -> DTR
'Vegetarian Filet o Fish v2 (June 05, 2025)' -> VFOFV2
'Kerrygold Driving (June 08, 2025)' -> KD
'Tomb Raider 10 (June 16, 2025)' -> TR10
'Organic Kerrygold (June 17, 2025)' -> OK
'Liquid Crystal Driving (June 21, 2025)' -> LCD
'Vegetarian Filet o Fish v3 (June 21, 2025)' -> VFOFV3
'Vibe Model [Custom Model]' -> VMCM
'Tomb Raider 13 (June 27, 2025)' -> TR13
'Aggressive TR (June 28, 2025)' -> ATR
'Tomb Raider 14 (June 30, 2025)' -> TR14
'Cookiemonster Tomb Raider (July 02, 2025)' -> CTR
'Down to Ride (Revision: July 07, 2025)' -> DTR
'Simple Plan Driving (July 07, 2025)' -> SPD
'Down to Ride (Revision: July 08, 2025)' -> DTR
'Tomb Raider 15 (July 09, 2025)' -> TR15
'Tomb Raider 15 rev-2 (July 11, 2025)' -> TR15R2
'Le Tomb Raider 14 (July 14, 2025)' -> LTR14
'Le Tomb Raider 14h (July 17, 2025)' -> LTR14H
'Tomb Raider 16 (July 18, 2025)' -> TR16
'Tomb Raider 16v2 (July 21, 2025)' -> TR16V2
* Update build-all-tinygrad-models.yaml
* Update build-all-tinygrad-models.yaml
* No need to sleep 3 seconds, just send it
* try dynamic
* cleanup
* Update build-single-tinygrad-model.yaml
* bc devtekve said. also, this is repetitive af
* Revert "bc devtekve said. also, this is repetitive af"
This reverts commit 3a0c1562de6eae1d2d213d2f53cfb2edb4eef40c.
* maybe we could use a script instead that both build all
That both build all and sunnypilot-build-model reference
* refactor: consolidate model building steps into a single workflow
* tweak
* tweakx2
* tweakx3
* tweakx4
* dunno dunno...
* output dir
* lots of changes
* Revert "lots of changes"
This reverts commit 4aadb0ee2929fdf9d902335161b22072bef4e068.
* fail if all fail
* no inputs needed
* make it easier for us
* note failure and exit 0
* Update build-all-tinygrad-models.yaml
* not needed unless we really want it
* Update build-single-tinygrad-model.yaml
* Merge branch 'sync-20250627-tinygrad' of github.com:sunnypilot/sunnypilot into sync-20250627-tinygrad
* retry for failed ?
* always run this step because sometimes one build fails
which causes the matrix to fail, but most builds still have uploaded artifacts.
* strip
* no escape
* Update build-all-tinygrad-models.yaml
* Test case from terminal run
(openpilot) james@Mac sunnypilot % jq -c '[.bundles[] | select(.runner=="tinygrad") | {ref, display_name: (.display_name | gsub(" \\([^)]*\\)"; "")), is_20hz}]' \
/Users/james/Documents/GitHub/sunnypilot-docs/docs/driving_models_v6.json > matrix.json
mkdir -p output
touch "output/model-Tomb Raider 16v2 (July 21, 2025)-544"
touch "output/model-Space Lab Model (July 24, 2025)-547"
touch "output/model-Space Lab Model v1 (July 24, 2025)-548"
built=(); while IFS= read -r line; do built+=("$line"); done < <(
ls output | sed -E 's/^model-//' | sed -E 's/-[0-9]+$//' | sed -E 's/ \([^)]*\)//' | awk '{gsub(/^ +| +$/, ""); print}'
)
jq -c --argjson built "$(printf '%s\n' "${built[@]}" | jq -R . | jq -s .)" \
'map(select(.display_name as $n | ($built | index($n | gsub("^ +| +$"; "")) | not)))' \
matrix.json > retry_matrix.json
cat retry_matrix.json
[]
(openpilot) james@Mac sunnypilot %
* always
* great success
* add suffix to retry artifact so it doesn't conflict
* retry to get_model too
* and there haha
* unnecessary hyphen
* compare built to missing. include retries
* adjust copy of artifacts.
* Update build-all-tinygrad-models.yaml
* Update model selector versioning and add documentation
* Update retry condition for failed models in build-all-tinygrad-models.yaml
* Update retry condition for failed models in build-all-tinygrad-models.yaml
* Update build-single-tinygrad-model.yaml
* false
* default none because why not
* red diff? i think?
* meh ... not needed i guess
* error error error
* Nayan is watching... always watching mike wazowski
* string all the way
* lots of retries just in case because im scared
* more robust
* ONLY ONE!!!!!!
* delete.... a lot
* fix artifacts
* fix artifacts
* make sure each is unique :)
* skip files like artifact duhhhh
* artifact name dir
* concurrency
* copy here
* Update build-single-tinygrad-model.yaml
* Update build-single-tinygrad-model.yaml
* bump
* bump tinygrad
* max parallel? if not, i have the other remedy ready in build-all
* revert me!
* I resynced tinygrad woo hoo
* setup shouldnt fail
* pull
* big ole diff
* condition
* Update build-all-tinygrad-models.yaml
* not always() never always() never!!!
* not failure instead of great success
* Update build-all-tinygrad-models.yaml
* yay that worked. lets invoke build-single one last time
* these arent used and are just taking up 250MB space
* really frog?
* bump back to 3
* self-hosted, tici
* rename to trigger tests
* split sync
---------
Co-authored-by: DevTekVE <devtekve@gmail.com>
|
||
|
|
c46ecd18fa |
UI: Clear Model Cache (#1058)
* clear model cache * add cache size * move to model manager * fix handling for default model --------- Co-authored-by: DevTekVE <devtekve@gmail.com> Co-authored-by: James Vecellio-Grant <159560811+Discountchubbs@users.noreply.github.com> |
||
|
|
1b570ef418 |
sunnypilot modeld: Refactor Modeld to Allow Dynamic Plan and Lead (#1030)
* Introduce zero inputs for Lead, and plan to conform with new SP model introduced Monday, July 7, 2025 * Clean this up * We can revert this after dev-c3-new testing and ready to merge. * This needs to be apart of the conditional else fail * Add full conditional * Update longitudinal_planner.py * Mypy from myphone! * red diff * Make generation a property for clarity * Even clearer! * Affix to generation, while allowing older models to use this IF param is set. * seems a bit repetitive yea? * dynamic * Make most outputs dynamic * Rm toggle from refactor * refactor(modeld): simplify MHP output parsing logic - Introduced `_parse_mhp_output` helper to remove redundancy and streamline `parse_dynamic_outputs`. - Ensures improved code maintainability and clarity. * refactor(longitudinal_planner): streamline generation handling logic - Simplified `generation` assignment with inline conditional for better readability. - Adjusted `mlsim` logic to default to model simulation when `generation` is unset. * for ease of syncs from now on * fix --------- Co-authored-by: DevTekVE <devtekve@gmail.com> |
||
|
|
beaec753ab |
Merge branch 'upstream/openpilot/master' into sync-20250710
# Conflicts: # .github/workflows/selfdrive_tests.yaml # README.md # common/params_keys.h # opendbc_repo # panda # selfdrive/controls/lib/longitudinal_planner.py # selfdrive/controls/lib/tests/test_latcontrol.py # selfdrive/ui/soundd.py # selfdrive/ui/translations/main_ar.ts # selfdrive/ui/translations/main_de.ts # selfdrive/ui/translations/main_es.ts # selfdrive/ui/translations/main_fr.ts # selfdrive/ui/translations/main_ja.ts # selfdrive/ui/translations/main_ko.ts # selfdrive/ui/translations/main_pt-BR.ts # selfdrive/ui/translations/main_th.ts # selfdrive/ui/translations/main_tr.ts # selfdrive/ui/translations/main_zh-CHS.ts # selfdrive/ui/translations/main_zh-CHT.ts # tinygrad_repo |
||
|
|
d0bd8cc4a3 |
liveDelay: Add live delay toggle to vehicles using torqued (#1001)
* Add live delay toggle to torqued.py and twilsonco NNLC * Set this in init * Clean up * Live delay toggle refactor * ModeldLagd -> LagdToggle * This is for lagd_toggle.py * Add to NNLC * Lagd toggle: Display current values on UI * Add break * LagdToggleDelay Live edit software_delay when livedelay is toggled `off` * Always show description * Add description as to why values don't update offroad --------- Co-authored-by: Kumar <36933347+rav4kumar@users.noreply.github.com> |
||
|
|
ea8eaed1aa |
Merge remote-tracking branch 'comma/master' into sync-20250627
# Conflicts: # README.md # opendbc_repo # panda # selfdrive/ui/qt/offroad/settings.cc # selfdrive/ui/translations/main_ar.ts # selfdrive/ui/translations/main_de.ts # selfdrive/ui/translations/main_es.ts # selfdrive/ui/translations/main_fr.ts # selfdrive/ui/translations/main_ja.ts # selfdrive/ui/translations/main_ko.ts # selfdrive/ui/translations/main_pt-BR.ts # selfdrive/ui/translations/main_th.ts # selfdrive/ui/translations/main_tr.ts # selfdrive/ui/translations/main_zh-CHS.ts # selfdrive/ui/translations/main_zh-CHT.ts # system/manager/build.py # system/ui/spinner.py # tinygrad_repo # tools/lib/framereader.py Merge branch 'comma-202506127-bedcb896644528aed6af448e63eeadb3dd8b2c77' into sync-20250627 # Conflicts: # opendbc/safety/tests/libsafety/SConscript Merge branch 'comma-202506127-bedcb896644528aed6af448e63eeadb3dd8b2c77' into sync-20250627 # Conflicts: # opendbc/safety/tests/libsafety/SConscript Merge remote-tracking branch 'comma/master' into sync-20250627 # Conflicts: # opendbc/safety/tests/libsafety/SConscript Merge branch 'comma-20250627-1020d355584265391eb3acb556e4353b581fa9c0' into sync-20250627 Merge branch 'comma-20250627-1020d355584265391eb3acb556e4353b581fa9c0' into sync-20250627 Sync: `commaai/opendbc:master` into `sunnypilot/opendbc:master-new` Sync: `commaai/opendbc:master` into `sunnypilot/opendbc:master-new` Sync: `commaai/panda:master` into `sunnypilot/panda:master-new` Sync: `commaai/panda:master` into `sunnypilot/panda:master-new` |
||
|
|
d62c3cdef9 |
Model: Sync modeld with upstream arbitrary vision inputs (#1004)
* Prepare sunnypilot modeld refactor: * This is needed to work with latest vision models from comma master. * Add this for dev-c3-new |
||
|
|
65c512acc0 |
ui/models panel: liveDelay Toggle (#971)
* Model panel * Get this outta here and use sunnylink instead * Remove space * 'not' because we want gas gating to use e2e/mpc blend * Add toggles to models_panel.cc * "keep enabled for stock behavior" * Add this here * Cloudlog result * change cloudlog to debug, and add latsmooth to steer actuator delay. Need to edit json. Will do locally so when this is merged its a simple ready to go push. * Cleanup * Update longitudinal_planner.py * Remove gasgating for now.. may need to be placed in model --------- Co-authored-by: DevTekVE <devtekve@gmail.com> |
||
|
|
82487ba136 |
Merge remote-tracking branch 'comma/master' into sync-20250531
# Conflicts: # .github/workflows/selfdrive_tests.yaml # common/params_keys.h # msgq_repo # opendbc_repo # panda # selfdrive/car/card.py # selfdrive/car/tests/test_car_interfaces.py # selfdrive/car/tests/test_models.py # selfdrive/test/process_replay/process_replay.py # selfdrive/ui/qt/offroad/settings.cc # selfdrive/ui/translations/main_ar.ts # selfdrive/ui/translations/main_es.ts # selfdrive/ui/translations/main_fr.ts # selfdrive/ui/translations/main_ja.ts # selfdrive/ui/translations/main_ko.ts # selfdrive/ui/translations/main_pt-BR.ts # selfdrive/ui/translations/main_th.ts # selfdrive/ui/translations/main_tr.ts # selfdrive/ui/translations/main_zh-CHS.ts # selfdrive/ui/translations/main_zh-CHT.ts |
||
|
|
cf94bb130b | Merge branch commaai/openpilot:master into branch sunnypilot/sunnypilot:master-new | ||
|
|
9b7502bd85 |
model: Refactor modeld with modular runners and split model support (#877)
* Refactor model runner methods for improved abstraction.
Moved slicing logic to a private `_slice_outputs` method and decoupled `_run_model` for clearer subclass implementation. Removed redundant `output` attribute in `ModelState` to streamline data handling.
* Add output parsing to model_runner and remove duplicate logic
Integrates an output parser directly into `model_runner` for streamlined inference and parsing. Removes redundant parser initialization from `modeld` to avoid duplication and enhance maintainability.
* Reordering
* linter
* linter
* Refactor model handling with `ModelData` abstraction
Introduce a `ModelData` class to encapsulate model and metadata logic, improving code clarity and modularity. Refactor `ModelRunner` to manage multiple models and add conditional handling for fallback scenarios. Adjust `TinygradRunner` to validate and use the new `ModelData` structure.
* Refactor model handling to use dictionary-based structure
Replaces the model list with a dictionary keyed by model type to improve clarity and maintainability. Updates related logic and ensures consistent handling of model metadata and inputs. Adds `slice_outputs` implementation to the `TinygradRunner` for proper output parsing.
* Refactor model runners to support policy and vision separation
Introduced `TinygradPolicyRunner`, `TinygradVisionRunner`, and `TinygradSplitRunner` to enable separate handling of policy and vision models. Updated `TinygradRunner` initialization and input preparation to accommodate modular processing. Adjusted `modeld` to utilize the new runners, ensuring compatibility with separated model workflows.
* Refactor model runner initialization and simplify logic
Introduce `get_model_runner` to centralize model runner selection logic, replacing multiple conditional instantiations. Simplify the handling of model metadata by removing fallback logic and restructuring output slicing to enforce proper loading of model data. These changes improve code maintainability and clarity.
* Refactor model data access for TinygradRunner initialization
Update references to access nested artifact properties and align with structural changes to the model data schema. This simplifies input shapes handling and ensures compatibility with updated model attributes.
* Refactor imports and clean up redundant code.
Removed unused imports and improved formatting for clarity and maintainability. These changes simplify the codebase by eliminating unnecessary dependencies and ensuring consistency.
* Refactor model output parsing with specialized parsers.
Introduce abstract `_parse_outputs` method to standardize parsing logic. Add `SplitParser` for specialized parsing in `TinygradVisionRunner` and `TinygradPolicyRunner`. This improves modularity and paves the way for easier parser customization.
* Add parser for model output processing in modeld_v2
Introduce a new `Parser` class to handle parsing and processing of model outputs, including MDN, binary cross-entropy, and categorical cross-entropy outputs. This modularizes the logic, improves clarity, and prepares for handling various types of model data.
* Add `input_shapes` property to model runners
Introduce a new `input_shapes` property in the abstract base class and its implementation in derived classes. This provides a standardized way to access the input shapes of models, improving clarity and consistency in the model runners.
* Refactor model runner to use private `_model_data` attribute
Replaced public `model_data` with private `_model_data` for improved encapsulation. Updated all references and property accessors accordingly. Simplified model type handling by using raw types where applicable.
* Remove debug print statement from model_runner.py
The unnecessary `print(model_type)` statement was removed as it served no functional purpose in the code. This improves code cleanliness and avoids unintended console output during execution.
* Refactor `_parse_outputs` call in `run_model`.
Replaced the use of `self.parser.parse_outputs` with `self._parse_outputs` for clarity and consistency. Updated method signature to align with the revised usage.
* Refactor model output parsing for clarity and scope separation
Moved specific parsing logic (e.g., lane_lines, lead) from `parse_model_outputs` to `parse_policy_outputs` to better align with functional responsibilities. This improves modularity and readability while maintaining existing functionality.
* Refactor model_runner to simplify result handling
Renamed variable `result` to `parsed_result` for clarity and removed unnecessary slicing during model output parsing. These changes improve code readability and maintain consistency within the `run_model` method.
* Adjust _parse_outputs method signature in model_runner
Updated the method signature of _parse_outputs to accept a single np.ndarray instead of a dictionary. This aligns with the intended data structure and ensures consistency across subclasses implementing this abstract method.
* Refactor ModelRunner to enforce abstract base class compliance
Updated `ModelRunner` and its subclasses to properly inherit from `ABC` while refactoring methods to ensure compliance with Python's abstract base class standards. Streamlined the handling of `_parse_outputs` and added a new `input_shapes` property for improved functionality.
* Fix buffer length issue in 20Hz model initialization
Adjusted `FULL_HISTORY_BUFFER_LEN` by adding +1 for `full_features_20Hz` to address compatibility issues with the current FoF model. Added a comment noting potential failure for other models with this adjustment.
* Refactor TinygradRunner to remove abstract methods.
Simplified the TinygradRunner class by removing unnecessary @abstractmethod decorators and redundant method definitions. This streamlines the code and aligns it more effectively with its current usage and implementation.
* Refactor model runner classes and enhance type annotations
Simplified model runner implementations, added type annotations, and improved code readability and maintainability. Introduced new type definitions, updated metadata handling, and standardized input/output parsing across all runner classes. Minor comment update in `modeld.py` for clarity.
* Refactor model runner classes with detailed docstrings.
Enhanced class and function docstrings across model_runner.py for better clarity and maintainability. Descriptions now include detailed explanations of attributes, purposes, and workflows to aid understanding and future development.
* Refactor model runner classes and add TICI hardware optimization
Simplified and clarified class definitions, comments, and functionality for ModelRunner subclasses. Introduced the use of QCOM environment variable on TICI for potential hardware acceleration. Enhanced input/output handling and error reporting across Tinygrad and ONNX implementations.
* Update parser import and usage to use CombinedParser
Replaced the Parser class with CombinedParser in model_runner.py. This change ensures consistency with the updated parsing logic, aligning with the latest requirements for combined model output handling.
* Refactor TinygradRunner hierarchy for modular parsers
Reorganized the TinygradRunner and its specialized runners (Vision, Policy, and Supercombo) into a cleaner, modular structure using composable classes. This consolidates parser logic, removes redundancy, and simplifies initialization by leveraging a shared base class with a dictionary-based parser method.
* Refactor model runners to use ModularRunner as abstract base.
Introduce a new `ModularRunner` class to enforce a consistent interface across model runners. Updated existing runners, including `ModelRunner`, `SupercomboTinygrad`, `PolicyTinygrad`, and `VisionTinygrad`, to extend `ModularRunner`. Added abstract methods and properties to enhance modularity and code maintainability.
* Refactor model runners into modular components.
This commit separates the logic for Tinygrad, ONNX, and split runners into clearly defined modules and components. It introduces `PolicyTinygrad`, `VisionTinygrad`, `SupercomboTinygrad`, and centralized helpers for cleaner architecture. The changes improve modularity and maintainability of the model running and parsing workflows.
* Simplify imports and clean up unused code in ONNXRunner.
Removed unused imports and redundant environmental variables to streamline the codebase. Consolidated necessary imports and organized type definitions for improved readability and maintenance.
* Standardize imports and add model data validation.
Updated import paths to ensure consistency across modules by using `openpilot` as the base. Introduced validation in `_parse_outputs` methods to handle cases where `_model_data` is not initialized, preventing potential runtime errors.
* Remove unused import and fix whitespace in runners
The unused import `ModelData` was removed from `tinygrad_runner.py` to clean up the code. Additionally, extraneous whitespace was corrected in `onnx_runner.py` for improved readability and consistency.
* Remove unnecessary blank line in import statements
Cleaned up import section by removing an extra blank line. This helps maintain consistency and adheres to code style conventions.
* BROKEN!! Staging code but its not gonna work. Also I realized we need to run the split models in 2 stages because the output of one is immediately needed for the input of the other. We might handle it inside of the model_runner instead
* update smooth
* Revert "update smooth"
This reverts commit c335712e6e1ee189459ce34dfc9d4028feb9470f.
* match case made this very hard to read.
* shouldnt be there
* Refactor to allow TR (soon TM)
* TR 7 is .1
* metadata
* .2=3
* Remove redundant comments and clean up conditional blocks in modeld.py.
* Undoing wrong buffer
* Refactor model initialization and adjust ONNX runner import
Reorganized numpy input buffer initialization and updated `temporal_idxs` logic for better clarity and efficiency. Conditional import for ONNXRunner added for non-TICI platforms to optimize imports. These changes improve maintainability and compatibility across platforms.
* Update CURRENT_SELECTOR_VERSION to 4
Bump the CURRENT_SELECTOR_VERSION constant from 3 to 4 to reflect changes in the selector logic or requirements. This ensures compatibility with the updated selector version while maintaining the minimum required version as 2.
* Add output_slices property to model runners
Introduce output_slices property to provide access to the output slices for individual and combined models. This ensures consistent handling of output slices across vision and policy models, improving modularity and usability.
* Refactor imports to use SplitModelConstants consistently
Updated import references to use the renamed `SplitModelConstants` class for consistency across files. This change ensures clarity and better alignment with the updated class naming convention.
* Refactor buffer initialization and desired curvature handling
Refactored model input buffer initialization for improved clarity and consistency, leveraging dynamic shape calculations. Extracted `process_desired_curvature` method to encapsulate logic for handling 3D and non-3D cases. Simplified temporal index generation and related calculations for better maintainability.
* Refactor desire reshape dims logic in modeld.py
Adjust logic for setting desire reshape dimensions to handle `is_20hz_3d` separately. This improves clarity and ensures proper handling of different model runner configurations.
* Fix off-by-one error in full_desire buffer initialization
The full_desire buffer length was mistakenly set to full_history_buffer_len + 1. This change corrects it to match the intended full_history_buffer_len, ensuring proper alignment with other buffers.
* Simplify desire reshape logic by removing unused condition.
Removed the `is_20hz_3d` condition and associated reshape logic since it is no longer needed. This streamlines the code and avoids unnecessary checks for unused configurations.
* Refactor buffer initialization for 20Hz model variants
Reorganized buffer initialization logic to prioritize the 20Hz_3D condition. This improves clarity and ensures specific handling of different 20Hz configurations. Adjusted the order of conditions to streamline execution flow.
* Refactor: Move `get_action_from_model` and constants to `Model` class to improve encapsulation and readability.
* 12 line reshaping red diff
* .2 to match old models delay
* mypy fixes
* Revert "12 line reshaping red diff"
This reverts commit 8c7280f629043f0485749e2536a20af74c9209b2.
* mypy
* remove this
* Fix desired curvature for models which do not output desired_curvature
* fix FoF
* flip policy and vision outs to allow FoF and tomb raider to live in harmony using conditional `if 'this' in outs:'`
* noqa
* single
* sunnypilot modeld.py
* action
* overrides methodology
* combine split outputs to its own method
* comments
* Fix static checker line length
* static will fail on line length
lines:
286,
206,
70 - 77,
159,
168
* Address E501 line length violations
* This will make TR better while not effecting FoF/VFF at all
* Reduce this to one conditional and just call normally in vision/policy
* Align with upstream in our own way.
* check for desired curvature in outputs first
* outputs
* Use a cleaner import method
* Fix output
* Clean up some values
* Only call on init
* slight cleanup
* names!!!!!!!!!
* Refactor overrides structure to support key-value pairs.
The overrides structure now uses a list of key-value pairs instead of fixed lat/long fields. This change improves flexibility, allowing dynamic addition of override parameters. Code adjustments ensure backward compatibility and consistent behavior throughout the application.
* Refactor: Use local variable for SplitModelConstants
Introduce a local `constants` variable to replace repeated access to `SplitModelConstants`. This simplifies code readability and adheres to linter recommendations for line length.
* Refactor model constant handling to improve modularity
Replaced direct usage of model constants with dynamic access through model runners for better scalability and maintainability. This change centralizes constant definitions, reduces redundancy, and ensures clearer integration with different model types.
---------
Co-authored-by: discountchubbs <alexgrant990@gmail.com>
Co-authored-by: Discountchubbs <159560811+Discountchubbs@users.noreply.github.com>
Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
|
||
|
|
6de9526d4d |
bug: fix braking issue while experimental and using old model (#881)
* Fixes an issue on the long planner since Tomb Raider models, where the models are now meant to output the acceleration target and the "should stop" instead of it being calculated. However, older models (particularly those running on modeld_v2 from SP) do not output this. Leading to a "coasting" situation instead of braking when only e2e is used which is totally wrong. |
||
|
|
21715cdc6d | Merge branch 'upstream/openpilot/master' into 0508-sync | ||
|
|
662877c6f3 |
models: Consolidate model helpers & get_model_path filename fix (#884)
consolidate run_helpers.py & helpers.py bugfix for get_model_path |
||
|
|
b6c6a3ad19 |
Merge branch 'upstream/openpilot/master' into sync-20250503
# Conflicts: # opendbc_repo # selfdrive/controls/lib/longitudinal_planner.py # selfdrive/modeld/fill_model_msg.py |
||
|
|
d90e41f08f |
models: refactor model bundle structure (#870)
* Refactor model and artifact structures with version compatibility filtering - Introduced `Artifact` struct and nested it within the `Model` struct for improved clarity and organization. - Updated enums, logic, and parsing to align with the new struct definitions. - Implemented version compatibility filtering for model bundles using the `is_bundle_version_compatible` helper. - Enhanced artifact download handling by adding checks for missing URIs, better error management, and improved logging. - Adjusted model fetching to point to the latest endpoint (`v3`). * Make linter happy * Make linter happy * Refactor model data parsing to improve readability. Replaced kwargs-based data extraction with explicit parameter passing for clarity. This enhances code readability and reduces ambiguities in method calls, making the parsing logic more maintainable and straightforward. * Refactor error handling in active model bundle retrieval. Wrapped the logic to fetch the active model bundle in a try-except block to prevent unhandled exceptions. This ensures more robust error handling and avoids potential crashes when retrieving or processing model data. * Refactor exception handling in get_active_model_bundle Replace bare except with Exception to improve specificity and clarity. This ensures better debugging practices and aligns with recommended coding standards. Other minor whitespace adjustments were made for improved readability. * Update model path to use artifact fileName property Replaced `fileName` with `artifact.fileName` in the custom model path construction. This ensures compatibility with updated drive model structures and avoids potential file resolution issues. |
||
|
|
7bf30c17b0 | Merge remote-tracking branch 'openpilot/master' into sync-04-30 | ||
|
|
cf9b45783d | Merge remote-tracking branch 'comma/master' into sync-20250427 | ||
|
|
b9385a2368 |
Merge branch 'upstream/openpilot/master' into sync-20250422
# Conflicts: # .github/workflows/selfdrive_tests.yaml # .github/workflows/ui_preview.yaml # common/params_keys.h # opendbc_repo # panda # selfdrive/car/card.py # selfdrive/car/tests/test_car_interfaces.py # selfdrive/car/tests/test_models.py # selfdrive/controls/lib/longitudinal_planner.py # selfdrive/modeld/fill_model_msg.py # selfdrive/test/process_replay/process_replay.py # selfdrive/ui/qt/offroad/developer_panel.cc # selfdrive/ui/qt/offroad/settings.cc # selfdrive/ui/translations/main_de.ts Sync: `commaai/opendbc:master` into `sunnypilot/opendbc:master-new` Sync: `commaai/panda:master` into `sunnypilot/panda:master-new` |
||
|
|
6bd47c4eec |
Models: point to v2 of driving models json for recompiled models (#817)
Use newer model version json since they have been recompiled |
||
|
|
4a04819d96 |
Redirect license to LICENSE.md (#672)
* Redirect license to LICENSE.md * bump |
||
|
|
1779a76d3c |
Update default model to "Filet o Fish"
Changed the DEFAULT_MODEL constant and updated the associated model hash to reflect the new default. This ensures consistency between the code and the new model configuration. |
||
|
|
290383128e | Sync: Fix conflicts | ||
|
|
1a8dd310ae |
Model: split modeld into it's own contained modeld implementation (#642)
* Add support for TinyGrad model runner processing Introduced a new function `is_tinygrad_model` to detect TinyGrad as an active model runner. Updated the `is_stock_model` logic to account for TinyGrad models and added a new process entry for TinyGrad in the model manager. This enables handling TinyGrad models alongside existing configurations. adding modeld back Add support for `modeld_v2` and update paths for consistency Updated `SConscript` files to integrate `modeld_v2` alongside `modeld` and adjusted script paths for correct metadata handling. Adjusted various configurations and scripts, such as `labeler.yaml` and `build_release.sh`, to include `modeld_v2` and ensure cohesive project structure. Refactor imports to use updated `modeld_v2` paths. Replaced outdated `modeld` references with their `modeld_v2` counterparts for consistency and clarity across the codebase. Also updated `.gitignore` to accommodate new directory structure. This change ensures better maintainability and alignment with the new directory schema. Refactor and reorganize modeld to sunnypilot/modeld_v2 structure. Moved and renamed `modeld` components to the new `sunnypilot/modeld_v2` directory for better organization and modularity. Updated imports and file references to align with the new structure, ensuring compatibility and functionality. Streamlined project structure to improve maintainability and future development. * typo * Use `stock` model runner and refactor model checks. Replaces outdated model detection logic with unified `stock` runner integration, simplifying the decision flow for model selection. Includes `stock` as a new enum in the `Runner` type and updates affected references accordingly. * Handle missing 'sim_pose' in model outputs gracefully. Added conditional checks to ensure the code handles cases where 'sim_pose' is absent in the model outputs. Fallback behaviors use 'plan' data when 'sim_pose' is unavailable, preventing potential errors and enhancing robustness. |
||
|
|
c392b2b269 |
modeld: legacy MLSIM driving models support (#595)
* Add buffer length parameter for enhanced frame handling
Introduce a configurable `buffer_length` parameter to `DrivingModelFrame` to support dynamic buffer sizes, enabling better handling of different frame rates like 20Hz. Updates include necessary adjustments in buffer initialization, copying logic, and related model inputs for improved compatibility and flexibility.
* Rename variable `len` to `length` to avoid shadowing built-in.
Replaced the usage of `len` with `length` across the code to prevent conflicts with Python's built-in `len` function. This improves code clarity and reduces potential errors or misunderstandings in variable usage.
* Fix spacing inconsistency in modeld.py
Added a missing newline for better code readability and consistency. This change has no impact on functionality but improves code formatting.
* Move numpy_inputs initialization to correct position
Repositioned the `numpy_inputs` initialization to align with the input shape processing logic. This ensures consistency in buffer management and clarifies the flow of code execution related to input handling.
* Add 20Hz model state, smart input, and model switcher classes
Introduce `ModelState20Hz`, `ModelSmartInput`, and `ModelSwitcher` for enhanced modularity and flexibility in modeld. Refactor `ModelState` to inherit from these new classes, enabling support for 20Hz processing and smart input initialization. Update associated files to handle the new buffer length parameter and metadata management.
* Refactor `modeld` to streamline feature handling logic
Simplified feature processing for both standard and "smart input" modes by consolidating logic into reusable methods. Updated variable naming, formatting, and spacing for consistency and readability. This refactor enhances maintainability and reduces redundancy in feature update operations.
* Silence debug print statements and use cloudlog for warnings.
Commented out a debug print statement in `commonmodel.cc` to reduce noise. Replaced `print` statements with `cloudlog.warning` in `model_smart_input.py` for improved logging consistency and better integration with the logging system.
* Clean up formatting and fix minor style inconsistencies
Removed unnecessary blank lines and adjusted spacing to standardize code style across the file. These changes improve readability without altering functionality or logic.
* Refactor modeld logic and remove unused 20Hz and smart inputs
Eliminated `ModelSmartInput`, `ModelSwitcher`, and `ModelState20Hz` classes, simplifying model state handling. Centralized model processing within a unified `ModelState` class and moved related code into `sunnypilot/modeld_20hz`. This improves maintainability by removing unused features and consolidating model execution logic, aligning with current system requirements.
* clean
* Remove debug print statement in commonmodel.cc
The `printf` statement logging buffer movement details was removed as it is unnecessary for release builds. This helps streamline the code and avoid excessive console output during execution.
* Refactor model handling for 20Hz and introduce model runners
Introduce ModelRunner abstraction with TinygradRunner and ONNXRunner to streamline model handling for TICI and non-TICI hardware. Added support for dynamic input preparation and 20Hz models while simplifying the model parsing logic. This improves modularity, readability, and extensibility for future updates.
* Remove unused import and fix import order in model_runner.py
This commit removes the unused 'dtypes' import from tinygrad.tensor and adjusts the import order for cleaner code. These changes enhance readability and maintain coding standards.
* Add is20hz field to custom.capnp schema
Introduce a new boolean field `is20hz` to the `custom.capnp` schema. This allows the system to identify 20Hz-specific configurations or data processing. No changes to existing behavior are introduced for non-20Hz cases.
* Add Meta20hz class for 20Hz model message handling.
Introduces a new Meta20hz class for filling 20Hz model messages, encapsulating functionality for curvature, lane lines, road edges, and more. Refactored `modeld.py` to utilize the new class, improving modularity and maintainability. Minor adjustments were made to initialize and handle model metadata.
* Refactor import paths to align with `openpilot` structure.
Updated several import statements to use the `openpilot` namespace for better consistency and organization. This aligns the sunnypilot components more closely with the overall project structure.
* Refactor modeld to support 20Hz models and modularize runners
Replaced legacy runner logic with a unified ONNX and Tinygrad runner to support 20Hz models. Centralized model metadata management and optimized input preparation for adaptability. Updated curvature handling and output parsing for improved modularity and maintainability.
* Add 20Hz metadata handling for model predictions
Introduce `Meta20hz` class for 20Hz-specific metadata and implement dynamic loading of meta model classes in `meta_helper.py`. Update `fill_model_msg.py` to use the new metadata structure, ensuring seamless integration with 20Hz models. Adjust imports in `model_runner.py` to align with project structure.
* "Refactor modeld_20hz to modeld_v2 with cleanup"
Refactored `modeld_20hz` module to `modeld_v2` for improved clarity and consistency. Removed unused code and aligned imports across modules to reflect the new structure. Enhanced maintainability by restructuring model-related files and updating references accordingly.
* Refactor variable names and adjust imports for clarity.
Renamed `len` to `length` to avoid conflict with the built-in function and improve readability. Reorganized imports in `fill_model_msg.py` for better structure and consistency.
* "Add missing newline at end of file in __init__.py
Ensure proper formatting by adding a newline at the end of the file. This adheres to POSIX standards and improves compatibility with some tools and version control systems."
* Handle model runner initialization errors gracefully
Wrap the model runner initialization in a try-except block to catch and log exceptions. This ensures that failures during initialization are logged with detailed information, improving debugging and error tracing.
* Refactor curvature calculation for clarity and reuse.
Introduce a dedicated `get_curvature_from_output` function to handle desired curvature retrieval, improving code readability and reusability. Replace redundant logic in curvature calculation with the new function to streamline the flow.
* Make 20Hz-specific variables conditional in modeld.py
Moved the initialization of 20Hz-specific variables to be conditional based on the `is_20hz` flag. This ensures that unnecessary memory allocations are avoided when the model is not running at 20Hz, improving efficiency and clarity.
* cleanup
---------
Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
|
||
|
|
9ccc5cc3ea |
models: retain pre-20hz drive model support (#531)
* modeld: Retain pre-20hz drive model support * Method not available anymore on OP * some fixes * Revert "Long planner get accel: new function args (#34288)" * Revert "Fix low-speed allow_throttle behavior in long planner (#33894)" * Revert "long planner: allow throttle reflects usage (#33792)" * Revert "Gate acceleration on model gas press predictions (#33643)" * Reapply "Gate acceleration on model gas press predictions (#33643)" This reverts commit 76b08e37cb8eb94266ad9f6fed80db227e7c3428. * Reapply "long planner: allow throttle reflects usage (#33792)" This reverts commit c75244ca4e9c48084b0205b7c871e1a4e0f4e693. * Reapply "Fix low-speed allow_throttle behavior in long planner (#33894)" This reverts commit b2b7d21b7b685a2785d1beede3d223f0bb954807. * Reapply "Long planner get accel: new function args (#34288)" This reverts commit 74dca2fccf4da59cc8ac62ba9c0ad10ba3fc264b. * don't need * retain snpe * wrong * they're symlinks * remove * put back into VCS * add back * don't include built * Refactor model runner retrieval with caching support Added caching for active model runner type via `ModelRunnerTypeCache` to enhance performance and avoid redundant checks. Introduced a `force_check` flag to bypass the cache when necessary. Updated related code to handle cache clearing during onroad transitions. * Update model runner determination logic with caching fix Enhances `get_active_model_runner` to utilize caching more effectively by ensuring type consistency and updating cache only when necessary. Also updates `is_snpe_model` to pass the `started` state to the runner determination function, improving behavior for dynamic checks. * parse inputs via metadata * load model and metadata dynamically * cherry pick from devtekve as base * lateral_control_params & prev_desired_curv: MLSIM V0 to Null Pointer * old desired_curv data: MLSIM V1 to Postal Service * Bringing what was on master back then * Cleaning up * Refactor model pipeline for modularity and dynamic input handling Refactored the model pipeline by introducing helper functions to modularize model loading, metadata extraction, and input preparation. Improved flexibility in handling dynamic input keys and parsing outputs based on model configuration. Removed deprecated or unused code segments for cleaner and more maintainable structure. * Push NDv2 because why not and fix modeld * `Refactor model parsing and clean unused code dependencies` Simplified `parse_outputs` by removing unnecessary `input_keys` parameter, ensuring cleaner logic. Updated `PROCESS_NAME` for standardization and eliminated deprecated `Pathlib` dependencies in model paths. Minor adjustments improve input handling for lateral control parameters. * Refactor model and metadata loading functions. Simplified and clarified `load_model` by renaming it to `get_model_path` and removing redundant variable assignments. Streamlined `load_metadata` by directly returning the loaded metadata without intermediate variables. These changes improve code readability and maintainability. * Refactor modeld process selection based on SNPE support. Introduce conditional logic to determine and start the appropriate modeld process (SNPE or default) based on hardware support. This improves flexibility and ensures correct process management. * Walrus baby * Update longitudinal_planner.py * Improve model download progress handling and translations Refactored model download status handling logic for better clarity and added mechanisms to track status changes efficiently. Updated UI text and translations across multiple languages to reflect consistent and accurate model download states. * Revert "Update longitudinal_planner.py" This reverts commit b44a687e4cfb1e2708457478e8626c731f42db0c. * Fix variable naming for curvature size in modeld.py Renamed the variable `len` to `length` to avoid conflict with the built-in `len()` function, improving code clarity and preventing potential errors. Also removed trailing spaces in commented-out sections for better formatting consistency. * sync with upstream * some are different * should work * sim_pose only exists in in ndv3 and prior * dynamic meta constants * fix * uiview: disable power saving * fix this * ain't coasting for y'all * Static analysis * Refactor initialization of model inputs for clarity. Removed redundant pre-initialization of `driving_style`, `nav_features`, and `nav_instructions` variables. Instead, directly initialize these within their respective conditional blocks for better readability and reduced memory usage. * default to none * enable in next PR * more * Revert "more" This reverts commit f5a4220588c5b014b29173f8f89e1fecdec25336. * Revert "enable in next PR" This reverts commit 621cc4f18ead8489cb05a22a73b48e5e4fe33787. * no need to cast bool * nuke * fix desired curvature for pre LAv1 models * mypy * static * fix * new json * Going to a test branch with a different model json list * renamed model json * Update model runner handling in custom.capnp and helpers Refactored model runner logic by introducing a `runner` field in `custom.capnp` and simplifying `get_active_model_runner` logic. Removed deprecated function `get_model_runner_by_filename` and added a temporary filter in `fetcher.py` to enforce `snpe` until full tinygrad support is implemented. * Revert "Update model runner handling in custom.capnp and helpers" This reverts commit f34d872c1369fa5479496ba4e0cce7b3063ab358. * Revert "renamed model json" This reverts commit 15c6ed303b01ab78d1a576dc1d4ad105db7518df. * Revert "Going to a test branch with a different model json list" This reverts commit 4c1408fee524656049ac6502ac4f578e5b632d54. * Reapply "renamed model json" This reverts commit c6fec6912a1517d161dc9b23dce43ddf46866312. Reapply "Going to a test branch with a different model json list" This reverts commit 83e253e9a3b6573191d907584d6368d991395b0a. * Add 'runner' property to 'ModelBundle' and update relevant functions The 'ModelBundle' class in 'custom.capnp' has been extended to include a 'runner' property. This required updating 'fetcher.py' to handle the 'runner' property when parsing model bundles. Additionally, the helper function 'get_model_runner_by_filename' has been removed from 'helpers.py' as it is no longer needed because the 'runner' property provides this information. The 'get_active_model_runner' function has also been updated in light of these changes. * Refine bundle selection logic in SoftwarePanelSP Improve logic for determining which model bundle to display by considering download status and failure state. Remove unnecessary function call to enhance clarity and maintainability. * tmp * Add retrieval of active model bundle in manager loop Introduce a call to `get_active_bundle` to fetch the active model bundle and store it in `self.active_bundle`. This ensures the active bundle is always up-to-date during the model management process. * Add "Use Default" option for model selection Introduced a "Use Default" option in the model selection dropdown, allowing users to reset to the default model. Adjusted logic to handle default selection and ensure proper parameter updates. Fixed bundle status handling during the download process in the model manager. * Refactor type hint in active_bundle assignment. Removed an unnecessary type hint in the active_bundle assignment for cleaner and more maintainable code. This change does not affect functionality but improves code readability. * no nested * update json url * split out * format * condense * more --------- Co-authored-by: Jason Wen <haibin.wen3@gmail.com> Co-authored-by: Kumar <36933347+rav4kumar@users.noreply.github.com> |
||
|
|
acd46aa94b |
modeld: retain SNPE and thneed drive model support (#555)
* modeld: Retain pre-20hz drive model support * Method not available anymore on OP * some fixes * Revert "Long planner get accel: new function args (#34288)" * Revert "Fix low-speed allow_throttle behavior in long planner (#33894)" * Revert "long planner: allow throttle reflects usage (#33792)" * Revert "Gate acceleration on model gas press predictions (#33643)" * Reapply "Gate acceleration on model gas press predictions (#33643)" This reverts commit 76b08e37cb8eb94266ad9f6fed80db227e7c3428. * Reapply "long planner: allow throttle reflects usage (#33792)" This reverts commit c75244ca4e9c48084b0205b7c871e1a4e0f4e693. * Reapply "Fix low-speed allow_throttle behavior in long planner (#33894)" This reverts commit b2b7d21b7b685a2785d1beede3d223f0bb954807. * Reapply "Long planner get accel: new function args (#34288)" This reverts commit 74dca2fccf4da59cc8ac62ba9c0ad10ba3fc264b. * don't need * retain snpe * wrong * they're symlinks * remove * put back into VCS * add back * don't include built * Refactor model runner retrieval with caching support Added caching for active model runner type via `ModelRunnerTypeCache` to enhance performance and avoid redundant checks. Introduced a `force_check` flag to bypass the cache when necessary. Updated related code to handle cache clearing during onroad transitions. * Update model runner determination logic with caching fix Enhances `get_active_model_runner` to utilize caching more effectively by ensuring type consistency and updating cache only when necessary. Also updates `is_snpe_model` to pass the `started` state to the runner determination function, improving behavior for dynamic checks. * default to none * enable in next PR * more --------- Co-authored-by: DevTekVE <devtekve@gmail.com> |
||
|
|
402ee444b7 |
Revert "modeld: retain SNPE and thneed drive model support" (#551)
Revert "modeld: retain SNPE and thneed drive model support (#530)"
This reverts commit
|
||
|
|
56aa07844a |
modeld: retain SNPE and thneed drive model support (#530)
* modeld: Retain pre-20hz drive model support * Method not available anymore on OP * some fixes * Revert "Long planner get accel: new function args (#34288)" * Revert "Fix low-speed allow_throttle behavior in long planner (#33894)" * Revert "long planner: allow throttle reflects usage (#33792)" * Revert "Gate acceleration on model gas press predictions (#33643)" * Reapply "Gate acceleration on model gas press predictions (#33643)" This reverts commit 76b08e37cb8eb94266ad9f6fed80db227e7c3428. * Reapply "long planner: allow throttle reflects usage (#33792)" This reverts commit c75244ca4e9c48084b0205b7c871e1a4e0f4e693. * Reapply "Fix low-speed allow_throttle behavior in long planner (#33894)" This reverts commit b2b7d21b7b685a2785d1beede3d223f0bb954807. * Reapply "Long planner get accel: new function args (#34288)" This reverts commit 74dca2fccf4da59cc8ac62ba9c0ad10ba3fc264b. * don't need * retain snpe * wrong * they're symlinks * remove * put back into VCS * add back * don't include built * Refactor model runner retrieval with caching support Added caching for active model runner type via `ModelRunnerTypeCache` to enhance performance and avoid redundant checks. Introduced a `force_check` flag to bypass the cache when necessary. Updated related code to handle cache clearing during onroad transitions. * Update model runner determination logic with caching fix Enhances `get_active_model_runner` to utilize caching more effectively by ensuring type consistency and updating cache only when necessary. Also updates `is_snpe_model` to pass the `started` state to the runner determination function, improving behavior for dynamic checks. * default to none * enable in next PR * more --------- Co-authored-by: DevTekVE <devtekve@gmail.com> |
||
|
|
9e6656fd2e |
models: Fix cache expiration logic in fetcher.py
Ensure the cache is treated as expired when last_sync is zero. This prevents potential issues with uninitialized or missing sync timestamps, enhancing reliability. |
||
|
|
c13f159a77 |
Revert "models: retain SNPE runner support" (#529)
Revert "models: retain SNPE runner support (#522)"
This reverts commit
|
||
|
|
f84d27c4ee |
models: retain SNPE runner support (#522)
* tinygrad with snpe * force with snpe to validate * fix path * fix more paths * Adjust modeld execution logic based on active model runner Introduced a check to conditionally execute `modeld` based on the active model runner. Added support for distinguishing between SNPE and TinyGrad runners using new helper functions and updated `custom.capnp` definitions. This change optimizes process management by ensuring compatibility with the selected model runner. * Refactor modeld process function checks. Introduce `is_stock_model` to clarify logic and replace direct uses of `is_snpe_model` where the stock model condition is needed. Additionally, rename the duplicate "modeld" process in sunnyPilot to "modeld_snpe" for clarity and consistency. * ignore tg * fix process name * ruff * fix thneed paths * mypy * remove our own * use upstream compile3 * fix thneed * try this * Revert "remove our own" This reverts commit 1cf4f57502565c274628e185c66f1eb04c4d9bbe. * try using compile2.py again * add back symlink * fix path * more fix * wrong path again * Revert "wrong path again" This reverts commit f5301c19d594defb23cda2604168bcb02c830f3e. * update * hardcode path to our submodule * force path * try this * fix file name * try this * again * Revert "again" This reverts commit 17c8cd73768a2de5aaf2a34d202aa6f03d59d72d. * Revert "try this" This reverts commit 767f78bbcf17b08edbc20f283d10a1990bf4264f. * Revert "fix file name" This reverts commit 485eef68da981da571fe9a9ebf3aecdb95e5588c. * Revert "try this" This reverts commit 41fef87680cdda1ba8cbd7e5c59256e6c57010a0. * Revert "force path" This reverts commit 5c3b408937bff0f61b150971b328d127501c5bf0. * Revert "hardcode path to our submodule" This reverts commit 5ee1950b6f4fce73e7e73b6971b996a9989d0a93. * Revert "update" This reverts commit fb313bd7fbeb50111f3c4a11137b4cfd9cabc3fa. * Reapply "wrong path again" This reverts commit 309639aeb3575e20b215bbbcc27e48923ee95c87. * Revert "wrong path again" This reverts commit f5301c19d594defb23cda2604168bcb02c830f3e. * Revert "more fix" This reverts commit 23dd423e78e60bd6a0bd73e921bfba9a5aad88bd. * Revert "fix path" This reverts commit 75d338f2bda2dfa77044e33f4c6553390621b13b. * Revert "add back symlink" This reverts commit 9f71ad0b8ae2068e431c455af9d4f954d024eec7. * Revert "try using compile2.py again" This reverts commit 914117d2e1c6c4270f7bef1a5305847a1d7bab17. * Reapply "remove our own" This reverts commit b1996377b346658f2094cba9032a66230784cb3e. * don't even compile anymore * need it for default snpe model * add to lfs * bring onnx back for sim * must add this back * need this --------- Co-authored-by: DevTekVE <devtekve@gmail.com> |
||
|
|
993c4a0d2a |
Driving Model Manager (#457)
* Introduce Model Manager to handle downloads and verification
This commit introduces a new Model Manager responsible for handling model downloads, including driving and navigation application models. The manager also verifies file hashes and communicates download progress for an improved user experience.
The Model Manager is asynchronous and utilizes asyncio and aiohttp for enhanced performance, including robust error handling.
Impacted files in the 'cereal', 'common', 'sunnypilot', and 'system' directories have been updated accordingly. The 'ModelsFetcher' process configuration has been modified to run only when off-road, ensuring optimum resource management.
This update aims to enhance code clarity, improve performance, and streamline the handling of model downloads.
* "Update model management and fetching for SunnyPilot"
This update refactors the model management, downloading and cache verification mechanisms of SunnyPilot. New functionalities, such as smart cache handling, have been implemented in ModelFetcher in sunnypilot/models/model_fetcher.py. Also, the model downloading process has been moved to a separate async function _download_bundle in ModelManagerSP in sunnypilot/models/model_manager.py. Hash verification of files is now performed in an async function verify_file in sunnypilot/models/model_helper.py. Changes in system parameters related to model management have been reflected in system/manager/manager.py.
* Integrate download ETA calculations in model manager
This commit introduces a new feature that calculates and tracks the Estimated Time of Arrival (ETA) for downloading models in the model manager component. The 'eta' property in the 'DownloadProgress' structure in 'custom.capnp' is changed from 'Float32' to 'UInt32'.
In the 'model_manager.py' file, a new method '_calculate_eta' has been added to perform ETA calculations. An additional dictionary '_download_start_times' has been created to keep track of the start time of each model download. The ETA is calculated every time a portion of the model file is downloaded, and it gets updated in the 'DownloadProgress' structure. Finally, the start time is cleared after the download completes.
In 'model_manager_audit.py', an additional check is added to only print downloadProgress for the downloads currently in progress.
* format
* no default model cache {} because it can be considered a valid json, we do not want that
* Refactor typing annotations to use PEP 604 syntax.
Updated type hints to adopt PEP 604 union syntax (`X | None`) and replaced `List` and `Dict` with modern built-in `list` and `dict`. This change improves consistency and readability while aligning with Python 3.10+ standards.
* Simplify logging messages and remove unused imports.
Removed an unused import from `model_manager.py` to improve clarity and maintainability. Also refined a log message in `model_fetcher.py` by removing unnecessary formatting for consistency.
* Refactor model handling and simplify cache fallback logic.
Updated type annotations for `selected_bundle` in `model_manager.py` for clarity. Streamlined cache fallback logic in `model_fetcher.py` by removing redundant conditionals while preserving functionality. These changes improve code readability and maintainability.
* "Fix formatting for ModelManager_DownloadIndex retrieval
Condensed parameter alignment in the get method for improved readability and adherence to style guidelines. This change does not affect functionality but ensures consistent code formatting."
* Need to have main defined for process_config to be able to run it
* Refactor model management to support active bundle tracking
Introduce the concept of an active model bundle with a new persistent parameter and API updates. Added fields for `generation` and `environment` in model metadata, improved caching, and updated methods to manage active model states efficiently.
* UI commit (#515)
* Refactor model management to support active bundle tracking
Introduce the concept of an active model bundle with a new persistent parameter and API updates. Added fields for `generation` and `environment` in model metadata, improved caching, and updated methods to manage active model states efficiently.
* Add new driving model selection feature to settings
This commit introduces a new feature to the settings that allows users to select different driving models. It fetches available models and displays their download progress. The created UI also suggests a calibration reset after model download. The changes include the creation of 'SoftwarePanelSP' within 'settings.' Additionally, 'sunnypilot/SConscript' has been updated to include 'settings.cc' and 'software_panel.cc'. Changes also include localization for this feature.
* Show model description during download status
This update ensures the model description is displayed when a model is in the downloading state. It improves the user interface by providing real-time feedback during the download process.
* Update translations for multiple languages
Added new and updated translation strings in several language files, including Spanish, Arabic, Chinese (Simplified and Traditional), Turkish, Korean, Thai, Japanese, and Brazilian Portuguese. These updates include placeholder translations for new UI elements and features.
* Refactor model name handling and add generation check.
Replaced `bundleName` with `model_name` for better clarity in status messages. Added a generation mismatch check before showing the reset parameters dialog to avoid unnecessary prompts.
* Update model handling in SoftwarePanelSP
Remove unused "common/model.h" and replace "CURRENT_MODEL" with "..." as the default return value in GetModelName. Adjust logic to check for active bundles instead of selected bundles for improved accuracy. Minor text change for clarity in UI label.
* Rename `GetModelName` to `GetActiveModelName` for clarity.
The new name better reflects the function's purpose of retrieving the active model name, improving code readability. All relevant calls and references have been updated to ensure consistency across the codebase.
* Update sunnypilot/models/model_helper.py
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
* Refactor download status handling and add 'cached' state
Introduce 'cached' as a new download status and adjust relevant logic across components to support it. Simplify and streamline model status handling in the software panel for better readability and maintainability. Ensure consistent status reporting for all model types.
* Update translations for multiple languages
Refined and expanded translations across various languages, replacing placeholders with meaningful text. This improves clarity and user experience in the multilingual interface.
* Update terminology from 'bundle' to 'model' in UI texts
Replaced occurrences of 'bundle' with 'model' in button labels, dialog titles, and messages in the SoftwarePanelSP code. This improves clarity and aligns terminology with current functionality.
* Update translation placeholders for model fetching texts
Replaced "Fetching bundles" with "Fetching models" across multiple languages to align text placeholders with the updated functionality. Adjusted related background download messages for clarity and consistency.
* cleanup
* not used, and likely not needed
---------
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
* cleaning up
* Update system/manager/process_config.py
* Simplify model parsing and index handling logic.
Refactored `ModelManager_DownloadIndex` retrieval to use the walrus operator, streamlining the conditional logic. Additionally, restructured model list initialization in `_parse_bundle` for improved readability and maintainability. These changes enhance code clarity and reduce redundancy.
* `Improve error handling in model cache retrieval`
Revised the `get` method to ensure it returns an empty dictionary on errors or missing data, avoiding potential `None`-related issues. Added logging for clearer diagnostics when cached model data is unavailable or retrieval fails. This improves reliability and debuggability of the model fetching process.
* Fix cached model data handling by parsing JSON response
Previously, cached model data was returned as a raw string, causing potential issues when using the data. The change ensures the cached data is properly parsed into JSON format before returning, improving reliability and consistency.
* Adjust modelManagerSP rate and Ratekeeper frequency
Reduced the rate for modelManagerSP in services and aligned the Ratekeeper frequency in model_manager.py to 0.1.
* Update model fetcher URL and adjust modelManagerSP rate
Updated the model fetcher URL to point to the correct resource for driving models. Adjusted the rate of modelManagerSP in both its service definition and the corresponding Ratekeeper initialization to 1 Hz for improved consistency.
* Refactor model download logic for clarity and efficiency
Simplify the logic for finding the model to download by combining redundant constructs into a single line. This improves code readability and reduces unnecessary variable assignments.
* Fix cache keys for manual prebuilt actions because they were missing the cache when manually built
* no need to log
* formatting
* revert ci changes
* Refactor and restructure `modeld` to `models` module.
Renamed `modeld` directory to `models` for clarity and consistency. Updated all references and imports to reflect the new structure. This improves maintainability and aligns with naming conventions.
---------
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
|