From 678fe9ad7cd26cad7d4c6a3d71996947d4132229 Mon Sep 17 00:00:00 2001 From: Yassine Yousfi Date: Mon, 10 Oct 2022 20:12:34 -0700 Subject: [PATCH] new models in tests --- .github/workflows/test.yml | 2 +- openpilot/compile.py | 2 +- openpilot/run_thneed.py | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index da5681a2..70db8339 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -136,7 +136,7 @@ jobs: run: | FLOAT16=1 UNSAFE_FLOAT4=1 DEBUGCL=1 python3 openpilot/compile.py UNSAFE_FLOAT4=1 DEBUGCL=1 python3 openpilot/compile.py - PYTHONPATH="." python3 openpilot/run_thneed.py /tmp/output.thneed https://github.com/commaai/openpilot/raw/ea449f1fe0bbff0eff5b12d64f0b5e75b7983998/selfdrive/modeld/models/supercombo.onnx + PYTHONPATH="." python3 openpilot/run_thneed.py /tmp/output.thneed https://github.com/commaai/openpilot/raw/6c5693e965b9c63f8678f52b9e9b5abe35f23feb/selfdrive/modeld/models/supercombo.onnx testmypy: name: Mypy Tests diff --git a/openpilot/compile.py b/openpilot/compile.py index 339d077c..58ebb234 100644 --- a/openpilot/compile.py +++ b/openpilot/compile.py @@ -25,7 +25,7 @@ from extra.onnx import get_run_onnx from tinygrad.tensor import Tensor from tinygrad.helpers import prod -OPENPILOT_MODEL = "https://github.com/commaai/openpilot/raw/ea449f1fe0bbff0eff5b12d64f0b5e75b7983998/selfdrive/modeld/models/supercombo.onnx" +OPENPILOT_MODEL = "https://github.com/commaai/openpilot/raw/6c5693e965b9c63f8678f52b9e9b5abe35f23feb/selfdrive/modeld/models/supercombo.onnx" np.random.seed(1337) def get_random_input_tensors(): diff --git a/openpilot/run_thneed.py b/openpilot/run_thneed.py index cc1e565e..765a72d5 100644 --- a/openpilot/run_thneed.py +++ b/openpilot/run_thneed.py @@ -75,7 +75,7 @@ def load_thneed_model(fn="model.thneed", float32=False, replace=None): else: # zero out buffers buf = cl.Buffer(ctx, mf.READ_WRITE | mf.COPY_HOST_PTR, hostbuf=b'\x00'*o['size']*(2 if float32 else 1)) - + bufs[o['id']] = buf bufs_loaded[o['id']] = 'data' in o @@ -185,7 +185,7 @@ def load_thneed_model(fn="model.thneed", float32=False, replace=None): #if k['name'] == 'zero_pad_image_float': #arr = np.zeros((aaa[1].size//4), dtype=np.float32) #cl.enqueue_copy(q, arr, aaa[1]) - + """ if k['name'] == "convolution_horizontal_reduced_reads": print(aaa) @@ -229,9 +229,9 @@ if __name__ == "__main__": np_inputs = { "input_imgs": np.random.randn(*(1, 12, 128, 256))*256, "big_input_imgs": np.random.randn(*(1, 12, 128, 256))*256, - "desire": np.zeros((1, 8)), + "desire": np.zeros((1, 100, 8)), "traffic_convention": np.array([[1., 0.]]), - "initial_state": np.random.randn(*(1, 512)) + "features_buffer": np.random.randn(*(1, 99, 128)) } np_inputs = {k:v.astype(np.float32) for k,v in np_inputs.items()} inputs = list(np_inputs.values())[::-1] @@ -251,7 +251,7 @@ if __name__ == "__main__": diff = 0 diffs = [] for i in range(ret.shape[0]): - if abs(out[i]-ret[i]) > 0.1 and abs((out[i]-ret[i])/out[i]) > 0.01: + if abs(out[i]-ret[i]) > 0.15 and abs((out[i]-ret[i])/out[i]) > 0.01: diff += 1 diffs.append(out[i] - ret[i]) if diff == 10: