Skip to content

[tests] Compare the table compile test's outputs on a real table image - #2178

Merged
felixdittrich92 merged 1 commit into
mindee:mainfrom
quotentiroler:tests/table-compile-compare
Oct 23, 2026
Merged

felixdittrich92 merged 1 commit into
mindee:mainfrom
quotentiroler:tests/table-compile-compare

Conversation

@quotentiroler

Copy link
Copy Markdown
Contributor

Follows up #2171 (point 1).

test_torch_compiled_models in tests/pytorch/test_models_table_structure_pt.py says "Compare that outputs are close" and then asserts only that both predictors returned one page and that the compiled one carries cells, num_rows and num_cols. Its input is np.random.rand noise, on which the predictor finds no cells, so there is nothing to compare even in principle and a compile regression would not show.

This takes the table image from the v1.1.0 release through a mock_table_image fixture, built like mock_payslip, and compares the two predictions: the number of cells, the table's size, and every cell's geometry and score at atol=1e-4, with the logical row and column indices exact. Asserting that a cell was found at all is what keeps the comparison from passing over an empty list.

Thanks for uploading the example image.

Testing

Run in a Linux container (python 3.11.17, CPU-only torch, pytest 9.1.1):

pytest tests/pytorch/test_models_table_structure_pt.py -k test_torch_compiled_models passes, 1 passed in 456s.

The predictor's output on each input, same container:

release image: cells=35 rows=5 cols=7
random noise : cells=0  rows=0 cols=0

So the test compares 35 cells where it compared nothing before, and eager and compiled do agree today within the tolerances above.

test_torch_compiled_models says "Compare that outputs are close" and
then asserts only that both predictors returned one page and that the
compiled one carries the expected keys.  Its input is random noise,
on which the predictor finds no cells, so there is nothing to compare
even in principle and a compile regression would not show.

Take the table image from the v1.1.0 release through a
mock_table_image fixture, and compare the two predictions: the number
of cells, the table's size, and every cell's geometry and score at
atol=1e-4, with the logical row and column indices exact.  Asserting
that a cell was found at all is what keeps the comparison from
passing over an empty list.
@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.65%. Comparing base (177c3c0) to head (05ab969).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2178      +/-   ##
==========================================
+ Coverage   97.62%   97.65%   +0.02%     
==========================================
  Files         170      170              
  Lines       10744    10744              
==========================================
+ Hits        10489    10492       +3     
+ Misses        255      252       -3     
Flag Coverage Δ
unittests 97.65% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@felixdittrich92 felixdittrich92 self-assigned this Oct 23, 2026
@felixdittrich92 felixdittrich92 added this to the 1.2.0 milestone Oct 23, 2026
@felixdittrich92 felixdittrich92 added ext: tests Related to tests folder topic: table comprehension Related to table comprehension type: misc Miscellaneous labels Oct 23, 2026

@felixdittrich92 felixdittrich92 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @quotentiroler LGTM 👍

@felixdittrich92
felixdittrich92 merged commit 7ec0441 into mindee:main Oct 23, 2026
71 of 74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ext: tests Related to tests folder topic: table comprehension Related to table comprehension type: misc Miscellaneous

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants