diff --git a/jobs/process/BaseSDTrainProcess.py b/jobs/process/BaseSDTrainProcess.py index 80043ae5..dbe1010c 100644 --- a/jobs/process/BaseSDTrainProcess.py +++ b/jobs/process/BaseSDTrainProcess.py @@ -312,6 +312,7 @@ class BaseSDTrainProcess(BaseTrainProcess): if self.trigger_word is not None and not is_reg: prompt = self.sd.inject_trigger_into_prompt( prompt, + trigger=self.trigger_word, add_if_not_present=True, ) conditioned_prompts.append(prompt) diff --git a/toolkit/stable_diffusion_model.py b/toolkit/stable_diffusion_model.py index f4b7bb32..704d3c00 100644 --- a/toolkit/stable_diffusion_model.py +++ b/toolkit/stable_diffusion_model.py @@ -698,6 +698,7 @@ class StableDiffusion: return prompt output_prompt = prompt default_replacements = ["[name]", "[trigger]"] + num_times_trigger_exists = prompt.count(trigger) replace_with = trigger if to_replace_list is None: @@ -714,7 +715,7 @@ class StableDiffusion: output_prompt = output_prompt.replace(to_replace, replace_with) # see how many times replace_with is in the prompt - num_instances = prompt.count(replace_with) + num_instances = output_prompt.count(replace_with) if num_instances == 0 and add_if_not_present: # add it to the beginning of the prompt