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.
This commit is contained in:
Lincoln Stein 2023-02-11 15:53:41 -05:00
parent d28a486769
commit d0e6a57e48

View File

@ -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)