Skip to content
Snippets Groups Projects
Commit c4027a25 authored by Maja Jablonska's avatar Maja Jablonska
Browse files

Remove unnecessary checks

parent 69afc593
No related branches found
No related tags found
1 merge request!46Merge COMBO 3.0 into master
......@@ -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)
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 = (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment