From bb37d83baf3f2cc37252a77cab04beed76391d17 Mon Sep 17 00:00:00 2001 From: discountchubbs Date: Sat, 29 Aug 2026 11:12:34 -0700 Subject: [PATCH] non finite --- openpilot/sunnypilot/modeld_v2/modeld.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/openpilot/sunnypilot/modeld_v2/modeld.py b/openpilot/sunnypilot/modeld_v2/modeld.py index 5fdaa1dbb9..033e56c0b5 100755 --- a/openpilot/sunnypilot/modeld_v2/modeld.py +++ b/openpilot/sunnypilot/modeld_v2/modeld.py @@ -59,12 +59,15 @@ def _pkl_exists(path): def _find_driving_pkl(bundle): if (override := os.environ.get('COMBINED_MODEL_PKL')) and _pkl_exists(override): return override - if bundle and bundle.models: - from openpilot.common.hardware.hw import Paths - for model in bundle.models: - if pkl_name := bundle.models[0].artifact.fileName: - if _pkl_exists(path := os.path.join(Paths.model_root(), pkl_name)): - return path + if bundle is None or not bundle.models: + return None + from openpilot.common.hardware.hw import Paths + model_root = Paths.model_root() + + pkl_name = bundle.models[0].artifact.fileName + pkl_path = os.path.join(model_root, pkl_name) + if _pkl_exists(pkl_path): + return pkl_path return None @@ -285,8 +288,7 @@ class ModelState(ModelStateBase): buf[0, -1, :] = outputs['desired_curvature'][0, :] if not self.mlsim else 0 if self.chestnut and not np.all(np.isfinite(outputs.get('plan', np.array([0.])))): - cloudlog.error("model output not finite, dropping frame") - return None + raise RuntimeError("model output not finite") return outputs