Repository navigation
[tests] Compare the table compile test's outputs on a real table image - #2178
Merged
felixdittrich92 merged 1 commit intoOct 23, 2026
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
felixdittrich92
approved these changes
Oct 23, 2026
felixdittrich92
left a comment
Collaborator
There was a problem hiding this comment.
Thanks @quotentiroler LGTM 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows up #2171 (point 1).
test_torch_compiled_modelsintests/pytorch/test_models_table_structure_pt.pysays "Compare that outputs are close" and then asserts only that both predictors returned one page and that the compiled one carriescells,num_rowsandnum_cols. Its input isnp.random.randnoise, 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_imagefixture, built likemock_payslip, and compares the two predictions: the number of cells, the table's size, and every cell'sgeometryandscoreatatol=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_modelspasses, 1 passed in 456s.The predictor's output on each input, same container:
So the test compares 35 cells where it compared nothing before, and eager and compiled do agree today within the tolerances above.