aboutsummaryrefslogtreecommitdiffstats
path: root/modules/processing.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-10-08 10:38:57 +0000
committerAUTOMATIC <16777216c@gmail.com>2022-10-08 10:38:57 +0000
commit706d5944a075a6523ea7f00165d630efc085ca22 (patch)
tree0c995ce428ea62c98fd1677b05fd52c830448acb /modules/processing.py
parent87db6f01cc6b118fe0c82c36c6686d72d060c417 (diff)
downloadstable-diffusion-webui-gfx803-706d5944a075a6523ea7f00165d630efc085ca22.tar.gz
stable-diffusion-webui-gfx803-706d5944a075a6523ea7f00165d630efc085ca22.tar.bz2
stable-diffusion-webui-gfx803-706d5944a075a6523ea7f00165d630efc085ca22.zip
let user choose his own prompt token count limit
Diffstat (limited to 'modules/processing.py')
-rw-r--r--modules/processing.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/processing.py b/modules/processing.py
index f773a30e..d814d5ac 100644
--- a/modules/processing.py
+++ b/modules/processing.py
@@ -123,6 +123,7 @@ class Processed:
self.index_of_first_image = index_of_first_image
self.styles = p.styles
self.job_timestamp = state.job_timestamp
+ self.max_prompt_tokens = opts.max_prompt_tokens
self.eta = p.eta
self.ddim_discretize = p.ddim_discretize
@@ -141,6 +142,7 @@ class Processed:
self.all_subseeds = all_subseeds or [self.subseed]
self.infotexts = infotexts or [info]
+
def js(self):
obj = {
"prompt": self.prompt,
@@ -169,6 +171,7 @@ class Processed:
"infotexts": self.infotexts,
"styles": self.styles,
"job_timestamp": self.job_timestamp,
+ "max_prompt_tokens": self.max_prompt_tokens,
}
return json.dumps(obj)
@@ -266,6 +269,8 @@ def fix_seed(p):
def create_infotext(p, all_prompts, all_seeds, all_subseeds, comments, iteration=0, position_in_batch=0):
index = position_in_batch + iteration * p.batch_size
+ max_tokens = getattr(p, 'max_prompt_tokens', opts.max_prompt_tokens)
+
generation_params = {
"Steps": p.steps,
"Sampler": sd_samplers.samplers[p.sampler_index].name,
@@ -281,6 +286,7 @@ def create_infotext(p, all_prompts, all_seeds, all_subseeds, comments, iteration
"Seed resize from": (None if p.seed_resize_from_w == 0 or p.seed_resize_from_h == 0 else f"{p.seed_resize_from_w}x{p.seed_resize_from_h}"),
"Denoising strength": getattr(p, 'denoising_strength', None),
"Eta": (None if p.sampler is None or p.sampler.eta == p.sampler.default_eta else p.sampler.eta),
+ "Max tokens": (None if max_tokens == shared.vanilla_max_prompt_tokens else max_tokens)
}
generation_params.update(p.extra_generation_params)