microsoft / microsoft/OmniParser

Error When Testing Icon Classification with BLIP-2 Model

Open
#110 0 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

Description:
When running the command below to test icon classification with the BLIP-2 model, I encountered a tensor mismatch error. Despite following the instructions referenced in the error message, the issue persists.

python gradio_demo.py --icon_detect_model weights/icon_detect_v1_5/model_v1_5.pt --icon_caption_model blip2

Steps to Reproduce:

  1. Run the following command:
    python gradio_demo.py --icon_detect_model weights/icon_detect_v1_5/model_v1_5.pt --icon_caption_model blip2
    
  2. Observe the output log:
    Using MPS device.
    Loading checkpoint shards: 100%|...| 2/2 [00:36<00:00, 18.20s/it]
    * Running on local URL: http://127.0.0.1:7860
    
    To create a public link, set share=True in launch().
    start processing datetime: 2025-01-15 16:02:40.503170
    
    image 1/1 ...binary_image_demo.png: 576x1280 21 icons, 429.1ms
    Speed: 3.4ms preprocess, 429.1ms inference, 18.8ms postprocess per image at shape (1, 3, 576, 1280)
    Expanding inputs for image tokens in BLIP-2 should be done in processing. Please follow instructions here: (https://gist.github.com/zucchini-nlp/e9f20b054fa322f84ac9311d9ab67042)...
    Sizes of tensors must match except in dimension 1. Expected size 19 but got size 1 for tensor number 1 in the list.
    

Environment:

  • OS: macOS
  • Device: MPS (Metal Performance Shaders)
  • Python Version: 3.12
  • Gradio Version: 5.12.0
  • BLIP-2 Model: Salesforce/blip2-opt-2.7b
  • Icon Detection Model Path: weights/icon_detect_v1_5/model_v1_5.pt

Additional Notes:

  1. The error mentions following a specific [gist](https://gist.github.com/zucchini-nlp/e9f20b054fa322f84ac9311d9ab67042), but even after following its instructions, the issue persists.

Let me know if additional information or clarifications are needed!
thanks

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 by running the command in gradio_demo.py with the stated macOS, MPS, Python, and BLIP-2 setup, then review the linked BLIP-2 processing guidance. Trace the tensor construction around the BLIP-2 inference path and confirm the command completes without the size-mismatch error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.