From 5ef564a22e8df21a7480d5c8d6e32919f35f14c7 Mon Sep 17 00:00:00 2001 From: Downtown-Case Date: Tue, 6 May 2025 15:03:33 -0500 Subject: [PATCH] Fix model config loading in shared.py for Python 3.13 (#6961) --- modules/shared.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/shared.py b/modules/shared.py index b4dfbfd1..6fd4604c 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -310,11 +310,13 @@ if args.api or args.public_api: add_extension('openai', last=True) # Load model-specific settings -with Path(f'{args.model_dir}/config.yaml') as p: - if p.exists(): - model_config = yaml.safe_load(open(p, 'r').read()) - else: - model_config = {} +p = Path(f'{args.model_dir}/config.yaml') +if p.exists(): + model_config = yaml.safe_load(open(p, 'r').read()) +else: + model_config = {} +del p + # Load custom model-specific settings user_config = load_user_config()