mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-06-25 06:53:05 +00:00
reduce nesting, better error reporting
This commit is contained in:
parent
591a047204
commit
6e3c59d8b2
@ -87,7 +87,9 @@ class GPT4All():
|
|||||||
else:
|
else:
|
||||||
model_path = model_path.replace("\\", "\\\\")
|
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("\\", "\\\\")
|
model_dest = os.path.join(model_path, model_filename).replace("\\", "\\\\")
|
||||||
if os.path.exists(model_dest):
|
if os.path.exists(model_dest):
|
||||||
print("Found model file at ", model_dest)
|
print("Found model file at ", model_dest)
|
||||||
@ -102,8 +104,6 @@ class GPT4All():
|
|||||||
return GPT4All.download_model(model_filename, model_path)
|
return GPT4All.download_model(model_filename, model_path)
|
||||||
else:
|
else:
|
||||||
raise ValueError("Failed to retrieve model")
|
raise ValueError("Failed to retrieve model")
|
||||||
else:
|
|
||||||
raise ValueError("Invalid model directory")
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def download_model(model_filename: str, model_path: str) -> str:
|
def download_model(model_filename: str, model_path: str) -> str:
|
||||||
|
Loading…
Reference in New Issue
Block a user