Skip to content

Conversation

@qued
Copy link
Contributor

@qued qued commented Mar 29, 2023

Removes progress bar output while processing pdfs and image elements.

@qued qued requested review from benjats07 and cragwolfe March 29, 2023 17:52
@benjats07
Copy link
Contributor

Think I added the bar to get information on the server side about progress on long tasks, not sure if is a good idea to remove it all

@cragwolfe
Copy link
Contributor

Think I added the bar to get information on the server side about progress on long tasks, not sure if is a good idea to remove it all

yes, but this output is really not good for non-interactive tasks, like multi-process batch processing or in a server, which is really the intended use case.

Copy link
Contributor

@cragwolfe cragwolfe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, though i'd even make it a release so we can merge into unstructured

@benjats07
Copy link
Contributor

Think I added the bar to get information on the server side about progress on long tasks, not sure if is a good idea to remove it all

yes, but this output is really not good for non-interactive tasks, like multi-process batch processing or in a server, which is really the intended use case.

Yeah, true but people using locally could think that something isn't working (after all, this is the default output for them)

Probably is needed to remove from here, but other approaches like using disable argument could be useful too.
https://tqdm.github.io/docs/tqdm/

@cragwolfe
Copy link
Contributor

btw, here is what one request looks like when running in unstructured-api:

2023-03-29 11:56:34,310 uvicorn.error INFO Will watch for changes in these directories: ['/Users/cragwolfe/r/unstructured-api']
2023-03-29 11:56:34,310 uvicorn.error INFO Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
2023-03-29 11:56:34,310 uvicorn.error INFO Started reloader process [75718] using WatchFiles
2023-03-29 11:56:40,201 uvicorn.error INFO Started server process [75729]
2023-03-29 11:56:40,201 uvicorn.error INFO Waiting for application startup.
2023-03-29 11:56:40,202 uvicorn.error INFO Application startup complete.
2023-03-29 11:59:34,072 unstructured_inference INFO Loading the Detectron2 layout model ...
2023-03-29 11:59:34,920 unstructured_inference INFO Reading PDF for file: /var/folders/nx/gj82179n6ljdxp2y2_zd1tsc0000gn/T/tmp8rn02znd/layout-parser-paper.pdf ...
2023-03-29 11:59:37,231 unstructured_inference INFO Detecting page elements ...
  0%|                                                                                                                                                                                                                    | 0/7 [00:00<?, ?it/s]\
2023-03-29 11:59:38,292 unstructured_inference DEBUG Running OCR on text block ...
2023-03-29 11:59:38,292 unstructured_inference INFO Loading the Tesseract OCR agent ...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 7/7 [00:00<00:00, 29.32it/s]
2023-03-29 11:59:38,524 unstructured_inference INFO Detecting page elements ...
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 6/6 [00:00<00:00, 205.07it/s]
2023-03-29 11:59:39,468 unstructured_inference INFO Detecting page elements ...
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:00<00:00, 238.24it/s]
2023-03-29 11:59:40,366 unstructured_inference INFO Detecting page elements ...
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 6/6 [00:00<00:00, 300.50it/s]
2023-03-29 11:59:41,234 unstructured_inference INFO Detecting page elements ...
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 9/9 [00:00<00:00, 212.32it/s]
2023-03-29 11:59:42,145 unstructured_inference INFO Detecting page elements ...
  0%|                                                                                                                                                                                                                    | 0/5 [00:00<?, ?it/s]\
2023-03-29 11:59:42,989 unstructured_inference DEBUG Running OCR on text block ...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 26.38it/s]
2023-03-29 11:59:43,177 unstructured_inference INFO Detecting page elements ...
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 9/9 [00:00<00:00, 225.04it/s]
2023-03-29 11:59:44,123 unstructured_inference INFO Detecting page elements ...
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:00<00:00, 317.61it/s]
2023-03-29 11:59:44,991 unstructured_inference INFO Detecting page elements ...
  0%|                                                                                                                                                                                                                    | 0/8 [00:00<?, ?it/s]\
2023-03-29 11:59:45,829 unstructured_inference DEBUG Running OCR on text block ...
 25%|███████████████████████████████████████████████████                                                                                                                                                         | 2/8 [00:00<00:00, 11.01it/s]\
2023-03-29 11:59:46,008 unstructured_inference DEBUG Running OCR on text block ...
2023-03-29 11:59:46,161 unstructured_inference DEBUG Running OCR on text block ...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:00<00:00, 15.97it/s]
2023-03-29 11:59:46,325 unstructured_inference INFO Detecting page elements ...
  0%|                                                                                                                                                                                                                    | 0/7 [00:00<?, ?it/s]\
2023-03-29 11:59:47,268 unstructured_inference DEBUG Running OCR on text block ...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 7/7 [00:00<00:00, 33.32it/s]
2023-03-29 11:59:47,476 unstructured_inference INFO Detecting page elements ...
  0%|                                                                                                                                                                                                                    | 0/8 [00:00<?, ?it/s]\
2023-03-29 11:59:48,381 unstructured_inference DEBUG Running OCR on text block ...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:00<00:00, 29.85it/s]
2023-03-29 11:59:48,633 unstructured_inference INFO Detecting page elements ...
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 199.73it/s]
2023-03-29 11:59:49,538 unstructured_inference INFO Detecting page elements ...
  0%|                                                                                                                                                                                                                    | 0/5 [00:00<?, ?it/s]\
2023-03-29 11:59:50,374 unstructured_inference DEBUG Running OCR on text block ...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 24.69it/s]
2023-03-29 11:59:50,574 unstructured_inference INFO Detecting page elements ...
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 6/6 [00:00<00:00, 261.74it/s]
2023-03-29 11:59:51,490 unstructured_inference INFO Detecting page elements ...
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 196.92it/s]
2023-03-29 11:59:52,413 unstructured_inference INFO Detecting page elements ...
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 172.95it/s]

the default should be not to have that.

@qued qued enabled auto-merge (squash) March 29, 2023 19:06
@qued qued merged commit 43887e6 into main Mar 29, 2023
@qued qued deleted the chore/remove-tqdm-output branch March 29, 2023 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants