mirror of
https://github.com/Extraltodeus/test_my_prompt.git
synced 2026-04-21 23:08:58 +00:00
Bug Fix test_my_prompt_custom_script.py
Discovered a `job_no` calculation error when `excluded_keyword` was used. I think this should be resolved by keeping track of the number of times a job was skipped due to an excluded keyword and subtracting the number from the `job_no` update calculation. I think this should work because jobs that are skipped due to excluded keywords should not be counted. This bug would sometimes cause the number of jobs `job_no` to be larger than the total jobs `job_count`.
This commit is contained in:
@@ -66,7 +66,8 @@ class Script(scripts.Script):
|
||||
total_jobs = len(filtered_prompt_array) + 1 - skip_x_first
|
||||
state.job_count = total_jobs
|
||||
print("total images :", total_jobs)
|
||||
|
||||
exluded_jobs = 0 # Used to fix job_no when excluded job is used
|
||||
|
||||
for g in range(len(prompt_array)+1):
|
||||
f = g-1
|
||||
if f >= 0 and f < skip_x_first:
|
||||
@@ -85,6 +86,7 @@ class Script(scripts.Script):
|
||||
|
||||
# Check for excluded keywords
|
||||
if f >= 0 and prompt_array[f].strip() in excluded_keywords_list:
|
||||
exluded_jobs = exluded_jobs + 1
|
||||
print(f"Skipping job due to excluded keyword: {prompt_array[f].strip()}")
|
||||
continue
|
||||
|
||||
@@ -113,7 +115,7 @@ class Script(scripts.Script):
|
||||
images.save_image(proc.images[0], p.outpath_samples, "", proc.seed, proc.prompt, opts.samples_format, info= proc.info, p=p)
|
||||
|
||||
# Update job number
|
||||
state.job_no = g - skip_x_first + 1
|
||||
state.job_no = (g - skip_x_first + 1) - exluded_jobs
|
||||
print(f"Job {state.job_no}/{state.job_count} completed.")
|
||||
state.job = f"{state.job_no + 1} out of {state.job_count}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user