mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-10-15 08:13:42 +08:00
modeld: drop chestnut on fallback (#39044)
This commit is contained in:
@@ -77,6 +77,12 @@ def get_action_from_model(model_output: dict[str, np.ndarray], prev_action: log.
|
||||
shouldStop=bool(stop))
|
||||
|
||||
|
||||
def drop_chestnut() -> None:
|
||||
if "AMD" in Device._opened_devices:
|
||||
for d in Device._opened_devices:
|
||||
Device[d].pending.pop(Device["AMD"], None)
|
||||
|
||||
|
||||
class ChestnutGpuState:
|
||||
# GPU metrics require modeld's GPU context
|
||||
def __init__(self, pm: PubMaster, big: bool):
|
||||
@@ -281,6 +287,8 @@ def main(demo=False):
|
||||
loader.join(BIG_MODEL_TIMEOUT)
|
||||
model = big_model
|
||||
params.put_bool("ChestnutActive", model is not None)
|
||||
if model is None:
|
||||
drop_chestnut()
|
||||
|
||||
small_model = ModelState(vipc_client_main.width, vipc_client_main.height, False) if model is None or CHESTNUT else None
|
||||
if model is None:
|
||||
@@ -413,6 +421,7 @@ def main(demo=False):
|
||||
raise
|
||||
# fallback to small model
|
||||
cloudlog.exception("big model failed, fall back to small")
|
||||
drop_chestnut()
|
||||
params.put_bool("ChestnutActive", False)
|
||||
model = small_model
|
||||
if chestnut_state is not None:
|
||||
|
||||
Reference in New Issue
Block a user