Skip to content

fix(ml): drop resume_download, removed from from_pretrained in transformers v5 (#15054) - #15297

Merged
mrveiss merged 4 commits into
Dev_new_guifrom
issue-15054-resume-download
Aug 29, 2026
Merged

mrveiss merged 4 commits into
Dev_new_guifrom
issue-15054-resume-download

Conversation

@mrveiss

@mrveiss mrveiss commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Thinking Path

transformers is pinned at 5.15.1 (requirements-ci/ai-ml.txt:10 -- the issue's
body cited 5.15.0, but the requirements file at the base branch pins 5.15.1).
Before touching any call site, I read that exact version's own source
(.venv-python-suite/lib/python3.14/site-packages/transformers/ -- already
installed locally for an unrelated purpose, read-only, never imported/executed)
to establish what resume_download actually does now rather than assume from
memory:

  • PreTrainedModel.from_pretrained (modeling_utils.py) never pops
    resume_download. It forwards unrecognized kwargs into
    config_class.from_pretrained(..., return_unused_kwargs=True, **kwargs), and
    the still-unused remainder becomes model_kwargs, which reaches
    cls(config, *model_args, **model_kwargs). A concrete model/processor class
    (CLIPModel, Wav2Vec2Model, WhisperForConditionalGeneration, ...) has no
    **kwargs catch-all on __init__, so this is a live TypeError --
    exactly the CI reproduction the issue cites: CLIPModel.__init__() got an unexpected keyword argument 'resume_download' (run 32839088246).
  • AutoConfig.from_pretrained / AutoTokenizer.from_pretrained survive it
    instead: PretrainedConfig.__post_init__ stores any leftover kwarg as a bare
    instance attribute (configuration_utils.py -- "Additional attributes without
    default values"), and PreTrainedTokenizerBase.__init__ just leaves it sitting
    in init_kwargs, unused. Both silently swallow it -- latent debt, not a
    crash, on that path.

So the breakage is mixed by call shape, not uniform -- but the fix is the same
either way: resume_download has no replacement kwarg (resumption is automatic
in v5), so it is dropped everywhere rather than substituted.

Call-site count: a repo-wide grep for from_pretrained( (git-tracked .py,
prose-stripped to exclude a docstring mention in hf_quantizer.py:97) finds
22 real call sites, of which 18 carried resume_download -- not the
issue's 10. The issue's table missed
autobot-backend/multimodal_processor/processors/voice.py entirely (4 sites)
and only listed 1 of vision.py's 5. The other 4 (a pyannote Pipeline.from_pretrained
in media/audio/diarization_service.py, and 3 trust_remote_code-only calls in
autobot-npu-worker/resources/windows-npu-worker/app/npu_worker.py, which pins
transformers>=4.36.0 separately) never passed resume_download and are untouched.

What Changed

  • Removed resume_download=True from all 18 call sites across
    ai_hardware_accelerator.py, code_embedding_generator.py,
    llm_shared/optimization/layer_inference.py,
    llm_shared/optimization/model_inspector.py,
    multimodal_processor/processors/vision.py, and
    multimodal_processor/processors/voice.py. No replacement kwarg -- v5
    resumption is automatic.
  • ai_hardware_accelerator.py shrank by 2 lines from the deletion; lowered its
    ratchet ceiling from 1048 to 1046 in both
    scripts/python_file_size_known_large.py and
    repo_tests/python_file_size_ratchet_baseline.py (the mirrored pair the
    ratchet requires) -- a genuine shrink, not a raised ceiling.
  • The vision/voice "load failure surfaced, not swallowed into a
    degraded-but-ready processor" acceptance criterion is already satisfied by
    existing code (vision.py:351's clip_model is None or blip_model is None
    gate from Implement real multimodal processing with NPU integration #466, and processor.py's get_stats() "model_availability"
    block from [Backend] Vision and audio model loading failures #675) -- verified by reading, not modified further.
  • Added repo_tests/transformers_resume_download_guard_test.py: a durable guard
    that walks every git-tracked production .py file, finds every
    .from_pretrained(...) call (paren-depth tracked so a multi-line call is
    captured whole, prose stripped first so a docstring mention is never counted),
    and fails if any call span contains resume_download.

Verification

  • Read transformers 5.15.1's own source
    (modeling_utils.py, configuration_utils.py, tokenization_utils_base.py,
    processing_utils.py) to establish the TypeError-vs-silently-swallowed split
    above -- no from_pretrained call was executed and no model was downloaded.
  • grep -rn resume_download --include='*.py' . on the tree after the change: no
    matches.
  • Reach floor: the guard's FROM_PRETRAINED_REACH_FLOOR = 15 sits between the
    tree's real total (22) and a broken walk's 0 -- test_the_from_pretrained_sweep_reaches_the_repo
    fails loudly if the sweep stops finding call sites instead of reporting a
    false "no offenders" having checked nothing.
  • Contrast mutation: test_a_reintroduced_resume_download_is_caught reproduces
    the exact pre-fix vision.py CLIPModel.from_pretrained(...) call
    (resume_download=True on the call's second line) and asserts the detector
    flags it -- proving the guard isn't vacuously passing.
  • The git pre-push hook ran pytest on every test file this PR's changes touch
    (code_embedding_generator_test.py, layer_inference_test.py,
    model_inspector_test.py, and the new guard) and reported all green -- the
    hook's own gate, not a manual pytest invocation, per the no-run-pytest
    constraint on this task.

Closes #15054

Model Used

Claude Sonnet 5

@github-actions

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No new hardcoded values of either class — ssot and other both block.

Known backlog in pipeline-scripts/hardcoded_values_baseline.txt is suppressed and tracked in #14371.

Applied Black, isort, and autoflake to match code-quality checks.
Triggered by workflow auto-fix-formatting.yml.
@mrveiss
mrveiss merged commit 6f9a698 into Dev_new_gui Aug 29, 2026
70 checks passed
@mrveiss
mrveiss deleted the issue-15054-resume-download branch August 29, 2026 17:34
mrveiss added a commit that referenced this pull request Sep 12, 2026
#16535)

The 2200.0-unit budget at system_benchmarks_performance_test.py:385 was
never re-derived after #15297 fixed #15054's CLIP-load TypeError -- the
constructor now does the real work instead of exiting early, and seven
real CI runs since (2026-08-30 through 2026-09-11) measured 2013.226 to
4348.363 units, all above the stale budget. Exactly the "baseline's
premise had gone" failure mode perf_work_budget.py's own docstring
already names this site as the worked example for.

Re-derived at 4348.363 (worst of the seven) x ~1.9, this site's own
stated policy for disk-bound work (model-file/HF-cache I/O, which a
CPU-bound yardstick cannot track): budget 8300. perf_work_budget.py's
worked-example docstring updated from its stale "~1500 units" figure to
match the fuller measured range.

This assertion was the recurring failure blocking .github/workflows/
marker-tests.yml's ten-consecutive-green bar for enabling its schedule
(#13286) -- filed and fixed separately since the root cause (a stale
perf baseline) is distinct from the cron-enablement decision itself.
This was referenced Sep 12, 2026
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.

1 participant