zyin055 / config-presets Goto Github PK
View Code? Open in Web Editor NEWExtension for Automatic1111
License: MIT License
Extension for Automatic1111
License: MIT License
I think being able to put prompt and negative prompt to the config preset would be helpful as some checkpoint models actually require you to enter specific positive or negative prompts to make it work correctly.
https://civitai.com/models/1250/the-simpsons this one for example needs "asim style" for the prompt to make it work.
I don't know about anyone else, but I definitely struggle with remembering all the quirks of some of the models I have and this feature would save lot of looking stuff up when I could just have it in a preset already for me.
And I think it would also enhance this suggestion: #4
Although I'm fine without it autoswitching the models, I can do that myself and just name the preset after the model I should be using for each preset
There's support for SD upscale script but can the same be added for Ultimate SD upscale?
https://github.com/Coyote-A/ultimate-upscale-for-automatic1111
The latest commit of SD.Next makes Config Preset's UI no longer visible under the image previewer.
Apparently the cause of this is being anchored to the row of buttons that display after an image is generated (Show, Save, Zip, Delete, etc).
These buttons aren't displayed until an image is generated.
Suggest anchoring elsewhere.
I found the following error in sd.next:
[ERROR][Config Presets] The txt2img component 'txt2img_enable_hr' could not be processed. This may be because you are running an outdated version of the Config-Presets extension, or you included a component ID in the custom tracked components config file that does not exist, no longer exists (if you updated an extension), or is an invalid component (if this is the case, you need to manually edit the config file at E:\sd.next\automatic\extensions\Config-Presets\config-txt2img-custom-tracked-components.txt or just delete it so it resets to defaults). This extension will not work until this issue is resolved.
As a result config preset ui is not visible
Originally posted by @steto123 in #50 (comment)
Could you extend list of saved/restored options with txt2img_hr_resize_x and txt2img_hr_resize_y.
The patch is:
diff --git a/scripts/config_presets.py b/scripts/config_presets.py
index c4df7cc..162ac84 100644
--- a/scripts/config_presets.py
+++ b/scripts/config_presets.py
@@ -350,6 +350,8 @@ class Script(scripts.Script):
"txt2img_restore_faces",
"txt2img_enable_hr",
"txt2img_hr_scale",
+ "txt2img_hr_resize_x",
+ "txt2img_hr_resize_y",
"txt2img_hr_upscaler",
"txt2img_hires_steps",
"txt2img_denoising_strength",
Saving new styles doesn't require restarting the UI, why does saving a new config restart the UI? Can it not add the requisite lines to the JSON file, and refresh its list without needing a full UI restart?
Thanks for this extension, certainly something I was looking for.
It'd be awesome if it was possible to save the width and height listed under Highres Fix, currently it's only possible to save the Upscale ratio but in my use case I would prefer to use the width and height instead as the ratio doesn't get me to the exact dimensions I need.
hi,
I updated the extension today to find out it wiped all the settings i had carefully customized for my needs. That's less than convenient.
May be not updating the config.json when updating the script would be a good idea.
It would be great if ControlNet support was added. So I can easily save ControlNet's preprocessor, model, weight, Ending Control Step. I tried following the instructions to create the custom entries, but failed. Thank you!
Good afternoon. Please tell me how can I save the settings for the "Tiled Diffusion & VAE" and "StableSR" extensions?
[ERROR][Config Presets] The txt2img component 'txt2img_restore_faces' could not be processed. This may be because you are running an outdated version of the Config-Presets extension, or you included a component ID in the custom tracked components config file that does not exist, no longer exists (if you updated an extension), or is an invalid component (if this is the case, you need to manually edit the config file at J:\SDWebUI\extensions\Config-Presets\config-txt2img-custom-tracked-components.txt or just delete it so it resets to defaults). This extension will not work until this issue is resolved.
[ERROR][Config Presets] The img2img component 'img2img_restore_faces' could not be processed. This may be because you are running an outdated version of the Config-Presets extension, or you included a component ID in the custom tracked components config file that does not exist, no longer exists (if you updated an extension), or is an invalid component (if this is the case, you need to manually edit the config file at J:\SDWebUI\extensions\Config-Presets\config-img2img-custom-tracked-components.txt or just delete it so it resets to defaults). This extension will not work until this issue is resolved.
deleting the settings txt doesn't work
It would be nice if the script selection and SD upscale options would be saved too. I think that would be reasonable, because its a "core"-script? I get the idea that scripts are not saved, because they are too individual. But I think the SD upscale script is the most used and it would be helpful if those settings (overlap, scale factor and upscaler) would be stored in the preset too.
I installed from the Extensions tab and got the following error, it still occurs after restarting.
Applying xformers cross attention optimization.
Model loaded.
[ERROR] Config Presets: Could not find config file at '/home/ubuntu-wsl2/git/stable-diffusion-webui/extensions/Config-Presets\config.json'. The Config Presets dropdown will not work!
Error running after_component: /home/ubuntu-wsl2/git/stable-diffusion-webui/extensions/Config-Presets/scripts/config_presets.py
Traceback (most recent call last):
File "/home/ubuntu-wsl2/git/stable-diffusion-webui/modules/scripts.py", line 381, in after_component
script.after_component(component, **kwargs)
File "/home/ubuntu-wsl2/git/stable-diffusion-webui/extensions/Config-Presets/scripts/config_presets.py", line 59, in after_component
for k in self.config_presets:
AttributeError: 'Script' object has no attribute 'config_presets'
[ERROR] Config Presets: Could not find config file at '/home/ubuntu-wsl2/git/stable-diffusion-webui/extensions/Config-Presets\config.json'. The Config Presets dropdown will not work!
Error running after_component: /home/ubuntu-wsl2/git/stable-diffusion-webui/extensions/Config-Presets/scripts/config_presets.py
Traceback (most recent call last):
File "/home/ubuntu-wsl2/git/stable-diffusion-webui/modules/scripts.py", line 381, in after_component
script.after_component(component, **kwargs)
File "/home/ubuntu-wsl2/git/stable-diffusion-webui/extensions/Config-Presets/scripts/config_presets.py", line 59, in after_component
for k in self.config_presets:
AttributeError: 'Script' object has no attribute 'config_presets'
Loaded a total of 0 textual inversion embeddings.
Embeddings:
Running on local URL: http://127.0.0.1:7860
It is possible that other extensions are conflicting, but I am reporting it anyway. It is obvious that it is an excellent extension and we would love to use it ❤.
def load_txt2img_custom_tracked_component_ids() -> list[str]: TypeError: 'type' object is not subscriptable
i can't create a pull request.
from typing import List
and change list[str]
to List[str]
Anybody know how to avoid this error? On latest webui version. Is there a conflict?
[Config-Presets] Changed to: SDXL --- 1024x1024
Traceback (most recent call last):
File "D:\auto1111 SDXL\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 422, in run_predict
output = await app.get_blocks().process_api(
File "D:\auto1111 SDXL\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1323, in process_api
result = await self.call_function(
File "D:\auto1111 SDXL\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1051, in call_function
prediction = await anyio.to_thread.run_sync(
File "D:\auto1111 SDXL\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "D:\auto1111 SDXL\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "D:\auto1111 SDXL\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 807, in run
result = context.run(func, *args)
File "D:\auto1111 SDXL\stable-diffusion-webui\extensions\Config-Presets\scripts\config_presets.py", line 1138, in func
new_setting_map[component_id] = modules.sd_samplers.samplers_map[new_value.lower()]
AttributeError: 'int' object has no attribute 'lower'
I would like for user presets to not be lost every time I check for updates in extensions tab.
I've been using this ext for a while and I really like it!
However, here's the thing: if i want to change the preset, it's ok. But if I want to use the preset which is already there (the one showing in the box), it does not apply to my WebUI.
I dont know if this is a bug or not. Sometimes I changed some settings in my WebUI and then I want to use the preset I usually use. So I have to change to another preset then change it back. Because if you see a preset shown in the box, it cannot be applied by just clicking it.
Is it possible that, whatever preset I choose in the pull-down menu, it just applies.
I'm using the lastest A1111 SD webui (1.4.0) with python: 3.10.11 • torch: 2.0.1+cu118 • xformers: N/A • gradio: 3.32.0
That area under the preview has changed and the config ui doesn't show up anymore.
It is known that if the aspect ratio of the original resolution and the resolution of the highres fix are aligned, it is possible to fix the highres without changing the composition.
For example, the workflow is as follows. If I get good results with 768x512, I turn on highres fix and set first pass to 768x512 and resolution to 1536x1024.
With my list of tracked elements growing very large, it has inspried me to request a new feature to make selecting which elements to store in any configuration much easier and far less painful. This would require a bit of UI work, here is an example of what I'm thinking:
Unchecking the main group header would enable/disable all the checkmarks for that group. Otherwise, you have to comb through dozens of checkmarks and disable a lot of things, for instance, if you want to save gen params but no control net, or vice versa. Thoughts?
I have two new A1111 installs (Linux) but on one machine, Config-Presets does not show up beneath the image preview area, but the other machine does. Any idea why this might be happening?
Hi there -- great work on this plugin, I believe it is absolutely essential for any serious workflow with A1111. Only one thing persistently gives me headaches, and that is that the script list is stored as an index value, which easily changes whenever you add or remove plugins, or revert to older configurations of A1111, etc. This results in exceptions or the wrong script being selected, which is a dealbreaker for workflow.
It would be great if the script could be stored as a string field with the script's name (as these do not change often if at all), which would be used to search the existing installed scripts and select the first instance of the script with the stored name that is found. If the name is not found, it would fail gracefully. This would prevent problems with name collisions (if that's even possible) and with missing scripts due to configuration (although the plugin won't load properly if the script is missing and being tracked, which is a separate issue).
The logic should include a fallback for older configuration files that are still using index values, a simple test for an int should suffice, otherwise the string logic is used. For upgrading purposes, it could be as simple as loading in a known good configuration where all configurations are loading properly, and then rewriting the configurations one by one to update to the string field. An Update all button would be great which performs a search and replace, although diligent users can search and replace themselves in a text editor.
Any thoughts? I'm not as familiar with the backend code to know whether there are any obstacles to implementing this, but I think it would provide a much improved and more stable experience. thx
I've just loaded the LATEST version of this extension on the LATEST version of Automatic1111 and the extensions refuses to load up on restart. The message in the console is:
[ERROR][Config Presets] The txt2img component 'script_txt2img_adetailer_ad_inpaint_full_res' could not be processed. This may be because you are running an outdated version of the Config-Presets extension, you included a component ID in the custom tracked components config file that does not exist, it no longer exists (if you updated an extension or Automatic1111), or is an invalid component (if this is the case, you need to manually edit the config file at C:\AI\stable-diffusion-webui\extensions\Config-Presets\config-txt2img-custom-tracked-components.txt or just delete it so it resets to defaults). This extension will not work until this issue is resolved.
It seems to be caused by the aDetailer Section on these entries:
script_txt2img_adetailer_ad_inpaint_full_res
script_txt2img_adetailer_ad_inpaint_full_res_padding
script_txt2img_adetailer_ad_inpaint_full_res_2nd
script_txt2img_adetailer_ad_inpaint_full_res_padding_2nd
Is this a known problem??
First of all, THANK YOU for this plugin. It is absolutely essential for any kind of reasonable workflow for complex projects. I have been setting up custom tracked elements with great success and using it religiously on a big project.
I am currently futzing around with a new custom script but it doesn't interact with the html in any way and is an img2img script. Today, I tried to add a txt2img preset for the first time since updating with the latest code from two days ago, and nothing happens, no change to the html, no list of tracked elements, no errors in the console. Img2img UI works fine still. Any thoughts?
Thanks!
Edit the file automatic\extensions\Config-Presets\scripts\config_presets.py
Hit Ctrl+F and find self.txt2img_component_ids
Change
txt2img_hr_upscaler
to txt2img_sampling_alt
and
txt2img_hires_steps
to txt2img_steps_alt
This is a great idea, a feature I've wanted for a while. I've installed it and so far just I'm just using the default presets. Unfortunately when I do, it does not change the output width/height (but does set the other generation params). I'm not sure what to do to make it work. I've disabled it for now but hoping for some help.
I have presets for XYZ-plot with samplers and steps. It worked correctly.
In the actual version of WebUI this extension does not work correctly: fields X/Y/Z type is filled via presets, but X/Y/Z values not filling and are kept empty. No any error message in the console.
• version: v1.3.2
• python: 3.10.6
• torch: 2.0.1+cu118
• xformers: N/A
• gradio: 3.32.0
• checkpoint: 099e07547a
• Config-Presets f91c65b
Hi!
Would it be possible to add option to activate "Restore faces" on txt2img and img2img ?
That would be almost full set of preset settings and just great.
Thanks for your work.
FYI, in case you didn't know, Config Presets is broken in A1111 version 1.6, because they removed the Restore faces checkbox and changed the enable HR Fix checkbox to be triggered by the state of the new expander. I found that these element ids were hardcoded into the plugin, as shown in this code:
`def init(self, *args, **kwargs):
super().init(*args, **kwargs)
# Load custom tracked components
txt2img_custom_tracked_components_ids = load_txt2img_custom_tracked_component_ids()
img2img_custom_tracked_components_ids = load_img2img_custom_tracked_component_ids()
# These are the settings from the UI that are saved for each preset
self.txt2img_component_ids = [
"txt2img_sampling",
"txt2img_steps",
"txt2img_width",
"txt2img_height",
"txt2img_batch_count",
"txt2img_batch_size",
"txt2img_restore_faces",
"txt2img_enable_hr",
"txt2img_hr_scale",
"txt2img_hr_upscaler",
"txt2img_hires_steps",
"txt2img_denoising_strength",
"txt2img_cfg_scale",
]
self.txt2img_component_ids += txt2img_custom_tracked_components_ids # add the custom tracked components
self.img2img_component_ids = [
"img2img_sampling",
"img2img_steps",
"img2img_width",
"img2img_height",
"img2img_batch_count",
"img2img_batch_size",
"img2img_cfg_scale",
"img2img_denoising_strength",
"img2img_restore_faces",
]
self.img2img_component_ids += img2img_custom_tracked_components_ids # add the custom tracked components
# Mapping between component labels and the actual components in ui.py
self.txt2img_component_map = {k: None for k in self.txt2img_component_ids} # gets filled up in the after_component() method
self.img2img_component_map = {k: None for k in self.img2img_component_ids} # gets filled up in the after_component() method
# Load txt2img and img2img config files
self.txt2img_config_presets = load_txt2img_config_file()
self.img2img_config_presets = load_img2img_config_file()
`
I was able to disable the necessary fields to get up and running, but for end user experience, you may want to consider not hardcoding any element ids at all and using the configuration file for all relevant IDs. That way, if something fundamental changes in A1111, a user can go in to their config file and disable as necessary to get back up and running without having to open up plugin code.
Cheers
Hi all,
Don't know if any of you have encountered this, but ConfigPresets and ControlNet do not play 100% nice together. After setting the ControlNet components with ConfigPresets, everything works perfectly, but only with a workaround (Check and recheck the Pixel Perfect checkbox) due to some of the change listener behavior on ControlNet's components. I recently logged an issue in the ControlNet repo to see if it was something they could fix, and they said no, not for now at least.
Curious to hear your thoughts whether there's anything we could do on the ConfigPresets side, maybe we could collaborate to support ControlNet specifically, since it is one of A1111's most powerful features.
Let me know what you think, here is the issue with all the details:
Mikubill/sd-webui-controlnet#1297
Currently, the list of component IDs that this extension can control is hardcoded in the script.
This should be made into a config file, so users can customise what they want to store, such as parameters of extensions.
This will also satisfy issues #31 #32 (but maybe not #28 & #29 because they are more complicated).
The extension is working great, tyvm! I have a couple feature requests:
In A1111, there's a refresh button next to the Checkpoints dropdown list.
Config-Presets could implement the same UI, so that when we change the config.json
, we can just click a button to reload the entries without having to restart the whole thing.
Selecting a Style that has either a positive or negative prompt longer than 75 characters results in the following error:
RuntimeError: The expanded size of the tensor (77) must match the existing size (154) at non-singleton dimension 0. Target sizes: [77, 768]. Tensor sizes: [154, 768]
As a workaround, you have to click the Apply select styles to the prompt button
This only happens if you load a Config Preset first. If you don't load a Config Preset, the Style will work as expected.
when boot on the newest webui
[ERROR][Config-Presets] The component 'txt2img_height' no longer exists in the Web UI. Try updating the Config-Presets extension. This extension will not work until this issue is resolved.
[ERROR][Config-Presets] The component 'img2img_steps' no longer exists in the Web UI. Try updating the Config-Presets extension. This extension will not work until this issue is resolved.
Can you add config-presets to the Train->Train page also?
What time frame is this, two weeks ago. -> https://github.com/gradio-app/gradio/discussions/2769
updated last week -> https://gist.github.com/Gerschel/51a0e2a9089795ff399f9e346ae68085
You obviously copied my shit, you say so, just because I went from byte code to clear code in the public doesn't mean I don't have it documented that I am the developer. I have my time stamped comitts.
I'm using additional extensions like Dynamic Thresholding, Detection Detailer . Is there a way to include them and save them?
Hi, if i choose option with hires.fix. all changed perfectly, but hires steps didn`t apply.
First off, I was thinking about wanting a feature like this for a while, I'm glad you made it!
So, feature request: right now the controllable options are limited - in particular I'd love if you add an option to set the model by name.
For example, I'd want an SD 2.1
preset that instantly changes model to SD 2.1 and width/height to 768.
There's a lot of other potentially useful options worth adding as well, so I'll just reference my own Infinite-Grid extension's option list for your consideration - https://github.com/mcmonkeyprojects/sd-infinity-grid-generator-script/blob/master/scripts/infinity_grid.py#L147-L173
Feel free to use it as a reference for ideas and/or code for adding new options.
In my opinion the config.json
file should be added to .gitignore
, so that users' changes won't be overwritten.
If needed, there can also be a config.json.example
file so that users know how to configure it even if they've modified the config.json
file.
Hello there,
I was wondering if it would be at all possible to add the option to save the Upscaler that is selected.
Having read some of the other requests noted below I appreciate that you are reluctant to add additional items, but I thought it would be worth asking anyway.
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.