Skip to content

Commit a040302

Browse files
committed
Update on "Add preprocess to ci"
1. Run `test_preprocess.py` in ci. 2. Refactor `test_preprocess.py` by creating the model artifacts (eager, exported, et) once and re-use them on different inputs (previously, create model artifacts for each test). Test Plan: ``` pytest -c /dev/null -v -n auto examples/models/llama3_2_vision/preprocess/ ``` [ghstack-poisoned]
2 parents 0e72c6f + dbddd11 commit a040302

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/models/llama3_2_vision/preprocess/test_preprocess.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def run_preprocess(
237237
image_tensor, inscribed_size, best_resolution
238238
)
239239
eager_ar = eager_ar.tolist()
240-
assert torch.allclose(reference_image, eager_image)
240+
assert torch.allclose(reference_image, eager_image, rtol=1e-4, atol=1e-4)
241241
assert (
242242
reference_ar == eager_ar
243243
), f"Eager model: expected {reference_ar} but got {eager_ar}"
@@ -248,7 +248,7 @@ def run_preprocess(
248248
image_tensor, inscribed_size, best_resolution
249249
)
250250
exported_ar = exported_ar.tolist()
251-
assert torch.allclose(reference_image, exported_image)
251+
assert torch.allclose(reference_image, exported_image, rtol=1e-4, atol=1e-4)
252252
assert (
253253
reference_ar == exported_ar
254254
), f"Exported model: expected {reference_ar} but got {exported_ar}"
@@ -259,7 +259,7 @@ def run_preprocess(
259259
et_image, et_ar = executorch_module.forward(
260260
(image_tensor, inscribed_size, best_resolution)
261261
)
262-
assert torch.allclose(reference_image, et_image)
262+
assert torch.allclose(reference_image, et_image, rtol=1e-4, atol=1e-4)
263263
assert (
264264
reference_ar == et_ar.tolist()
265265
), f"Executorch model: expected {reference_ar} but got {et_ar.tolist()}"

0 commit comments

Comments
 (0)