From d0e6a57e48c9c09da417eb1fee4bd62b538bb27e Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Sat, 11 Feb 2023 15:53:41 -0500 Subject: [PATCH] make inpaint model conversion work Fixed a couple of bugs: 1. The original config file for the ckpt file is derived from the entry in `models.yaml` rather than relying on the user to select. The implication of this is that V2 ckpt models need to be assigned `v2-inference-v.yaml` when they are first imported. Otherwise they won't convert right. Note that currently V2 ckpts are imported with `v1-inference.yaml`, which isn't right either. 2. Fixed a backslash in the output diffusers path, which was causing load failures on Linux. Remaining issues: 1. The radio buttons for selecting the model type are nonfunctional. It feels to me like these should be moved into the dialogue for importing ckpt/safetensors files, because this is where the algorithm needs help from the user. 2. The output diffusers model is written into the same directory as the input ckpt file. The CLI does it differently and stores the diffusers model in `ROOTDIR/models/converted-ckpts`. We should settle on one way or the other. --- invokeai/backend/invoke_ai_web_server.py | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/invokeai/backend/invoke_ai_web_server.py b/invokeai/backend/invoke_ai_web_server.py index dda6ee2df2..24b48f2fbb 100644 --- a/invokeai/backend/invoke_ai_web_server.py +++ b/invokeai/backend/invoke_ai_web_server.py @@ -422,26 +422,10 @@ class InvokeAIWebServer: original_config_file = Path( Globals.root, original_config_file) - if model_to_convert['model_type'] == 'inpainting': - original_config_file = Path( - 'configs', - 'stable-diffusion', - 'v1-inpainting-inference.yaml' - ) - - if model_to_convert['model_type'] == '2': - original_config_file = Path( - 'configs', - 'stable-diffusion', - 'v2-inference-v.yaml' - ) - - if model_to_convert['model_type'] == 'custom' and model_to_convert['custom_config'] is not None: - original_config_file = Path( - model_to_convert['custom_config']) - diffusers_path = Path( - f'{ckpt_path.parent.absolute()}\\{model_name}_diffusers') + ckpt_path.parent.absolute(), + f'{model_name}_diffusers' + ) if diffusers_path.exists(): shutil.rmtree(diffusers_path)