From 0ea1b7de5a6755cbf5ff1184ff2e6413874019a2 Mon Sep 17 00:00:00 2001 From: Melih Yilmaz <32707537+melihyilmaz@users.noreply.github.com> Date: Fri, 22 Sep 2023 10:50:56 -0700 Subject: [PATCH] Use config options in model init --- casanovo/denovo/model_runner.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/casanovo/denovo/model_runner.py b/casanovo/denovo/model_runner.py index cbefd849..7549a7a1 100644 --- a/casanovo/denovo/model_runner.py +++ b/casanovo/denovo/model_runner.py @@ -252,16 +252,13 @@ def initialize_model(self, train: bool) -> None: # otherwise use the provided configuration. device = torch.empty(1).device # Use the default device. try: - self.model = Spec2Pep.load_from_checkpoint( - self.model_filename, - map_location=device, - ) - except RuntimeError: self.model = Spec2Pep.load_from_checkpoint( self.model_filename, map_location=device, **model_params, ) + except RuntimeError: + raise RuntimeError("Mismatching parameters between loaded model and config file") def initialize_data_module( self,