From c4027a25c6d7e83532381fa876909ee82a1d4a09 Mon Sep 17 00:00:00 2001 From: Maja Jablonska <majajjablonska@gmail.com> Date: Tue, 21 Nov 2023 23:41:57 +1100 Subject: [PATCH] Remove unnecessary checks --- combo/modules/model.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/combo/modules/model.py b/combo/modules/model.py index 223bacc..76e83be 100644 --- a/combo/modules/model.py +++ b/combo/modules/model.py @@ -447,21 +447,13 @@ class Model(Module, pl.LightningModule, FromParameters): vocabulary and the trained weights. """ if config is None: - try: - with open(os.path.join(serialization_dir, 'config.json'), 'r') as f: - config = json.load(f) - except FileNotFoundError: - with open(os.path.join(serialization_dir, 'model/config.json'), 'r') as f: - config = json.load(f) + with open(os.path.join(serialization_dir, 'config.json'), 'r') as f: + config = json.load(f) elif isinstance(config, str) or isinstance(config, PathLike): with open(config, 'r') as f: config = json.load(f) weights_file = weights_file or os.path.join(serialization_dir, 'weights.th') - if not os.path.exists(weights_file): - weights_file = os.path.join(serialization_dir, 'model/weights.th') - if not os.path.exists(weights_file): - raise ConfigurationError("weights.th not in " + serialization_dir + " or " + serialization_dir + "/model") # Peak at the class of the model. model_type = ( -- GitLab