Skip to content

fix(ci,scripts): fix publish-models.yml export/staging + download_dependencies.sh sidecar gap#19

Merged
artiz merged 6 commits into
masterfrom
fix/tableformer-silent-fallback
Jul 1, 2026
Merged

fix(ci,scripts): fix publish-models.yml export/staging + download_dependencies.sh sidecar gap#19
artiz merged 6 commits into
masterfrom
fix/tableformer-silent-fallback

Conversation

@artiz

@artiz artiz commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • export_layout.py: create the output directory before writing — torch.onnx.export doesn't create missing parent dirs, and models/ is gitignored so a fresh Actions checkout doesn't have it.
  • publish-models.yml: install opencv-python-headless for the TableFormer export step (docling_ibm_models's tf_predictor imports cv2, which wasn't otherwise installed).
  • publish-models.yml: rewrite stage()'s [ -f ... ] && cp ... as explicit if/fi — under bash -e (GitHub Actions' default), a bare &&-chain whose test is false aborts the whole step immediately; if conditions are exempt. This was killing the staging step on the very first call, before any release asset was copied.
  • scripts/download_dependencies.sh: fetch the optional .data sidecar for all three TableFormer assets (encoder/decoder/bbox), not just the decoder — this export produced a bbox.onnx.data too, and ONNX Runtime failed to load bbox.onnx without it.
  • .github/workflows/*.yml: bump pinned actions (checkout v5→v7, setup-python/setup-node v5→v6, upload-artifact v5→v7, download-artifact v5→v8) to silence the Node 20 deprecation warning — checked each major's release notes against our actual usage; none of the breaking changes apply.
  • README.md: add a dedicated "Getting the ML models" section documenting scripts/download_dependencies.sh end to end (what it fetches, where, --force/$FLEISCHWOLF_MODELS_URL, both the cargo run and npm flows).

All fixes were verified against real publish-models.yml runs — the models-v1 release now publishes successfully with all 9 assets, and a live download_dependencies.sh + npm i fleischwolf + convertFile() end-to-end test (once npm is republished) works, including TableFormer.

Test plan

  • python3 -m py_compile scripts/export_layout.py
  • publish-models.yml run against this branch: models-v1 release published with all 9 assets
  • sh -n / bash -n on download_dependencies.sh
  • YAML parse-check on all three workflow files
  • Live end-to-end test: download_dependencies.sh + npm i fleischwolf (once republished) + convertFile() on a real PDF, including TableFormer

Generated by Claude Code

claude added 6 commits July 1, 2026 15:10
…writing

publish-models.yml runs `python scripts/export_layout.py models/layout_heron.onnx`
against a fresh checkout, where models/ doesn't exist (it's gitignored).
torch.onnx.export doesn't create missing parent directories, so the export
failed with FileNotFoundError. export_tableformer.py already did this
(os.makedirs(OUT, exist_ok=True)); export_layout.py was missing it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DofkqhMuAJbL9arnnuVisL
docling_ibm_models's tf_predictor imports cv2, but publish-models.yml only
installed docling_ibm_models/onnxscript/onnxruntime/huggingface_hub, so the
export step failed with ModuleNotFoundError: No module named 'cv2'.
scripts/pdf_setup.sh never hit this because it installs the full `docling`
package instead, which pulls opencv in transitively.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DofkqhMuAJbL9arnnuVisL
… -e safety

GitHub Actions runs each `run:` step under `bash -e`. A top-level
`[ -f "$1" ] && cp ...` line is NOT exempt from -e the way an if-condition
is: when the test is false, the line's exit status is 1 and the whole step
aborts immediately — which is exactly what happened on the very first
stage() call, since pdfium/encoder/bbox have no .data sidecar to copy.
Rewriting as explicit if/fi blocks (which set -e does exempt) fixes it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DofkqhMuAJbL9arnnuVisL
…t just decoder

This export produced a bbox.onnx.data sidecar too (39MB), not just
decoder.onnx.data as earlier local testing assumed — ONNX Runtime failed to
load bbox.onnx with "cannot get file size: ... bbox.onnx.data" because
download_dependencies.sh never fetched it. publish-models.yml already stages
whichever files' .data sidecar exists (comment: "checked for every file since
that's export-size dependent, not fixed") — the download script just wasn't
matching that. Now attempts all three optimistically, same as the workflow.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DofkqhMuAJbL9arnnuVisL
…ning

actions/checkout v5->v7, actions/setup-python v5->v6, actions/setup-node
v5->v6, actions/upload-artifact v5->v7, actions/download-artifact v5->v8.
Checked each major's release notes for breaking changes against our actual
usage: none apply (no pull_request_target/workflow_run checkout, no
packageManager field so setup-node's cache-scoping change is a no-op, we
always use the default zip upload/download path so download-artifact v8's
direct-download/hash-mismatch changes don't affect us).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DofkqhMuAJbL9arnnuVisL
…pendencies.sh

Consolidates what was split across the Node.js bindings blurb and a CLI
inline comment into one "Getting the ML models" section: what it fetches,
where each asset lands, --force/$FLEISCHWOLF_MODELS_URL, and both the
cargo-run and npm flows end to end.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DofkqhMuAJbL9arnnuVisL
@artiz artiz changed the title fix(scripts): create output directory in export_layout.py before writing fix(ci,scripts): fix publish-models.yml export/staging + download_dependencies.sh sidecar gap Jul 1, 2026
@artiz artiz merged commit 3ed450c into master Jul 1, 2026
3 checks passed
@artiz artiz deleted the fix/tableformer-silent-fallback branch July 1, 2026 15:56
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

Successfully merging this pull request may close these issues.

2 participants