mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
{Model Manager] Backend update to support custom save locations and configs
This commit is contained in:
parent
cd64511f24
commit
b1a53c8ef0
@ -402,11 +402,11 @@ class InvokeAIWebServer:
|
|||||||
@socketio.on('convertToDiffusers')
|
@socketio.on('convertToDiffusers')
|
||||||
def convert_to_diffusers(model_to_convert: dict):
|
def convert_to_diffusers(model_to_convert: dict):
|
||||||
try:
|
try:
|
||||||
if (model_info := self.generate.model_manager.model_info(model_name=model_to_convert['name'])):
|
if (model_info := self.generate.model_manager.model_info(model_name=model_to_convert['model_name'])):
|
||||||
if 'weights' in model_info:
|
if 'weights' in model_info:
|
||||||
ckpt_path = Path(model_info['weights'])
|
ckpt_path = Path(model_info['weights'])
|
||||||
original_config_file = Path(model_info['config'])
|
original_config_file = Path(model_info['config'])
|
||||||
model_name = model_to_convert["name"]
|
model_name = model_to_convert['model_name']
|
||||||
model_description = model_info['description']
|
model_description = model_info['description']
|
||||||
else:
|
else:
|
||||||
self.socketio.emit(
|
self.socketio.emit(
|
||||||
@ -427,6 +427,12 @@ class InvokeAIWebServer:
|
|||||||
f'{model_name}_diffusers'
|
f'{model_name}_diffusers'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if model_to_convert['save_location'] == 'root':
|
||||||
|
diffusers_path = Path(Globals.root, 'models', 'converted_ckpts', f'{model_name}_diffusers')
|
||||||
|
|
||||||
|
if model_to_convert['save_location'] == 'custom' and model_to_convert['custom_location'] is not None:
|
||||||
|
diffusers_path = Path(model_to_convert['custom_location'], f'{model_name}_diffusers')
|
||||||
|
|
||||||
if diffusers_path.exists():
|
if diffusers_path.exists():
|
||||||
shutil.rmtree(diffusers_path)
|
shutil.rmtree(diffusers_path)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user