When saving model settings, only save the settings for the current loader

This commit is contained in:
oobabooga 2023-08-01 06:10:09 -07:00
parent ebb4f22028
commit 959feba602
2 changed files with 8 additions and 6 deletions

View file

@ -3,7 +3,7 @@ from pathlib import Path
import yaml
from modules import shared, ui
from modules import loaders, shared, ui
def get_model_settings_from_yamls(model):
@ -126,10 +126,12 @@ def save_model_settings(model, state):
user_config[model_regex] = {}
for k in ui.list_model_elements():
user_config[model_regex][k] = state[k]
shared.model_config[model_regex][k] = state[k]
if k == 'loader' or k in loaders.loaders_and_params[state['loader']]:
user_config[model_regex][k] = state[k]
shared.model_config[model_regex][k] = state[k]
output = yaml.dump(user_config, sort_keys=False)
with open(p, 'w') as f:
f.write(yaml.dump(user_config, sort_keys=False))
f.write(output)
yield (f"Settings for {model} saved to {p}")