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

Python Crash - Mac OSX - Placeholder shape mismatches #518

Open
johnciavarella opened this issue Jan 30, 2025 · 5 comments
Open

Python Crash - Mac OSX - Placeholder shape mismatches #518

johnciavarella opened this issue Jan 30, 2025 · 5 comments

Comments

@johnciavarella
Copy link

Description

When using marker_single test.pdf Python crashes.

Environment

  • Mac M1 - osx 15.2
  • Python 3.10.6
  • Marker PDF 1.3.3

Error

Looks like MPS is failing

MPSGraph.mm:971: failed assertion `Placeholder shape mismatches (expected 1 vs got tensorData with 3456) at dimIdx = 0'

Full Error

(.venv) bash$ marker_single test.pdf
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/43 [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'
zsh: abort      marker_single test.pdf
(.venv) bash$ /Library/Frameworks/Python.framework/Versions/3.10/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 '
..
..

Possibly related issue

#301

@VikParuchuri
Copy link
Owner

There's an issue with pytorch 2.6 - we'll pin to 2.5.1 shortly.

@johnciavarella
Copy link
Author

Verified downgrading torch to 2.5.1 fixed the issue. Thanks!

@dmonay
Copy link

dmonay commented Jan 31, 2025

I'm facing the same issue on a Macbook M1 Pro. When I try installing a specific version of torch with pip install torch==2.5.1 I get this error:

ERROR: Could not find a version that satisfies the requirement torch==2.5.1 (from versions: 2.6.0)

Would appreciate any guidance on how to downgrade to 2.5.1.

Environment

  • Macbook M1 Pro - osx 15.2
  • Python 3.13.1
  • Marker PDF 1.3.3

@VikParuchuri
Copy link
Owner

This should be fixed in the new version of surya-ocr (0.10.2) - will update marker to pull the right dependency in.

@johnciavarella
Copy link
Author

johnciavarella commented Jan 31, 2025

I'm facing the same issue on a Macbook M1 Pro. When I try installing a specific version of torch with pip install torch==2.5.1 I get this error:

ERROR: Could not find a version that satisfies the requirement torch==2.5.1 (from versions: 2.6.0)

Would appreciate any guidance on how to downgrade to 2.5.1.

Environment

  • Macbook M1 Pro - osx 15.2
  • Python 3.13.1
  • Marker PDF 1.3.3

I used virtual python 3.10. Try

python3.10 -m venv marker
source marker/bin/activate
pip install marker 

Your python may be too new to downgrade
Python Venv Docs

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

3 participants