From 6c015eedb3708758f934308f479dea22798fefdd Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Thu, 15 Dec 2022 09:34:10 -0500 Subject: [PATCH] better error reporting when root directory not found (#2001) - The invoke.py script now checks that the root (runtime) directory contains the expected config/models.yaml file and if it doesn't exits with a helpful error message about how to set the proper root. - Formerly the script would fail with a "bad model" message and try to redownload its models, which is not helpful in the case that the root is missing or damaged. --- ldm/invoke/CLI.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ldm/invoke/CLI.py b/ldm/invoke/CLI.py index b5e32d7222..565f21e389 100644 --- a/ldm/invoke/CLI.py +++ b/ldm/invoke/CLI.py @@ -45,9 +45,15 @@ def main(): print('--max_loaded_models must be >= 1; using 1') args.max_loaded_models = 1 - # alert - setting globals here + # alert - setting a global here Globals.try_patchmatch = args.patchmatch + if not os.path.exists(os.path.join(Globals.root,'configs','models.yaml')): + print(f"\n** Error. The file {os.path.join(Globals.root,'configs','models.yaml')} could not be found.") + print(f'** Please check the location of your invokeai directory and use the --root_dir option to point to the correct path.') + print(f'** This script will now exit.') + sys.exit(-1) + print(f'>> InvokeAI runtime directory is "{Globals.root}"') # loading here to avoid long delays on startup