Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streamlit: Fix loading of YAML defaults and allow user defaults to be specified in a userconfig_stream… #876

Merged
merged 3 commits into from
Sep 9, 2022

Conversation

TinyBeeman
Copy link
Contributor

@TinyBeeman TinyBeeman commented Sep 9, 2022

  1. I fixed a few places where we weren't loading the default values from YAML.
  2. Simple change to allows a user to create a userconfig_stream.yaml file in the root path which isn't tracked by git, which contains overrides for webui_streamlit.yaml

Example userconfig_stream.yaml

general:
    outdir: /myCustomFolder
    outdir_img2img: /myCustomFolder/i2i
    outdir_txt2img: /myCustomFolder/t2i
    
txt2img:
    cfg_scale: 7.5
    default_sampler: "k_euler_a"
    group_by_prompt: False
    height: 640
    use_GFPGAN: True
    use_RealESRGAN: False
    width: 640

I also added a couple of .gitignore folders for Visual Studio and Visual Code users.

This is mostly a convenience feature so we can drop in custom settings while working on a branch without having to worry about stashing before merging, etc.

@TinyBeeman TinyBeeman changed the title Streamlit: Allow user defaults to be specified in a userconfig_stream… Streamlit: Fix loading of YAML defaults and allow user defaults to be specified in a userconfig_stream… Sep 9, 2022
@ZeroCool940711
Copy link
Contributor

Did you make sure that if options are added or removed from the default config file they are updated in the custom configs for the users?
We don't want users complaining when we add some new options and they can't run the UI after an update.

@@ -53,6 +53,9 @@
warnings.filterwarnings("ignore", category=DeprecationWarning)

defaults = OmegaConf.load("configs/webui/webui_streamlit.yaml")
if (os.path.exists("userconfig_streamlit.yaml")):
user_defaults = OmegaConf.load("userconfig_streamlit.yaml");
defaults = OmegaConf.merge(defaults, user_defaults)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user config file should be next to the default config and not on the root folder, this would make things more organized and easier to direct users to it if they are having problems with it.

@TinyBeeman
Copy link
Contributor Author

Did you make sure that if options are added or removed from the default config file they are updated in the custom configs for the users? We don't want users complaining when we add some new options and they can't run the UI after an update.

I did double check that new options are added: I do an OmegaConf merge, which means it first loads webui_streamlit.yaml, and then it loads the users file if it exists: only options specified in the user settings are updated. So if we add a new setting, and the user doesn't have it, it will load the new setting from webui_streamlit.yaml. Does that make sense?

I am happy to move it to the config folder if you like. I was mimicing the behavior of custom-conda-path.txt, which lives in the root folder. If you'd like this file to live in the config folder, I'll update my PR.

@ZeroCool940711
Copy link
Contributor

LGTM, after the changes.

@ZeroCool940711 ZeroCool940711 merged commit 775942b into Sygil-Dev:dev Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants