From 1a44a4300aae97530c04e3a79959dbfa464dc0d7 Mon Sep 17 00:00:00 2001 From: Chris Rude Date: Fri, 26 May 2023 08:38:31 -0700 Subject: [PATCH] remove deprecated CLI arguments These have been removed: - `diffusion_steps` - `image_height` - `image_width` - `stable_diffusion_sampler` - `sd_negative_prompt` - `sd_negative_prompt_nsfw` All of these settings are still changeable via the config file. dot update for ryaml --- poetry.lock | 6 +- src/oobabot/settings.py | 131 ---------------------------------------- 2 files changed, 3 insertions(+), 134 deletions(-) diff --git a/poetry.lock b/poetry.lock index 9b215e49..b7b630b7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -933,13 +933,13 @@ files = [ [[package]] name = "ruamel-yaml" -version = "0.17.27" +version = "0.17.28" description = "ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order" optional = false python-versions = ">=3" files = [ - {file = "ruamel.yaml-0.17.27-py3-none-any.whl", hash = "sha256:c4ffffc972d35927e715683fe1e2e47fa2aebb26ce67fe75e599fb84f115f20b"}, - {file = "ruamel.yaml-0.17.27.tar.gz", hash = "sha256:cad7e3917da5c321658479f417320443b073e7b272033c799ba52e441d561ae5"}, + {file = "ruamel.yaml-0.17.28-py3-none-any.whl", hash = "sha256:823aff68f88260805049d6a4825e36cb7f1e273a7dd8f391e7b35a16a67a30ea"}, + {file = "ruamel.yaml-0.17.28.tar.gz", hash = "sha256:3bf6df1c481d2463a633be6ee86e8aece941bb3298a9a0cd6d0865f47b1ddce6"}, ] [package.dependencies] diff --git a/src/oobabot/settings.py b/src/oobabot/settings.py index 28d99ccd..a691de3c 100644 --- a/src/oobabot/settings.py +++ b/src/oobabot/settings.py @@ -622,137 +622,6 @@ def __init__(self): ) ) - self._add_deprecated_settings() - - def _add_deprecated_settings(self) -> None: - ########################################################### - # Deprecated Settings - # These used to be part of the Stable Diffusion section, - # but now are covered in the stable_diffusion->request_params - # section of the config.yml file. - # - # These are still here for backwards compatibility, but - # will be removed in a future release. - # - # They're being moved since they're redundant with the - # request_params values, and it's confusing to have those - # set in two separate places. - # - # The settings won't be written to the config.yaml template, - # as they're already covered in the request_params section. - - def set_sd_parm(param: str, value: oesp.SettingValueType): - if not value: - return - setting = self.stable_diffusion_settings.get_setting("request_params") - - # get returns a copy of the settings dict, so we need to - # push it back after we make a change - setting_dict = setting.get() - setting_dict[param] = value - setting.set_value(setting_dict) - - self.deprecated_settings = oesp.ConfigSettingGroup( - "Deprecated Settings", - include_in_yaml=False, - description="These settings are deprecated and will be removed in " - + "a future release. Please set them with config.yml instead.", - ) - self.setting_groups.append(self.deprecated_settings) - - self.deprecated_settings.add_setting( - oesp.ConfigSetting[int]( - name="diffusion_steps", - default=0, - description_lines=[ - textwrap.dedent( - """ - Number of diffusion steps to take when generating an image. - """ - ) - ], - fn_on_set=lambda x: set_sd_parm("steps", int(x)), - ) - ) - self.deprecated_settings.add_setting( - oesp.ConfigSetting[int]( - name="image_height", - default=0, - description_lines=[ - textwrap.dedent( - """ - Size of images to generate. This is the height of the image - in pixels. - """ - ) - ], - fn_on_set=lambda x: set_sd_parm("height", int(x)), - ) - ) - self.deprecated_settings.add_setting( - oesp.ConfigSetting[int]( - name="image_width", - default=0, - description_lines=[ - textwrap.dedent( - """ - Size of images to generate. This is the width of the image - in pixels. - """ - ) - ], - fn_on_set=lambda x: set_sd_parm("width", int(x)), - ) - ) - self.deprecated_settings.add_setting( - oesp.ConfigSetting[str]( - name="stable_diffusion_sampler", - default="", - description_lines=[ - textwrap.dedent( - """ - Sampler to use when generating images. If not specified, - the one set on the AUTOMATIC1111 server will be used. - """ - ) - ], - cli_args=["--stable-diffusion-sampler", "--sd-sampler"], - fn_on_set=lambda x: set_sd_parm("sampler", str(x)), - ) - ) - self.deprecated_settings.add_setting( - oesp.ConfigSetting[str]( - name="sd_negative_prompt", - default="", - description_lines=[ - textwrap.dedent( - """ - Negative prompt to use when generating images. This will - discourage Stable Diffusion from generating images with the - specified content. By default, this is set to follow - Discord's TOS. - """ - ) - ], - fn_on_set=lambda x: set_sd_parm("negative_prompt", str(x)), - ) - ) - self.deprecated_settings.add_setting( - oesp.ConfigSetting[str]( - name="sd_negative_prompt_nsfw", - default="", - description_lines=[ - textwrap.dedent( - """ - Negative prompt to use when generating images in a channel - marked as 'Age-Restricted'. - """ - ) - ], - fn_on_set=lambda x: set_sd_parm("negative_prompt_nsfw", str(x)), - ) - ) - META_INSTRUCTION = ( "\n\n" + "# " * 30