Skip to content

Commit

Permalink
Removed weight slider for negative prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
Learwin committed Dec 31, 2023
1 parent a2f23f9 commit d4945f4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
7 changes: 1 addition & 6 deletions extensions-builtin/Lora/ui_edit_user_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,13 @@ def __init__(self, ui, tabname, page):
self.slider_preferred_weight = None
self.edit_notes = None

def save_lora_user_metadata(self, name, desc, sd_version, activation_text, preferred_weight, negative_text, negative_weight, notes):
def save_lora_user_metadata(self, name, desc, sd_version, activation_text, preferred_weight, negative_text, notes):
user_metadata = self.get_user_metadata(name)
user_metadata["description"] = desc
user_metadata["sd version"] = sd_version
user_metadata["activation text"] = activation_text
user_metadata["preferred weight"] = preferred_weight
user_metadata["negative text"] = negative_text
user_metadata["negative weight"] = negative_weight
user_metadata["notes"] = notes

self.write_user_metadata(name, user_metadata)
Expand Down Expand Up @@ -130,7 +129,6 @@ def put_values_into_components(self, name):
user_metadata.get('activation text', ''),
float(user_metadata.get('preferred weight', 0.0)),
user_metadata.get('negative text', ''),
float(user_metadata.get('negative weight', 0.0)),
gr.update(visible=True if tags else False),
gr.update(value=self.generate_random_prompt_from_tags(tags), visible=True if tags else False),
]
Expand Down Expand Up @@ -167,7 +165,6 @@ def create_editor(self):
self.edit_activation_text = gr.Text(label='Activation text', info="Will be added to prompt along with Lora")
self.slider_preferred_weight = gr.Slider(label='Preferred weight', info="Set to 0 to disable", minimum=0.0, maximum=2.0, step=0.01)
self.edit_negative_text = gr.Text(label='Negative prompt', info="Will be added to negative prompts")
self.slider_negative_weight = gr.Slider(label='Preferred negative weight', info="Set to 0 to disable", minimum=0.0, maximum=2.0, step=0.01)
with gr.Row() as row_random_prompt:
with gr.Column(scale=8):
random_prompt = gr.Textbox(label='Random prompt', lines=4, max_lines=4, interactive=False)
Expand Down Expand Up @@ -204,7 +201,6 @@ def select_tag(activation_text, evt: gr.SelectData):
self.edit_activation_text,
self.slider_preferred_weight,
self.edit_negative_text,
self.slider_negative_weight,
row_random_prompt,
random_prompt,
]
Expand All @@ -219,7 +215,6 @@ def select_tag(activation_text, evt: gr.SelectData):
self.edit_activation_text,
self.slider_preferred_weight,
self.edit_negative_text,
self.slider_negative_weight,
self.edit_notes,
]

Expand Down
6 changes: 1 addition & 5 deletions extensions-builtin/Lora/ui_extra_networks_lora.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,9 @@ def create_item(self, name, index=None, enable_filter=True):
item["prompt"] += " + " + quote_js(" " + activation_text)

negative_prompt = item["user_metadata"].get("negative text")
preferred_negative_weight = item["user_metadata"].get("negative weight")
item["negative_prompt"] = quote_js("")
if negative_prompt:
neg_prompt = negative_prompt
if (preferred_negative_weight > 0):
neg_prompt = '(' + negative_prompt + ':' + str(preferred_negative_weight) + ')'
item["negative_prompt"] = quote_js(neg_prompt)
item["negative_prompt"] = quote_js('(' + negative_prompt + ':1)')

sd_version = item["user_metadata"].get("sd version")
if sd_version in network.SdVersion.__members__:
Expand Down

0 comments on commit d4945f4

Please sign in to comment.