Instructions to use microsoft/OmniParser-v2.0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/OmniParser-v2.0 with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("microsoft/OmniParser-v2.0", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Commit History
-
Fix: intersection_area & torch cpu device
Verified signature1. The original function intersection_area was not correct. Standard intersection x1 (left edge) is max(bbox_left[0], bbox_right[0]). Standard intersection y1 (top edge) is max(bbox_left[1], bbox_right[1]). The current implementation uses min for both these calculations when determining the intersection dimensions (min(bbox_left[0], bbox_right[0]) and min(bbox_left[1], bbox_right[1])). This will not calculate the correct intersection rectangle dimensions. The intersection_area function [within remove_overlap_new function](https://github.com/microsoft/OmniParser/blob/5171b092483ab3e74ca50b9357e225f9f3571f18/util/utils.py#L242-L247) in the Omni github repo uses the correct standard formula (max for top-left, min for bottom-right). 2. An error occurs when using the CPU. This is because the pretrained model is loaded using torch16, while inference is only performed using torch16 on CUDA and MPS.3180509
-
Add `handler.py` and `requirements.txt` (#23)
Verified signature- Add `handler.py` and `requirements.txt` (acd5c25b4e94f3dff29ee1a1e3b3764c75d3e5f7) - Update handler.py (1ebdf336dc12fef6aba071bb3b5a905272ede53d) - Update README.md (3655c7c72dc109866aa38022f07735f7cc475b7b) - Apply suggestions from @ThomasDh-C code review (54dd9132c195511be5b6f4dbc46f14b32934ee4f) Co-authored-by: Alvaro Bartolome <alvarobartt@users.noreply.huggingface.co>6600256