I tried to run this project on python 3.10 and with the current requirements.txt I think this project is broken.
I get:
venv) ubuntu@44c29449b7c4:~/workspace/jorge/OmniParser$ python gradio_demo.py
`torch_dtype` is deprecated! Use `dtype` instead!
* Running on local URL: http://127.0.0.1:7861
* Running on public URL: https://a5f072d049c9bcce66.gradio.live
This share link expires in 1 week. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces (https://huggingface.co/spaces)
[2026/01/16 06:30:52] ppocr WARNING: Since the angle classifier is not initialized, it will not be used during the forward process
heree222
0: 608x1280 80 icons, 49.6ms
Speed: 6.9ms preprocess, 49.6ms inference, 53.7ms postprocess per image at shape (1, 3, 608, 1280)
len(filtered_boxes): 94 30
The following generation flags are not valid and may be ignored: ['early_stopping']. Set `TRANSFORMERS_VERBOSITY=info` for more details.
Traceback (most recent call last):
File "/home/ubuntu/workspace/jorge/OmniParser/venv/lib/python3.12/site-packages/gradio/queueing.py", line 766, in process_events
response = await route_utils.call_process_api(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/workspace/jorge/OmniParser/venv/lib/python3.12/site-packages/gradio/route_utils.py", line 355, in call_process_api
output = await app.get_blocks().process_api(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/workspace/jorge/OmniParser/venv/lib/python3.12/site-packages/gradio/blocks.py", line 2152, in process_api
result = await self.call_function(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/workspace/jorge/OmniParser/venv/lib/python3.12/site-packages/gradio/blocks.py", line 1629, in call_function
prediction = await anyio.to_thread.run_sync( # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/workspace/jorge/OmniParser/venv/lib/python3.12/site-packages/anyio/to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/workspace/jorge/OmniParser/venv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
^^^^^^^^^^^^
File "/home/ubuntu/workspace/jorge/OmniParser/venv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 807, in run
result = context.run(func, *args)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/workspace/jorge/OmniParser/venv/lib/python3.12/site-packages/gradio/utils.py", line 1034, in wrapper
response = f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/workspace/jorge/OmniParser/gradio_demo.py", line 54, in process
dino_labled_img, label_coordinates, parsed_content_list = get_som_labeled_img(image_input, yolo_model, BOX_TRESHOLD = box_threshold, output_coord_in_ratio=True, ocr_bbox=ocr_bbox,draw_bbox_config=draw_bbox_config, caption_model_processor=caption_model_processor, ocr_text=text,iou_threshold=iou_threshold, imgsz=imgsz,)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/workspace/jorge/OmniParser/util/utils.py", line 452, in get_som_labeled_img
parsed_content_icon = get_parsed_content_icon(filtered_boxes, starting_idx, image_source, caption_model_processor, prompt=prompt,batch_size=batch_size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/workspace/jorge/OmniParser/venv/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 120, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/workspace/jorge/OmniParser/util/utils.py", line 115, in get_parsed_content_icon
generated_ids = model.generate(input_ids=inputs["input_ids"],pixel_values=inputs["pixel_values"],max_new_tokens=20,num_beams=1, do_sample=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/.cache/huggingface/modules/transformers_modules/microsoft/Florence_hyphen_2_hyphen_base_hyphen_ft/f6c1a25888ffc1d945ee8a1a77ac833c7303d46e/modeling_florence2.py", line 2795, in generate
return self.language_model.generate(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/workspace/jorge/OmniParser/venv/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 120, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/workspace/jorge/OmniParser/venv/lib/python3.12/site-packages/transformers/generation/utils.py", line 2566, in generate
result = decoding_method(
^^^^^^^^^^^^^^^^
File "/home/ubuntu/workspace/jorge/OmniParser/venv/lib/python3.12/site-packages/transformers/generation/utils.py", line 2783, in _sample
model_inputs = self.prepare_inputs_for_generation(input_ids, **model_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/.cache/huggingface/modules/transformers_modules/microsoft/Florence_hyphen_2_hyphen_base_hyphen_ft/f6c1a25888ffc1d945ee8a1a77ac833c7303d46e/modeling_florence2.py", line 2197, in prepare_inputs_for_generation
past_length = past_key_values[0][0].shape[2]
^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'shape'
Hello Microsoft,
I tried to run this project on python 3.10 and with the current requirements.txt I think this project is broken.
I get:
Does someone have an idea ?