Aedial / novelai-api

Python API for the NovelAI REST API
https://aedial.github.io/novelai-api/
MIT License
132 stars 15 forks source link

Bugfix/key valuerror after copy #25

Closed agentd00nut closed 11 months ago

agentd00nut commented 11 months ago

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