microsoft / microsoft/OmniParser

TypeError: list indices must be integers or slices, not str

Open
#338 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
25.4k
Forks
2.2k
PR merge metrics
No merged PRs in 30d

Description

I don't know what happened

Sep 10 12:19:29 ubuntu22-v100 start_omni.sh[1992108]: Creating model: ('PP-LCNet_x1_0_doc_ori', None) Sep 10 12:19:29 ubuntu22-v100 start_omni.sh[1992108]: Model files already exist. Using cached files. To redownload, please delete the directory manually: /home/root/.paddlex/official_models/PP-LCNet_x1_0_doc_ori. Sep 10 12:19:29 ubuntu22-v100 start_omni.sh[1992108]: /root/miniconda3/envs/omni/lib/python3.12/site-packages/paddle/utils/cpp_extension/extension_utils.py:717: UserWarning: No ccache found. Please be aware that recompiling all source files may be required. You can download and install ccache from: https://github.com/ccache/ccache/blob/master/doc/INSTALL.md Sep 10 12:19:29 ubuntu22-v100 start_omni.sh[1992108]: warnings.warn(warning_message) Sep 10 12:19:30 ubuntu22-v100 start_omni.sh[1992108]: Creating model: ('UVDoc', None) Sep 10 12:19:30 ubuntu22-v100 start_omni.sh[1992108]: Model files already exist. Using cached files. To redownload, please delete the directory manually: /home/root/.paddlex/official_models/UVDoc. Sep 10 12:19:30 ubuntu22-v100 start_omni.sh[1992108]: Creating model: ('PP-OCRv5_server_det', None) Sep 10 12:19:30 ubuntu22-v100 start_omni.sh[1992108]: Model files already exist. Using cached files. To redownload, please delete the directory manually: /home/root/.paddlex/official_models/PP-OCRv5_server_det. Sep 10 12:19:30 ubuntu22-v100 start_omni.sh[1992108]: Creating model: ('PP-OCRv5_server_rec', None) Sep 10 12:19:30 ubuntu22-v100 start_omni.sh[1992108]: Model files already exist. Using cached files. To redownload, please delete the directory manually: /home/root/.paddlex/official_models/PP-OCRv5_server_rec. Sep 10 12:19:33 ubuntu22-v100 start_omni.sh[1992108]: /root/miniconda3/envs/omni/lib/python3.12/site-packages/huggingface_hub/file_download.py:945: FutureWarning: resume_downloadis deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, useforce_download=True. Sep 10 12:19:33 ubuntu22-v100 start_omni.sh[1992108]: warnings.warn( Sep 10 12:19:41 ubuntu22-v100 start_omni.sh[1992108]: Omniparser initialized!!! Sep 10 12:19:41 ubuntu22-v100 start_omni.sh[1992108]: INFO: Will watch for changes in these directories: ['/data/OmniParser/omnitool/omniparserserver'] Sep 10 12:19:41 ubuntu22-v100 start_omni.sh[1992108]: INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) Sep 10 12:19:41 ubuntu22-v100 start_omni.sh[1992108]: INFO: Started reloader process [1992108] using StatReload Sep 10 12:19:51 ubuntu22-v100 start_omni.sh[1992880]: Creating model: ('PP-LCNet_x1_0_doc_ori', None) Sep 10 12:19:51 ubuntu22-v100 start_omni.sh[1992880]: Model files already exist. Using cached files. To redownload, please delete the directory manually: /home/root/.paddlex/official_models/PP-LCNet_x1_0_doc_ori. Sep 10 12:19:52 ubuntu22-v100 start_omni.sh[1992880]: /root/miniconda3/envs/omni/lib/python3.12/site-packages/paddle/utils/cpp_extension/extension_utils.py:717: UserWarning: No ccache found. Please be aware that recompiling all source files may be required. You can download and install ccache from: https://github.com/ccache/ccache/blob/master/doc/INSTALL.md Sep 10 12:19:52 ubuntu22-v100 start_omni.sh[1992880]: warnings.warn(warning_message) Sep 10 12:19:53 ubuntu22-v100 start_omni.sh[1992880]: Creating model: ('UVDoc', None) Sep 10 12:19:53 ubuntu22-v100 start_omni.sh[1992880]: Model files already exist. Using cached files. To redownload, please delete the directory manually: /home/root/.paddlex/official_models/UVDoc. Sep 10 12:19:53 ubuntu22-v100 start_omni.sh[1992880]: Creating model: ('PP-OCRv5_server_det', None) Sep 10 12:19:53 ubuntu22-v100 start_omni.sh[1992880]: Model files already exist. Using cached files. To redownload, please delete the directory manually: /home/root/.paddlex/official_models/PP-OCRv5_server_det. Sep 10 12:19:53 ubuntu22-v100 start_omni.sh[1992880]: Creating model: ('PP-OCRv5_server_rec', None) Sep 10 12:19:53 ubuntu22-v100 start_omni.sh[1992880]: Model files already exist. Using cached files. To redownload, please delete the directory manually: /home/root/.paddlex/official_models/PP-OCRv5_server_rec. Sep 10 12:19:56 ubuntu22-v100 start_omni.sh[1992880]: /root/miniconda3/envs/omni/lib/python3.12/site-packages/huggingface_hub/file_download.py:945: FutureWarning: resume_downloadis deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, useforce_download=True. Sep 10 12:19:56 ubuntu22-v100 start_omni.sh[1992880]: warnings.warn( Sep 10 12:20:05 ubuntu22-v100 start_omni.sh[1992880]: Omniparser initialized!!! Sep 10 12:20:05 ubuntu22-v100 start_omni.sh[1992880]: /root/miniconda3/envs/omni/lib/python3.12/site-packages/huggingface_hub/file_download.py:945: FutureWarning: resume_downloadis deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, useforce_download=True. Sep 10 12:20:05 ubuntu22-v100 start_omni.sh[1992880]: warnings.warn( Sep 10 12:20:11 ubuntu22-v100 start_omni.sh[1992880]: INFO: Started server process [1992880] Sep 10 12:20:11 ubuntu22-v100 start_omni.sh[1992880]: INFO: Waiting for application startup. Sep 10 12:20:11 ubuntu22-v100 start_omni.sh[1992880]: INFO: Application startup complete. Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: Omniparser initialized!!! Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: start parsing... Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: image size: (647, 471) Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: 0: 960x1280 4 icons, 121.3ms Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: Speed: 14.1ms preprocess, 121.3ms inference, 150.7ms postprocess per image at shape (1, 3, 960, 1280) Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: no ocr bbox!!! Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: Type of filtered_boxes_elem: <class 'list'> Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: Sample element: [0.22506903111934662, 0.7528759241104126, 0.2844580411911011, 0.8369423747062683] Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: INFO: 10.28.10.114:57095 - "POST /parse/ HTTP/1.1" 500 Internal Server Error Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: ERROR: Exception in ASGI application Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: Traceback (most recent call last): Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/root/miniconda3/envs/omni/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: result = await app( # type: ignore[func-returns-value] Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/root/miniconda3/envs/omni/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__ Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: return await self.app(scope, receive, send) Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/root/miniconda3/envs/omni/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__ Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: await super().__call__(scope, receive, send) Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/root/miniconda3/envs/omni/lib/python3.12/site-packages/starlette/applications.py", line 113, in __call__ Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: await self.middleware_stack(scope, receive, send) Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/root/miniconda3/envs/omni/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in __call__ Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: raise exc Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/root/miniconda3/envs/omni/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in __call__ Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: await self.app(scope, receive, _send) Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/root/miniconda3/envs/omni/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 63, in __call__ Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/root/miniconda3/envs/omni/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: raise exc Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/root/miniconda3/envs/omni/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: await app(scope, receive, sender) Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/root/miniconda3/envs/omni/lib/python3.12/site-packages/starlette/routing.py", line 716, in __call__ Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: await self.middleware_stack(scope, receive, send) Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/root/miniconda3/envs/omni/lib/python3.12/site-packages/starlette/routing.py", line 736, in app Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: await route.handle(scope, receive, send) Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/root/miniconda3/envs/omni/lib/python3.12/site-packages/starlette/routing.py", line 290, in handle Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: await self.app(scope, receive, send) Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/root/miniconda3/envs/omni/lib/python3.12/site-packages/starlette/routing.py", line 78, in app Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: await wrap_app_handling_exceptions(app, request)(scope, receive, send) Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/root/miniconda3/envs/omni/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: raise exc Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/root/miniconda3/envs/omni/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: await app(scope, receive, sender) Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/root/miniconda3/envs/omni/lib/python3.12/site-packages/starlette/routing.py", line 75, in app Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: response = await f(request) Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: ^^^^^^^^^^^^^^^^ Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/root/miniconda3/envs/omni/lib/python3.12/site-packages/fastapi/routing.py", line 302, in app Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: raw_response = await run_endpoint_function( Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/root/miniconda3/envs/omni/lib/python3.12/site-packages/fastapi/routing.py", line 213, in run_endpoint_function Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: return await dependant.call(**values) Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/data/OmniParser/omnitool/omniparserserver/omniparserserver.py", line 41, in parse Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: dino_labled_img, parsed_content_list = omniparser.parse(parse_request.base64_image) Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/data/OmniParser/util/omniparser.py", line 30, in parse Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: dino_labled_img, label_coordinates, parsed_content_list = get_som_labeled_img(image, self.som_model, BOX_TRESHOLD = self.config['BOX_TRESHOLD'], output_coord_in_ratio=True, ocr_bbox=ocr_bbox,draw_bbox_config=draw_bbox_config, caption_model_processor=self.caption_model_processor, ocr_text=text,use_local_semantics=True, iou_threshold=0.7, scale_img=False, batch_size=128) Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/data/OmniParser/util/utils.py", line 457, in get_som_labeled_img Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: starting_idx = next((i for i, box in enumerate(filtered_boxes_elem) if box['content'] is None), -1) Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: File "/data/OmniParser/util/utils.py", line 457, in <genexpr> Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: starting_idx = next((i for i, box in enumerate(filtered_boxes_elem) if box['content'] is None), -1) Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: ~~~^^^^^^^^^^^ Sep 10 12:23:51 ubuntu22-v100 start_omni.sh[1992880]: TypeError: list indices must be integers or slices, not str

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the POST /parse/ entry point in omnitool/omniparserserver/omniparserserver.py, line 41, and reproduce the request using the logged image dimensions and input. Read the complete traceback beyond the excerpt to identify which list is being indexed with a string. Done means the same parse request no longer returns HTTP 500 and produces the expected parsing response.

Written by the indexing model from the issue text.

Assessment

Tech stack
fastapi, python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.