Skip to content

fix(vlm): defer optional local provider imports - #4967

Merged
dolfim-ibm merged 1 commit into
docling-project:mainfrom
YamonBot:fix/remote-vlm-optional-provider-imports
Oct 26, 2026
Merged

dolfim-ibm merged 1 commit into
docling-project:mainfrom
YamonBot:fix/remote-vlm-optional-provider-imports

Conversation

@YamonBot

Copy link
Copy Markdown
Contributor

Remote API VLM pipelines cannot import or initialize in a slim environment without optional local ML dependencies. VlmPipeline imports the legacy HF and MLX providers before selecting an inference backend, so remote-only setup fails with ModuleNotFoundError.

Move each import into its existing local-provider branch. This uses the same provider-selection pattern as the VLM engine factory. Local provider arguments, remote-service permission checks, packaging, and conversion output remain unchanged.

Resolves #4966.

Checklist:

  • Documentation reviewed; no public API or installation metadata changes.
  • Examples reviewed; existing API options remain unchanged.
  • Added four fresh-subprocess regressions for current and legacy API options, with remote services enabled and denied.

Review evidence:

  • Base: 10054ec7bbdc9435ef7ca2ec6be90c782082ae52.
  • Python 3.12.14, docling-slim 2.141.0 editable, docling-core 2.103.1, Pillow 12.3.0. Torch, Transformers, and MLX packages are physically absent from the isolated environment. No replacement modules or model weights used.
  • Original source: all four new cases failed at the eager HF provider import. Corrected source: four passed. The assertions track provider module imports, so installed optional packages in other CI environments are not themselves treated as failures.
  • PYTHONDONTWRITEBYTECODE=1 /tmp/docling-remote-provider-py312-dab32661/bin/python -m pytest -p no:tach -p no:cacheprovider tests/test_vlm_pipeline_optional_dependencies.py tests/test_api_vlm_engine.py tests/test_api_image_request.py tests/test_vlm_pipeline_status.py tests/test_vlm_pipeline_streaming.py tests/test_vlm_pipeline_force_backend_text.py tests/test_vlm_enrichment.py tests/test_vlm_convert_prediction_mapping.py tests/test_vlm_utils.py tests/test_vlm_prediction_token_coercion.py -q: 80 passed, 1 skipped after final review.
  • UV_NO_SYNC=1 UV_PROJECT_ENVIRONMENT=/tmp/docling-remote-provider-py312-dab32661 make validate: passed with repository-pinned tools. The flag preserves the deliberately minimal environment.
  • Native probes still select the HF and MLX branches and raise their missing-dependency errors when local inference is selected. Successful local model inference was not run.
  • No reference data regenerated. No real remote inference or model download performed.

Assisted by Codex. Patch and executable evidence reviewed before submission. DCO sign-off included.

Keep remote API pipeline setup independent of the HF and MLX provider modules. Cover current and legacy API options and preserve remote-service policy checks.

Signed-off-by: YamonBot <141118378+YamonBot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

✅ DCO Check Passed

Thanks @YamonBot, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

@github-actions github-actions Bot added bug Something isn't working vlm-pipeline labels Oct 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

AI triage (advisory)

Checked commit 30891e1789. The analysis read the diff only. It did not run code from this pull request.

Warning

The AI analysis did not finish. Only the deterministic checks are shown.

Topic labels added: bug, vlm-pipeline.

CI safety: not assessed.

Possibly related pull requests

PR State Signal Assessment
#4964 open changes the same code not assessed

The ai:* labels are advisory. They do not approve CI and they do not add tests:full. A new push runs this check again.

@dolfim-ibm dolfim-ibm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@codecov

codecov Bot commented Oct 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
docling/pipeline/vlm_pipeline.py 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@dolfim-ibm
dolfim-ibm merged commit 2eaca3a into docling-project:main Oct 26, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working vlm-pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remote API VLM pipeline eagerly imports optional local model providers

2 participants