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

Bugfix/key valuerror after copy #25

Merged
merged 3 commits into from
Dec 3, 2023

Conversation

agentd00nut
Copy link
Contributor

Bug Explanation

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....

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.

None yet

2 participants