diff --git a/compute.py b/compute.py index 878255c..975f858 100644 --- a/compute.py +++ b/compute.py @@ -775,8 +775,14 @@ def run_engine(engine, input_dir, output_dir, config): _r = _r.strip() if _r: _engine_lines.append(_r) + # 读取残留在管道中的进度消息,避免 20%→100% 跳变 + _prog_match = re.search(r'progress:\s*(\d+)/(\d+)', _r) + if _pbar is not None and _prog_match: + _p_done = min(int(_prog_match.group(1)), total_steps) + _pbar.n = max(_pbar.n, _p_done) + if _pbar is not None: _pbar.refresh() break - time.sleep(0.2) + time.sleep(0.05) finally: if _pbar is not None: _pbar.n = total_steps