From 359992a7aa204f5b679e72842a441f23ed3124cf Mon Sep 17 00:00:00 2001 From: Anai-Guo Date: Sat, 5 Sep 2026 12:15:49 -0700 Subject: [PATCH] fix(bnn_pynq): reload the best checkpoint for the QCDQ ONNX export too The gate that reloads `best.tar` before exporting ORed `args.export_qonnx` with itself, so running with only `--export_qcdq_onnx` skipped the reload and exported the last-epoch weights instead of the best checkpoint. The two other places in this file that gate on "some ONNX export was requested" already use `export_qonnx or export_qcdq_onnx`. Signed-off-by: Anai-Guo --- src/brevitas_examples/bnn_pynq/trainer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/brevitas_examples/bnn_pynq/trainer.py b/src/brevitas_examples/bnn_pynq/trainer.py index 4ef317cd1..d985cafbb 100644 --- a/src/brevitas_examples/bnn_pynq/trainer.py +++ b/src/brevitas_examples/bnn_pynq/trainer.py @@ -346,7 +346,7 @@ def train_model(self): # training ends if not self.args.dry_run: best_path = os.path.join(self.checkpoints_dir_path, "best.tar") - if self.args.export_qonnx or self.args.export_qonnx: + if self.args.export_qonnx or self.args.export_qcdq_onnx: self.model = self.load_checkpoint(self.model, best_path, strict=True) if self.args.export_qonnx: self.export_qonnx()