-
Notifications
You must be signed in to change notification settings - Fork 27.9k
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
fixes sampler.name; refactored apply_sampler, confirm_sampler, build_sampler_dict; valslist ready to apply when returned from process_axis #4909
Conversation
Tested and seems to work @AUTOMATIC1111 this would be an important fix as its currently broken |
apply_sampler should not build or check for errors, it should only apply the sampler to the process handed to it. process_axis, when axis was "Samplers", did not finish processing the valslist. For this, I implemented build_samplers_valslist. build_samplers_dict was being called twice, once in apply, and once in confirm_samplers, I pulled this out from confirm and put it into an if opt.label == samplers block in process_axis build_samplers_dict was modified to return a dictionary with a different structure. I believe this new structure makes it more clear for readers. The previous structure was a dictionary where the first key was the lowercase version of sampler.name, and adjacent was a key that was an alias, both set with the same int value, for all samplers. Because dictionaries are now ordered, dict.get(val) would return the first match. Also, this structure did not include the proper name needed by Process.sampler_name. The structure is now {Sampler.name: [Sampler.name.lower(), alias1, ...], } Now you can check if user value is in set of flattened dict.values(), "set(chain(*dict.values()))" and grab Sampler.name from the key directly. The building of valslist, utilizes this structure, function is build_samplers_valslist It iterates through (previously confirmed) user supplied values, steps through each dict.values until it matches, then appends the proper name from key into list
Code now works for aliases from sampler.aliases; and sampler.name; case insensitive. Did a refactor of apply_sampler, confirm_sampler, and build_samplers_dict. |
well done with spotting and fixing the problem but i don't welcome refactors and i disagree with using a dictionary this way; I uploaded my fix so I will be closing this |
Sorry, I had a long week.
Final try to do a pull request. If I screw it up, going to bed.
#4860
Fixes apply_sampler() using name instead of index while respecting the function and keeping case insensitivity.