microsoft / microsoft/OmniParser

OmniParser-v.2.0.0 Start error

Open
#235 3 comments 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

(omni) [root@mysql04 OmniParser]# python gradio_demo.py --icon_detect_model weights/icon_detect_v1_5/model_v1_5.pt --icon_caption_model florence2
[2025-03-07 01:47:39,461] [ WARNING] easyocr.py:80 - Neither CUDA nor MPS are available - defaulting to CPU. Note: This module is much faster with a GPU.
Traceback (most recent call last):
File "/home/OmniParser/gradio_demo.py", line 72, in
yolo_model = get_yolo_model(model_path=icon_detect_model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/OmniParser/utils.py", line 73, in get_yolo_model
model = YOLO(model_path)
^^^^^^^^^^^^^^^^
File "/home/python/anaconda3/envs/omni/lib/python3.12/site-packages/ultralytics/models/yolo/model.py", line 23, in init
super().init(model=model, task=task, verbose=verbose)
File "/home/python/anaconda3/envs/omni/lib/python3.12/site-packages/ultralytics/engine/model.py", line 142, in init
self._load(model, task=task)
File "/home/python/anaconda3/envs/omni/lib/python3.12/site-packages/ultralytics/engine/model.py", line 229, in _load
self.model, self.ckpt = attempt_load_one_weight(weights)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/python/anaconda3/envs/omni/lib/python3.12/site-packages/ultralytics/nn/tasks.py", line 788, in attempt_load_one_weight
ckpt, weight = torch_safe_load(weight) # load ckpt
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/python/anaconda3/envs/omni/lib/python3.12/site-packages/ultralytics/nn/tasks.py", line 714, in torch_safe_load
ckpt = torch.load(file, map_location="cpu")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/python/anaconda3/envs/omni/lib/python3.12/site-packages/torch/serialization.py", line 1470, in load
raise pickle.UnpicklingError(_get_wo_message(str(e))) from None
_pickle.UnpicklingError: Weights only load failed. This file can still be loaded, to do so you have two options, do those steps only if you trust the source of the checkpoint.
(1) In PyTorch 2.6, we changed the default value of the weights_only argument in torch.load from False to True. Re-running torch.load with weights_only set to False will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.
(2) Alternatively, to load with weights_only=True please check the recommended steps in the following error message.
WeightsUnpickler error: Unsupported global: GLOBAL ultralytics.nn.tasks.DetectionModel was not an allowed global by default. Please use torch.serialization.add_safe_globals([DetectionModel]) or the torch.serialization.safe_globals([DetectionModel]) context manager to allowlist this global if you trust this class/function.

Check the documentation of torch.load to learn more about types accepted by default with weights_only https://pytorch.org/docs/stable/generated/torch.load.html.

Please add how to handle CPU operation

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

Reproduce the failure with the reported python gradio_demo.py command, then inspect gradio_demo.py around line 72 and utils.py around line 73 where the YOLO model is loaded. Check how the reported PyTorch checkpoint-loading error affects CPU execution. Done means the demo starts and operates on CPU with the supplied model arguments.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.