Skip to content

Commit

Permalink
remove deprecated CLI arguments
Browse files Browse the repository at this point in the history
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
  • Loading branch information
chrisrude committed May 26, 2023
1 parent 6459a12 commit 1a44a43
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 134 deletions.
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

131 changes: 0 additions & 131 deletions src/oobabot/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1a44a43

Please sign in to comment.