Skip to content

[CI] Only save the pretrained model cache on pushes to main - #2179

Merged
felixdittrich92 merged 1 commit into
mindee:mainfrom
quotentiroler:ci/models-cache-restore-on-pr
Oct 23, 2026
Merged

felixdittrich92 merged 1 commit into
mindee:mainfrom
quotentiroler:ci/models-cache-restore-on-pr

Conversation

@quotentiroler

@quotentiroler quotentiroler commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Follows up #2171 (point 2).

The models are cached with actions/cache, which saves in a post-job step whenever the restore missed. A pull request that misses writes its own branch-scoped copy, and such a copy is visible only to that pull request.

doctr-models-pytest-torch-v1 is 5.7 GB against a 10 GB repository limit, so one of those pushes main's entry out and the next run misses again. Every cache the repository holds right now is scoped to a single pull request, and there is none on refs/heads/main:

5678838518  refs/pull/2177/merge  doctr-models-pytest-torch-v1
 437478278  refs/pull/2177/merge  setup-python-...
   7394980  refs/pull/2177/merge  torchinductor-...
      3372  refs/pull/2177/merge  index-torch-viz-html-...

So keep actions/cache on pushes, where its post-job save is what fills main's entry, and restore only on everything else.

Twenty jobs take this cache from the input's default (14 in references.yml, 3 in scripts.yml, 2 in main.yml, 1 in demo.yml), so the choice belongs in the action rather than in a save step per workflow.

Testing

actionlint reports nothing in .github/actions/setup-env/action.yml, on this branch and on main.

The caching itself only shows on real runs, so the first push to main after merge is what fills the entry. On this PR's own run you can see the miss it is about: evaluate-text-recognition logged Cache not found for input keys: doctr-models-evaluate-text-recognition-v1.

The references / evaluate-text-recognition failure here is a network timeout (URLError: [Errno 110] Connection timed out) in the evaluation step, unrelated to this change. It reproduces on #2178, which touches no CI.

@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2179   +/-   ##
=======================================
  Coverage   97.62%   97.62%           
=======================================
  Files         170      170           
  Lines       10744    10744           
=======================================
  Hits        10489    10489           
  Misses        255      255           
Flag Coverage Δ
unittests 97.62% <ø> (ø)

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.

The models are cached with actions/cache, which saves in a post-job
step whenever the restore missed.  A pull request that misses writes
its own branch-scoped copy, and such a copy is visible only to that
pull request.

doctr-models-pytest-torch-v1 is 5.7 GB against a 10 GB repository
limit, so one of those pushes main's entry out and the next run
misses again.  Every cache the repository holds today is scoped to a
single pull request, and there is none on refs/heads/main:

	5678838518  refs/pull/2177/merge  doctr-models-pytest-torch-v1
	 437478278  refs/pull/2177/merge  setup-python-...
	   7394980  refs/pull/2177/merge  torchinductor-...
	      3372  refs/pull/2177/merge  index-torch-viz-html-...

So keep actions/cache on pushes, where its post-job save is what
fills main's entry, and restore only on everything else.

Twenty jobs across main.yml, references.yml, scripts.yml and demo.yml
take this cache from the input's default, so the choice belongs in
the action rather than in a save step per workflow.
@quotentiroler
quotentiroler force-pushed the ci/models-cache-restore-on-pr branch from 179a4ed to 3ea89cb Compare October 22, 2026 19:04
@quotentiroler quotentiroler changed the title [CI] Restore the pretrained model cache on pull requests, save on main [CI] Only save the pretrained model cache on pushes to main Oct 22, 2026
@quotentiroler

Copy link
Copy Markdown
Contributor Author

Reworked. The first version added a save step to each workflow, which was both wider and incomplete: I had missed that references.yml and scripts.yml also take the models cache from the input's default, so 17 more jobs would have restored without ever saving.

This version branches on the event inside setup-env instead, so all twenty jobs get the same behaviour from one place and no workflow needs editing.

@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.

@quotentiroler Really nice addition thanks a lot 👍

@felixdittrich92 felixdittrich92 self-assigned this Oct 23, 2026
@felixdittrich92 felixdittrich92 added this to the 1.2.0 milestone Oct 23, 2026
@felixdittrich92 felixdittrich92 added type: enhancement Improvement topic: ci Related to CI labels Oct 23, 2026
@felixdittrich92
felixdittrich92 merged commit aa17f53 into mindee:main Oct 23, 2026
69 of 71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: ci Related to CI type: enhancement Improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants