Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed assertion `Placeholder shape mismatches (expected 1 vs got tensorData with 896) at dimIdx = 0' when recognizing text #216

Closed
gaowq2017 opened this issue Oct 21, 2024 · 7 comments

Comments

@gaowq2017
Copy link

The detial as follow:
OS: Max os, chip: M1
ErrorLog:
Loaded detection model vikp/surya_det3 on device mps with dtype torch.float16
Loaded recognition model vikp/surya_rec2 on device mps with dtype torch.float16
Detecting bboxes: 100%|██████████| 1/1 [00:00<00:00, 1.55it/s]
Recognizing Text: 0%| | 0/1 [00:00<?, ?it/s]/AppleInternal/Library/BuildRoots/d9889869-120b-11ee-b796-7a03568b17ac/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraph.mm:678: failed assertion `Placeholder shape mismatches (expected 1 vs got tensorData with 896) at dimIdx = 0'
/Users/theoyu/miniforge3/envs/py310/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
warnings.warn('resource_tracker: There appear to be %d '
Thank you!

@VikParuchuri
Copy link
Owner

This is an MPS bug, should be fixed with the newest version of surya, make sure you do pip install -U

@gaowq2017
Copy link
Author

This is an MPS bug, should be fixed with the newest version of surya, make sure you do pip install -U

@VikParuchuri OK, thank you very much!

@olofssonmattias
Copy link

Hello I'm getting this error but pip install -U does nothing unfortuantely for me.

Kind Regards

Matt

@jwuphysics
Copy link

Unfortunately I am still seeing this issue with a fresh install in a new virtual environment. Same error with Metal as above:

Loaded layout model datalab-to/surya_layout on device mps with dtype torch.float16
Loaded texify model datalab-to/texify on device mps with dtype torch.float16
Loaded recognition model vikp/surya_rec2 on device mps with dtype torch.float16
Loaded table recognition model datalab-to/surya_tablerec on device mps with dtype torch.float16
Loaded detection model vikp/surya_det3 on device mps with dtype torch.float16
Recognizing layout:   0%|                                                                                                                                        | 0/6 [00:00<?, ?it/s]/AppleInternal/Library/BuildRoots/b11baf73-9ee0-11ef-b7b4-7aebe1f78c73/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraph.mm:971: failed assertion `Placeholder shape mismatches (expected 1 vs got tensorData with 3456) at dimIdx = 0'
fish: Job 1, 'marker_single ./arxiv-papers/22…' terminated by signal SIGABRT (Abort)
/Users/john/miniforge3/envs/jwst-dois/lib/python3.11/multiprocessing/resource_tracker.py:254: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '

@kbruegge
Copy link

I'm having the same issue for my input. Bounding boxes seem to be fine from visual inspection.

@kbruegge
Copy link

Is there a way to force execution on the CPU instead of the MPS device?

@VikParuchuri
Copy link
Owner

This was an issue with pytorch 2.6 - should be fixed with surya-ocr 0.10.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants