From 3b2820361611102ae1e2f29e47525f55998b5288 Mon Sep 17 00:00:00 2001 From: Florian Mausolf Date: Mon, 24 Nov 2025 16:59:22 +0100 Subject: [PATCH] error when no checkpoint exists --- src/gatohep/models.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gatohep/models.py b/src/gatohep/models.py index 1e09743..57a40b3 100644 --- a/src/gatohep/models.py +++ b/src/gatohep/models.py @@ -475,7 +475,10 @@ def restore(self, path: str): checkpoint.restore(manager.latest_checkpoint).expect_partial() print(f"INFO: model restored from {manager.latest_checkpoint}") else: - print(f"INFO: no checkpoint found in {path}, starting fresh") + raise FileNotFoundError( + f"No checkpoint found under '{path}'. " + "Make sure the path points to a directory with saved checkpoints." + ) def get_effective_boundaries_1d( self, @@ -915,7 +918,10 @@ def restore(self, path: str): checkpoint.restore(manager.latest_checkpoint).expect_partial() print(f"INFO: model restored from {manager.latest_checkpoint}") else: - print(f"INFO: no checkpoint found in {path}, starting fresh") + raise FileNotFoundError( + f"No checkpoint found under '{path}'. " + "Make sure the path points to a directory with saved checkpoints." + ) def compute_hard_bkg_stats(self, data_dict, signal_labels=None, eps=1e-8): """