Skip to content

fix(backends): use engine's runai-pulled local dir for register_model - #10599

Merged
nnshah1 merged 3 commits into
mainfrom
nnshah1/vllm-skip-mx-for-object-storage
Jun 12, 2026
Merged

nnshah1 merged 3 commits into
mainfrom
nnshah1/vllm-skip-mx-for-object-storage

Conversation

@nnshah1

@nnshah1 nnshah1 commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When --model (vLLM) / --model-path (SGLang) is an object-storage URI (s3://, gs://, az://), the engine pulls metadata files to a local temp dir during config construction and rewrites the runtime ModelConfig:

  • vLLM maybe_pull_model_tokenizer_for_runai (vllm/config/model.py:734) — sets model_config.model = <local dir>, model_config.model_weights = <original URI>
  • SGLang maybe_pull_model_tokenizer_from_remote (sglang/srt/configs/model_config.py:505) — sets model_config.model_path = <local dir>, model_config.model_weights = <original URI>

Dynamo's register_model was still receiving the raw URI (from config.model / server_args.model_path), routing it through lib/llm/src/hub.rs → ModelExpress. MxModelProvider has only three variants — HuggingFace, Ngc, Gcs — no S3. The call defaults to HuggingFace (hub.rs:155,163,207) and 404s:

modelexpress_client: Requesting model: s3://… from provider: HuggingFace
ERROR Failed to fetch model 's3://…' from HuggingFace.
  Is this a valid HuggingFace ID?
  Error: HTTP 404 for url (https://huggingface.co/api/models/s3://…/revision/main)

This crashes the worker before engine startup completes.

Fix

New helper _register_model_source_path(...) per backend:

  • vLLM (components/src/dynamo/vllm/main.py): reads vllm_config.model_config.model_weights as the sentinel; returns vllm_config.model_config.model (post-pull local dir) when set.
  • SGLang (components/src/dynamo/sglang/register.py): reads through the engine handle: engine.tokenizer_manager.model_config.model_weights; returns its .model_path when set. SGLang mutates the engine's ModelConfig — not ServerArgs.model_path — so the access goes through the engine.

In both cases register_model then takes its fs::exists shortcut (lib/bindings/python/rust/lib.rs:455) and skips the broken MX path.

Scope

  • vLLM: main.py register_vllm_model callsite.
  • SGLang: register.py LLM-path callsite (_register_model_with_runtime_config). Image/video diffusion paths already skip the Rust-side HF download (lib/bindings/python/rust/lib.rs:314) and don't need this.
  • TRT-LLM: deferred — model-load pattern is fundamentally different (pre-built engines, not runtime URI pull). Not on a known deployment path today.

Why "temporary workaround"

The proper fix belongs in hub.rs: detect object-storage schemes and route to the matching MxModelProvider variant (Gcs exists, S3 doesn't), or skip MX for schemes the server cannot serve. Larger Rust + Python-binding change; this PR unblocks deployments today.

Test plan

  • vLLM helper unit-tested (4 cases): s3 + pulled → local, HF id → original, local path → identity, missing attr → original (fallback).
  • SGLang helper unit-tested (4 cases): s3 + pulled → local, HF id → original, no tokenizer_manager → fallback, no model_config → fallback.
  • Both files ast.parse clean.
  • Manual: redeploy vLLM DynamoGraphDeployment with --model s3://... + --load-format modelexpress; confirm worker starts and serves.
  • Manual: SGLang --model-path s3://... smoke if a deployment is available.
  • CI.

🤖 Generated with Claude Code

@nnshah1
nnshah1 requested review from a team as code owners June 11, 2026 15:33
@github-actions github-actions Bot added fix backend::vllm Relates to the vllm backend labels Jun 11, 2026

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@coderabbitai

coderabbitai Bot commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The PR adds a helper function _register_model_source_path that determines whether to use vLLM's rewritten local model directory or the original config path, then updates register_vllm_model to use this helper when registering models. This ensures Dynamo targets the correct model location after vLLM handles object-storage downloads.

Changes

Model source path resolution

Layer / File(s) Summary
Model source path selection helper and usage
components/src/dynamo/vllm/main.py
_register_model_source_path helper selects between vLLM's rewritten local directory (vllm_config.model_config.model when model_weights is present) and the original config.model. register_vllm_model is updated to use this helper for correct model registration after object-storage rewrite.

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description is comprehensive, covering problem context, solution approach, scope, test plan, and rationale. All major sections are well-populated with technical details.
Title check ✅ Passed The title accurately describes the main change: using vLLM's locally-pulled directory for model registration instead of the raw object-storage URI.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@pull-request-size pull-request-size Bot added size/M and removed size/S labels Jun 11, 2026
@github-actions github-actions Bot added the backend::sglang Relates to the sglang backend label Jun 11, 2026
@nnshah1 nnshah1 changed the title fix(vllm): use vLLM's runai-pulled local dir for register_model fix(vllm,sglang): use engine's runai-pulled local dir for register_model Jun 11, 2026
@nnshah1
nnshah1 enabled auto-merge (squash) June 11, 2026 18:08
@nnshah1 nnshah1 changed the title fix(vllm,sglang): use engine's runai-pulled local dir for register_model fix(backends): use engine's runai-pulled local dir for register_model Jun 11, 2026
nnshah1 added a commit that referenced this pull request Jun 11, 2026
Adds vllm + sglang unit tests covering: object-storage URI with pull,
HF id, missing model_weights attr, empty-string sentinel, and (sglang)
absent tokenizer_manager / model_config fallbacks. Responsive to
@zhengluo-nv review on PR #10599.

Signed-off-by: nnshah1 <[email protected]>
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Jun 11, 2026
@nnshah1
nnshah1 force-pushed the nnshah1/vllm-skip-mx-for-object-storage branch from 68c47f4 to 1e5fe26 Compare June 11, 2026 19:23
@pull-request-size pull-request-size Bot added size/M and removed size/L labels Jun 11, 2026
nnshah1 added 2 commits June 11, 2026 14:02
When --model is an object-storage URI (s3://, gs://, az://), vLLM's
maybe_pull_model_tokenizer_for_runai (vllm/config/model.py) pulls
metadata files (config.json, tokenizer.json, …) to a local temp dir
and rewrites the ModelConfig:

  - model_weights = <original URI>   (for runai-streamer / mx plugin)
  - model         = <local temp dir> (now contains the metadata)

Dynamo's register_model was still receiving the raw URI and routing
it through hub.rs -> ModelExpress, which has no S3 provider and
returns 404 ("Is this a valid HuggingFace ID?"), crashing the
worker before vLLM finishes startup.

Pick vLLM's post-pull local dir when model_weights is populated;
register_model then takes its fs::exists shortcut in lib/bindings/
python/rust/lib.rs and skips the broken MX path entirely.

Temporary vLLM-only workaround. The longer-term fix is for hub.rs to
detect object-storage schemes and either route to the right
MxModelProvider variant or skip MX for schemes it cannot serve.

Signed-off-by: nnshah1 <[email protected]>
Mirror of the vLLM fix in the previous commit, applied to the SGLang
LLM path. SGLang's ModelConfig.maybe_pull_model_tokenizer_from_remote
(sglang/srt/configs/model_config.py:505) pulls *config.json files to a
local temp dir for s3:// / gs:// model paths and rewrites:

  - .model_weights = <original URI>
  - .model_path    = <local temp dir>

This mutation lives on engine.tokenizer_manager.model_config, NOT on
ServerArgs (which is what Dynamo's register_model previously read).
The fix reads through the engine handle, same shape as vLLM's helper.

LLM register path only — diffusion (Images/Videos) already skips the
Rust-side HF download via lib/bindings/python/rust/lib.rs:314, so it
doesn't need this.

Signed-off-by: nnshah1 <[email protected]>
Replace nested getattr-with-default chain with try/except AttributeError
on the well-known attribute path. mypy's getattr stub overloads can't
resolve the default-arg type for the model_weights lookup. Behavior is
identical.

Signed-off-by: nnshah1 <[email protected]>
@nnshah1
nnshah1 force-pushed the nnshah1/vllm-skip-mx-for-object-storage branch from 1e5fe26 to ccee375 Compare June 11, 2026 21:02
@nnshah1

nnshah1 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Local smoke verified — vllm worker launched against MinIO-faked S3 (Qwen3-0.6B, --load-format modelexpress, --model s3://...) progressed past the previously-failing Dynamo hub.rs → ModelExpress server → HF 404 path entirely. maybe_pull_model_tokenizer_for_runai ran, vllm pulled metadata to its local cache dir, and register_vllm_model consumed the local dir via the helper.

Remaining log error (No loading strategy succeeded from the modelexpress vllm plugin's strategy chain) is downstream of this PR's scope and unrelated — that's the weight-load fallback path, not the metadata-fetch path.

Integration test in #10610 still in progress; sglang local smoke kicking off in parallel (building sglang-runtime image).

@nnshah1

nnshah1 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Local smoke verified for both backends.

Test rig: MinIO (S3-compatible) on :9000 with Qwen3-0.6B uploaded; etcd + NATS for the runtime; dynamo:smoke-{vllm,sglang}-runtime built from this branch with GPU passthrough.

vllm (python -m dynamo.vllm --model s3://my-base-models/Qwen_Qwen3-0.6B --load-format modelexpress):

  • ✅ Dynamo's fetch_model prefetch skipped (no hub.rs → ModelExpress → HF 404).
  • ✅ vLLM's maybe_pull_model_tokenizer_for_runai pulled metadata to /home/dynamo/.cache/vllm/assets/model_streamer/<hash>.
  • ✅ register_vllm_model consumed the local dir via _register_model_source_path.
  • ❌ Downstream — modelexpress vllm plugin's strategy chain (No loading strategy succeeded) — out of scope for this PR.

sglang (python -m dynamo.sglang --model-path s3://my-base-models/Qwen_Qwen3-0.6B --load-format remote_instance --remote-instance-weight-loader-backend modelexpress):

  • ✅ Dynamo's fetch_model prefetch skipped.
  • ✅ SGLang's maybe_pull_model_tokenizer_from_remote pulled metadata: Runai Model : /home/dynamo/.cache/sglang/model_streamer/<hash>, metadata ready.
  • ✅ boto3 picked up AWS_ENDPOINT_URL → Found endpoint for s3 via: environment_global.
  • ✅ Engine launched subprocesses past register_model.

In both cases the previously-failing HTTP 404 for url (https://huggingface.co/api/models/s3://.../revision/main) is gone. Any remaining failures are downstream weight-loader paths unrelated to this PR.

Integration test #10610 hitting the same downstream weight-load issue (Main server process exited with code 1 while waiting for health check) — that's a fixture / load-format wiring concern in the test, not a fix correctness concern. Will iterate on that PR separately.

@zhengluo-nv zhengluo-nv mentioned this pull request Jun 12, 2026
1 task done
@nnshah1
nnshah1 merged commit 56b03d5 into main Jun 12, 2026
87 checks passed
@nnshah1
nnshah1 deleted the nnshah1/vllm-skip-mx-for-object-storage branch June 12, 2026 19:25
@nnshah1

nnshah1 commented Jun 13, 2026

Copy link
Copy Markdown
Contributor Author

Full end-to-end smoke verified for both backends against MinIO-faked S3.

Followed the canonical runai-model-streamer recipe per vLLM docs:

  • AWS_ENDPOINT_URL, AWS_ACCESS_KEY_ID/SECRET/REGION, AWS_ALLOW_HTTP=true
  • RUNAI_STREAMER_S3_USE_VIRTUAL_ADDRESSING=0 (MinIO uses path-style)
  • AWS_EC2_METADATA_DISABLED=true (without this, AWS SDK C++ hangs trying to reach 169.254.169.254 → surfaces as libstreamer Unknown Error)
  • MX_MODEL_URI (modelexpress ModelStreamer strategy gate)

vLLM (--load-format modelexpress):

✅ Model streamer weight loading complete
✅ init engine (profile, create kv cache, warmup) took 30.98s
✅ Registered base model 'Qwen/Qwen3-0.6B' MDC
✅ Registered endpoint 'dynamo.backend.generate' with shared TCP server

SGLang (--load-format remote_instance --remote-instance-weight-loader-backend modelexpress):

✅ Loading safetensors using Runai Model Streamer: 100% Completed | 311/311
✅ Load weight end. elapsed=2.88 s
✅ KV Cache is allocated. #tokens: 168301
✅ Registered base model 'Qwen/Qwen3-0.6B' MDC
✅ Registered endpoint 'dynamo.backend.generate' with shared TCP server

Both workers reach the post-register state — the fix's contract holds end-to-end across both backends. Integration test infra in #10610 now configured with the same env.

yao531441 pushed a commit to yao531441/dynamo that referenced this pull request Jun 24, 2026
nnshah1 added a commit that referenced this pull request Jul 8, 2026
Capstone of the gh-8749 stack: workers now advertise their MDC files
over the system_status_server by default instead of requiring shared
storage.

Behavior:
  - Unset env  -> ON (new default)
  - 0/false/no/off (case-insensitive) -> OFF (opt out)
  - Otherwise -> ON

Hard-fail (anyhow::bail!) when self_host_metadata is on but
DYN_SYSTEM_PORT is unset, so misconfigurations surface at first
registration instead of producing WARN spam plus silently degraded
hf:// MDC advertisement. The k8s operator already sets
DYN_SYSTEM_PORT=9090 (deploy/operator/internal/dynamo/component_worker.go)
so operator-managed deployments are unaffected. Bare / non-operator
upgrades either set DYN_SYSTEM_PORT or set DYN_SELF_HOST_METADATA=0.

All prerequisites in main:
  #8855  worker HTTP hosting on system_status_server
  #9057  frontend MDC verify-and-cache pipeline
  #9610  harvest non-weight siblings into slug_dir
  #9707  worker advertises non-typed metadata siblings via extra_files
  #10037 native preprocessor consumes resolved local_dir
  #10599 register_model uses engine's runai-pulled local dir on
         object-storage URIs
  #10351 auto-clean MetadataArtifactRegistry on detach

Signed-off-by: nnshah1 <[email protected]>
nnshah1 added a commit that referenced this pull request Jul 8, 2026
Capstone of the gh-8749 stack: workers advertise their MDC files over
the system_status_server by default instead of requiring shared
storage.

Behavior:
  - Unset env  -> ON (new default)
  - 0/false/no/off (case-insensitive, trimmed) -> OFF (opt out)
  - Otherwise -> ON

Hard-fail (anyhow::bail!) when self_host_metadata is on but
DYN_SYSTEM_PORT is unset — surfaces misconfigurations at first
registration instead of WARN spam plus silently degraded hf:// MDC
advertisement. The k8s operator sets DYN_SYSTEM_PORT=9090 (see
deploy/operator/internal/dynamo/component_worker.go), so operator-
managed deployments are unaffected. Bare / non-operator upgrades
either set DYN_SYSTEM_PORT or set DYN_SELF_HOST_METADATA=0.

All prerequisites are in main:
  #8855  worker HTTP hosting on system_status_server
  #9057  frontend MDC verify-and-cache pipeline
  #9610  harvest non-weight siblings into slug_dir
  #9707  worker advertises non-typed metadata siblings via extra_files
  #10037 native preprocessor consumes resolved local_dir
  #10599 register_model uses engine's runai-pulled local dir on
         object-storage URIs
  #10351 auto-clean MetadataArtifactRegistry on detach

Signed-off-by: nnshah1 <[email protected]>
nnshah1 added a commit that referenced this pull request Jul 8, 2026
Capstone of the gh-8749 stack: workers advertise their MDC files over
the system_status_server by default instead of requiring shared
storage.

Behavior:
  - Unset env  -> ON (new default)
  - 0/false/no/off (case-insensitive, trimmed) -> OFF (opt out)
  - Otherwise -> ON

Hard-fail (anyhow::bail!) when self_host_metadata is on but
DYN_SYSTEM_PORT is unset — surfaces misconfigurations at first
registration instead of WARN spam plus silently degraded hf:// MDC
advertisement. The k8s operator sets DYN_SYSTEM_PORT=9090 (see
deploy/operator/internal/dynamo/component_worker.go), so operator-
managed deployments are unaffected. Bare / non-operator upgrades
either set DYN_SYSTEM_PORT or set DYN_SELF_HOST_METADATA=0.

All prerequisites are in main:
  #8855  worker HTTP hosting on system_status_server
  #9057  frontend MDC verify-and-cache pipeline
  #9610  harvest non-weight siblings into slug_dir
  #9707  worker advertises non-typed metadata siblings via extra_files
  #10037 native preprocessor consumes resolved local_dir
  #10599 register_model uses engine's runai-pulled local dir on
         object-storage URIs
  #10351 auto-clean MetadataArtifactRegistry on detach

Signed-off-by: nnshah1 <[email protected]>
nnshah1 added a commit that referenced this pull request Jul 8, 2026
Capstone of the gh-8749 stack: workers advertise their MDC files over
the system_status_server by default instead of requiring shared
storage.

Behavior:
  - Unset env  -> ON (new default)
  - 0/false/no/off (case-insensitive, trimmed) -> OFF (opt out)
  - Otherwise -> ON

Hard-fail (anyhow::bail!) when self_host_metadata is on but
DYN_SYSTEM_PORT is unset — surfaces misconfigurations at first
registration instead of WARN spam plus silently degraded hf:// MDC
advertisement. The k8s operator sets DYN_SYSTEM_PORT=9090 (see
deploy/operator/internal/dynamo/component_worker.go), so operator-
managed deployments are unaffected. Bare / non-operator upgrades
either set DYN_SYSTEM_PORT or set DYN_SELF_HOST_METADATA=0.

All prerequisites are in main:
  #8855  worker HTTP hosting on system_status_server
  #9057  frontend MDC verify-and-cache pipeline
  #9610  harvest non-weight siblings into slug_dir
  #9707  worker advertises non-typed metadata siblings via extra_files
  #10037 native preprocessor consumes resolved local_dir
  #10599 register_model uses engine's runai-pulled local dir on
         object-storage URIs
  #10351 auto-clean MetadataArtifactRegistry on detach

Signed-off-by: nnshah1 <[email protected]>
nnshah1 added a commit that referenced this pull request Jul 8, 2026
Capstone of the gh-8749 stack: workers advertise their MDC files over
the system_status_server by default instead of requiring shared
storage.

Behavior:
  - Unset env  -> ON (new default)
  - 0/false/no/off (case-insensitive, trimmed) -> OFF (opt out)
  - Otherwise -> ON

Hard-fail (anyhow::bail!) when self_host_metadata is on but
DYN_SYSTEM_PORT is unset — surfaces misconfigurations at first
registration instead of WARN spam plus silently degraded hf:// MDC
advertisement. The k8s operator sets DYN_SYSTEM_PORT=9090 (see
deploy/operator/internal/dynamo/component_worker.go), so operator-
managed deployments are unaffected. Bare / non-operator upgrades
either set DYN_SYSTEM_PORT or set DYN_SELF_HOST_METADATA=0.

All prerequisites are in main:
  #8855  worker HTTP hosting on system_status_server
  #9057  frontend MDC verify-and-cache pipeline
  #9610  harvest non-weight siblings into slug_dir
  #9707  worker advertises non-typed metadata siblings via extra_files
  #10037 native preprocessor consumes resolved local_dir
  #10599 register_model uses engine's runai-pulled local dir on
         object-storage URIs
  #10351 auto-clean MetadataArtifactRegistry on detach

Signed-off-by: nnshah1 <[email protected]>

This branch was previously deployed

1 inactive deployment
GITLAB — ccee3756 Deployed Jun 11, 2026 by copy-pr-bot[bot] via Trigger CI Pipeline #31015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend::sglang Relates to the sglang backend backend::vllm Relates to the vllm backend fix size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants