Trying to copy an ImagePreset is currently failing. _DEFAULT has settings for legacy, uncond_scale, cfg_rescale, and noise_schedule. _TYPE_MAPPING does not have those entries.
This causes us to hand in settings (pulled from default) during copy that trigger during setitem
def __setitem__(self, key: str, value: Any):
if key not in self._TYPE_MAPPING: # _DEFAULT's that have no _TYPE_MAPPING make this explode during .copy()!
raise ValueError(f"'{key}' is not a valid setting")
Solution
Updating _TYPE_MAPPING with entries for the _DEFAULT's that it was missing.
Adding a preset.copy() line during tests to prevent setting _DEFAULT's without a corresponding a _TYPE_MAPPING
Also apparently the pre-commit thought _high_level.py needed some reformatting....
Bug Explanation
Trying to
copy
anImagePreset
is currently failing._DEFAULT
has settings forlegacy
,uncond_scale
,cfg_rescale
, andnoise_schedule
._TYPE_MAPPING
does not have those entries.This causes us to hand in settings (pulled from default) during copy that trigger during setitem
Solution
preset.copy()
line during tests to prevent setting _DEFAULT's without a corresponding a _TYPE_MAPPING