Merge nucleic/sleek-ember-seal-uady into dev

This commit is contained in:
2026-07-30 21:39:52 -07:00
parent 40176d0c76
commit a374fa40b6
3 changed files with 72 additions and 10 deletions
+17
View File
@@ -74,6 +74,23 @@ class CoreMLQuantizationConfigTests(unittest.TestCase):
with self.assertRaisesRegex(DataError, "must not overwrite"):
quantize_coreml._validate_args(args)
def test_calibration_packages_are_removed_after_each_prediction(self):
class FakeDebugger:
def predict_intermediate_outputs(self):
package = Path(tempfile.mkdtemp(suffix=".mlpackage"))
(package / "weight.bin").write_bytes(b"weights")
return {"output": np.array([1.0])}
with tempfile.TemporaryDirectory() as temp:
root = Path(temp) / "calibration"
with quantize_coreml._bounded_calibration_packages(
FakeDebugger,
root,
):
output = FakeDebugger().predict_intermediate_outputs()
self.assertEqual([1.0], output["output"].tolist())
self.assertEqual([], list(root.glob("*.mlpackage")))
if __name__ == "__main__":
unittest.main()