new models in tests

This commit is contained in:
Yassine Yousfi 2022-10-10 20:12:34 -07:00
parent a2b77cc399
commit 678fe9ad7c
3 changed files with 7 additions and 7 deletions

View File

@ -136,7 +136,7 @@ jobs:
run: | run: |
FLOAT16=1 UNSAFE_FLOAT4=1 DEBUGCL=1 python3 openpilot/compile.py FLOAT16=1 UNSAFE_FLOAT4=1 DEBUGCL=1 python3 openpilot/compile.py
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: testmypy:
name: Mypy Tests name: Mypy Tests

View File

@ -25,7 +25,7 @@ from extra.onnx import get_run_onnx
from tinygrad.tensor import Tensor from tinygrad.tensor import Tensor
from tinygrad.helpers import prod 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) np.random.seed(1337)
def get_random_input_tensors(): def get_random_input_tensors():

View File

@ -75,7 +75,7 @@ def load_thneed_model(fn="model.thneed", float32=False, replace=None):
else: else:
# zero out buffers # zero out buffers
buf = cl.Buffer(ctx, mf.READ_WRITE | mf.COPY_HOST_PTR, hostbuf=b'\x00'*o['size']*(2 if float32 else 1)) 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[o['id']] = buf
bufs_loaded[o['id']] = 'data' in o 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': #if k['name'] == 'zero_pad_image_float':
#arr = np.zeros((aaa[1].size//4), dtype=np.float32) #arr = np.zeros((aaa[1].size//4), dtype=np.float32)
#cl.enqueue_copy(q, arr, aaa[1]) #cl.enqueue_copy(q, arr, aaa[1])
""" """
if k['name'] == "convolution_horizontal_reduced_reads": if k['name'] == "convolution_horizontal_reduced_reads":
print(aaa) print(aaa)
@ -229,9 +229,9 @@ if __name__ == "__main__":
np_inputs = { np_inputs = {
"input_imgs": np.random.randn(*(1, 12, 128, 256))*256, "input_imgs": np.random.randn(*(1, 12, 128, 256))*256,
"big_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.]]), "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()} np_inputs = {k:v.astype(np.float32) for k,v in np_inputs.items()}
inputs = list(np_inputs.values())[::-1] inputs = list(np_inputs.values())[::-1]
@ -251,7 +251,7 @@ if __name__ == "__main__":
diff = 0 diff = 0
diffs = [] diffs = []
for i in range(ret.shape[0]): 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 diff += 1
diffs.append(out[i] - ret[i]) diffs.append(out[i] - ret[i])
if diff == 10: if diff == 10: