mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2024-11-25 01:34:38 +01:00
Include comments in config.yaml even when converting from config.json
This commit is contained in:
parent
26042b1e26
commit
45f99ab48a
@ -68,6 +68,7 @@ if "%update_branch%"=="" (
|
||||
@copy sd-ui-files\scripts\on_sd_start.bat scripts\ /Y
|
||||
@copy sd-ui-files\scripts\check_modules.py scripts\ /Y
|
||||
@copy sd-ui-files\scripts\get_config.py scripts\ /Y
|
||||
@copy sd-ui-files\scripts\config.yaml.sample scripts\ /Y
|
||||
@copy "sd-ui-files\scripts\Start Stable Diffusion UI.cmd" . /Y
|
||||
@copy "sd-ui-files\scripts\Developer Console.cmd" . /Y
|
||||
|
||||
|
@ -51,6 +51,7 @@ cp sd-ui-files/scripts/on_sd_start.sh scripts/
|
||||
cp sd-ui-files/scripts/bootstrap.sh scripts/
|
||||
cp sd-ui-files/scripts/check_modules.py scripts/
|
||||
cp sd-ui-files/scripts/get_config.py scripts/
|
||||
cp sd-ui-files/scripts/config.yaml.sample scripts/
|
||||
cp sd-ui-files/scripts/start.sh .
|
||||
cp sd-ui-files/scripts/developer_console.sh .
|
||||
cp sd-ui-files/scripts/functions.sh scripts/
|
||||
|
@ -6,6 +6,7 @@
|
||||
@copy sd-ui-files\scripts\on_env_start.bat scripts\ /Y
|
||||
@copy sd-ui-files\scripts\check_modules.py scripts\ /Y
|
||||
@copy sd-ui-files\scripts\get_config.py scripts\ /Y
|
||||
@copy sd-ui-files\scripts\config.yaml.sample scripts\ /Y
|
||||
|
||||
if exist "%cd%\profile" (
|
||||
set HF_HOME=%cd%\profile\.cache\huggingface
|
||||
|
@ -5,6 +5,7 @@ cp sd-ui-files/scripts/on_env_start.sh scripts/
|
||||
cp sd-ui-files/scripts/bootstrap.sh scripts/
|
||||
cp sd-ui-files/scripts/check_modules.py scripts/
|
||||
cp sd-ui-files/scripts/get_config.py scripts/
|
||||
cp sd-ui-files/scripts/config.yaml.sample scripts/
|
||||
|
||||
source ./scripts/functions.sh
|
||||
|
||||
|
@ -145,6 +145,18 @@ def setConfig(config):
|
||||
try: # config.yaml
|
||||
config_yaml_path = os.path.join(CONFIG_DIR, "config.yaml")
|
||||
yaml = YAML()
|
||||
|
||||
if not hasattr(config, "_yaml_comment"):
|
||||
config_yaml_sample_path = os.path.join(CONFIG_DIR, "config.yaml.sample")
|
||||
|
||||
if os.path.exists(config_yaml_sample_path):
|
||||
with open(config_yaml_sample_path, "r", encoding="utf-8") as f:
|
||||
commented_config = yaml.load(f)
|
||||
|
||||
for k in config:
|
||||
commented_config[k] = config[k]
|
||||
|
||||
config = commented_config
|
||||
yaml.indent(mapping=2, sequence=4, offset=2)
|
||||
with open(config_yaml_path, "w", encoding="utf-8") as f:
|
||||
yaml.dump(config, f)
|
||||
|
Loading…
Reference in New Issue
Block a user