You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test_richdocument errors on Apple Silicon: docling layout pipeline fails on MPS (float64 unsupported) #1344
The four tests in test/stdlib/components/docs/test_richdocument.py that depend on the rd module fixture all error out on Apple Silicon with:
ERROR docling.pipeline.standard_pdf_pipeline:standard_pdf_pipeline.py:321
Stage layout failed run 1: Cannot convert a MPS Tensor to float64 dtype as float32
MPS does not support float64. Docling's layout pipeline automatically selects MPS on Apple Silicon and then attempts a float64 operation, causing the fixture to raise before any test body runs.
Affected tests
All four tests that share the rd fixture:
test_richdocument_basics
test_richdocument_markdown
test_richdocument_save
test_table
Why they aren't skipped
The rd fixture wraps RichDocument.from_document_file() in hf_skip(), which only catches HuggingFace Hub errors. The MPS tensor error originates inside docling's internal pipeline and propagates as an unhandled ERROR, taking all four downstream tests with it. There is no require_gpu, no MPS xfail, and no device override.
Options
A. Force CPU in the fixture on MPS — pass a docling pipeline config that pins the device to CPU when torch.backends.mps.is_available(). The tests would run correctly and slowly; no golden files needed.
B. xfail on MPS — add if torch.backends.mps.is_available(): pytest.xfail("docling layout pipeline does not support MPS float64") at the top of the fixture. Low effort, honest, and unblocks MPS developers until docling gains float64 MPS support.
C. require_gpu predicate — skip on non-CUDA hardware. This gives up on MPS support rather than fixing it, and is probably too broad since the tests run fine on CPU.
Option A is the cleanest long-term fix. Option B is a safe interim measure.
Verified against upstream/main (2026-10-05): cc6982b8f (PR #1417) pins the docling pipeline to AcceleratorDevice.CPU whenever torch.backends.mps.is_available() (mellea/stdlib/components/docs/richdocument.py:204-208, with the check in _mps_is_available() at :149), so the fixture no longer errors before the test bodies run. Covered by the new test/stdlib/components/docs/test_richdocument_device.py.
Note for Apple Silicon developers: the four rd-fixture tests now run on CPU rather than skipping — correct, and a little slower, per option A.
Activity
planetf1 commentedon Oct 5, 2026
Fixed — option A landed.
Verified against
upstream/main(2026-10-05):cc6982b8f(PR #1417) pins the docling pipeline toAcceleratorDevice.CPUwhenevertorch.backends.mps.is_available()(mellea/stdlib/components/docs/richdocument.py:204-208, with the check in_mps_is_available()at:149), so the fixture no longer errors before the test bodies run. Covered by the newtest/stdlib/components/docs/test_richdocument_device.py.Note for Apple Silicon developers: the four
rd-fixture tests now run on CPU rather than skipping — correct, and a little slower, per option A.