aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-05 16:57:16 +0200
committerDanilo M. <danix@danix.xyz>2026-10-05 16:57:16 +0200
commitd57884663b9f3d996e6d1c5bf732b3e50261e7e6 (patch)
tree2e3786a2e754c203ffa7195f887e45b8e1d63e9d
parentdbd3cb8c1cabf1fd3a76f71a3a6e80bae4878541 (diff)
downloadfanfictioner-master.tar.gz
fanfictioner-master.zip
Show candidate and sampling progress instead of raw sd-cli linesHEADmaster
The status line echoed sd-cli's latest log line. During the low-VRAM retry that is a recovered [ERROR line, which reads like a crash and got a working run interrupted. Show the candidate being sampled and its sampling progress bar only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
-rwxr-xr-xfanfictioner12
1 files changed, 7 insertions, 5 deletions
diff --git a/fanfictioner b/fanfictioner
index 4386f57..cbf5bda 100755
--- a/fanfictioner
+++ b/fanfictioner
@@ -368,12 +368,14 @@ def mem_available_kb(meminfo):
def progress(start, log):
- """One self-overwriting status line: elapsed time and sd-cli's latest progress output."""
- with open(log, "rb") as f:
- f.seek(max(0, os.path.getsize(log) - 4096))
- last = next((x for x in reversed(re.split(r"[\r\n]", f.read().decode(errors="replace"))) if x.strip()), "")
+ """One self-overwriting status line: elapsed time, candidate and sd-cli's latest progress bar.
+ Never raw log lines: recovered [ERROR lines there read like a crash."""
+ text = Path(log).read_text(errors="replace")
+ cand = re.findall(r"generating image: (\d+/\d+)", text)
+ bar = re.findall(r"\|[=>\s]*\|[^\r\n\x1b]*", text[text.rfind("generating image"):]) # sampling, not loading
+ status = f"candidate {cand[-1]} {bar[-1] if bar else 'preparing'}" if cand else "loading models"
width = shutil.get_terminal_size().columns - 1
- print(f"\r{int(time.time() - start):4d}s {last.strip()}"[:width].ljust(width), end="", flush=True)
+ print(f"\r{int(time.time() - start):4d}s {status}"[:width].ljust(width), end="", flush=True)
def scale_preview(src, dst):