From 1976e6e6859f1a9dd86e9b57738d8368dba357d6 Mon Sep 17 00:00:00 2001 From: Tim Wilson Date: Mon, 16 Dec 2024 11:21:14 -0700 Subject: [PATCH] NNFF: use substitute.toml as fallback for model lookup --- selfdrive/car/interfaces.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/selfdrive/car/interfaces.py b/selfdrive/car/interfaces.py index 8ab60d786ecbed..f925f5b1c54b19 100644 --- a/selfdrive/car/interfaces.py +++ b/selfdrive/car/interfaces.py @@ -193,9 +193,17 @@ def check_nn_path(check_model): return model_path def get_nn_model(car, eps_firmware) -> tuple[FluxModel | None, float]: + with open(TORQUE_SUBSTITUTE_PATH, 'rb') as f: + sub = tomllib.load(f) model = get_nn_model_path(car, eps_firmware) if model is not None: model = FluxModel(model) + else: + sub_candidate = sub.get(car, car) + if sub_candidate != car: + model = get_nn_model_path(sub_candidate, eps_firmware) + if model is not None: + model = FluxModel(model) return model # generic car and radar interfaces