Skip to content

Commit 1ec220d

Browse files
committed
Small cleanup
1 parent 619e4d2 commit 1ec220d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

olmocr/pipeline.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,9 @@ async def process_page(args, worker_id: int, pdf_orig_path: str, pdf_local_path:
308308
remaining_attempts = retry_attempts[i + 1 :]
309309
if remaining_attempts and vllm_queued_requests == 0:
310310
logger.info(f"Queue empty, firing {len(remaining_attempts)} parallel retries for {pdf_orig_path}-{page_num}")
311-
tasks = [asyncio.create_task(try_single_page(args, pdf_orig_path, pdf_local_path, page_num, a, rotation=0)) for a in remaining_attempts]
311+
tasks = [
312+
asyncio.create_task(try_single_page(args, pdf_orig_path, pdf_local_path, page_num, a, rotation=cumulative_rotation)) for a in remaining_attempts
313+
]
312314

313315
for coro in asyncio.as_completed(tasks):
314316
try:
@@ -323,7 +325,7 @@ async def process_page(args, worker_id: int, pdf_orig_path: str, pdf_local_path:
323325
continue
324326
break # Parallel attempts exhausted
325327

326-
# If you tried many times and all rotations were invalid, but you at least had a valid response, then return that in the end
328+
# If you tried many times and a least had a valid response, then return that in the end
327329
if result is not None and result.is_valid:
328330
metrics.add_metrics(**{"completed_pages": 1, f"finished_on_attempt_{MAX_RETRIES}": 1})
329331
await tracker.track_work(worker_id, f"{pdf_orig_path}-{page_num}", "finished")

0 commit comments

Comments
 (0)