reduce nesting, better error reporting

pull/726/head
Konstantin Gukov 1 year ago committed by Richard Guo
parent a067f38544
commit 2b6fb7b95e

@ -87,7 +87,9 @@ class GPT4All():
else:
model_path = model_path.replace("\\", "\\\\")
if os.path.exists(model_path):
if not os.path.exists(model_path):
raise ValueError("Invalid model directory: {}".format(model_path))
model_dest = os.path.join(model_path, model_filename).replace("\\", "\\\\")
if os.path.exists(model_dest):
print("Found model file at ", model_dest)
@ -102,8 +104,6 @@ class GPT4All():
return GPT4All.download_model(model_filename, model_path)
else:
raise ValueError("Failed to retrieve model")
else:
raise ValueError("Invalid model directory")
@staticmethod
def download_model(model_filename: str, model_path: str) -> str:

Loading…
Cancel
Save